Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate fft in AVX backend #394

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

spapinistarkware
Copy link
Contributor

@spapinistarkware spapinistarkware commented Feb 23, 2024

This change is Reviewable

This was referenced Feb 23, 2024
@spapinistarkware spapinistarkware marked this pull request as ready for review February 23, 2024 07:01
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch from 7b32243 to 4d4559e Compare February 24, 2024 10:28
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from f4b7ea2 to 01182e8 Compare February 24, 2024 10:28
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch from 4d4559e to 77d3321 Compare February 25, 2024 08:33
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from 01182e8 to 6242a6e Compare February 25, 2024 08:33
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from a292ff0 to caf1bad Compare March 4, 2024 09:24
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch from 0cebf44 to 1aec621 Compare March 4, 2024 11:04
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from caf1bad to fb7a548 Compare March 4, 2024 11:04
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch 2 times, most recently from de3f95c to 436ea83 Compare March 6, 2024 13:50
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from fb7a548 to f17ff9b Compare March 6, 2024 13:53
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from f17ff9b to 500ce14 Compare March 6, 2024 14:10
@spapinistarkware spapinistarkware requested review from shaharsamocha7 and removed request for ilyalesokhin-starkware March 6, 2024 14:11
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch from 436ea83 to 2c277df Compare March 6, 2024 14:49
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from 500ce14 to dae360f Compare March 6, 2024 14:49
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch from 2c277df to 52f967c Compare March 6, 2024 14:50
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from dae360f to 3d8f731 Compare March 6, 2024 14:51
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-AVX_regular_fft branch from 52f967c to 58647c1 Compare March 6, 2024 14:57
@spapinistarkware spapinistarkware changed the base branch from spapini/02-22-AVX_regular_fft to dev March 6, 2024 15:01
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from 3d8f731 to da83eab Compare March 6, 2024 15:03
Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @spapinistarkware)


src/core/backend/avx512/circle.rs line 30 at r1 (raw file):

        AVX512Backend::bit_reverse_column(&mut values);
        // TODO(spapini): Handle small cases.
        let log_size = values.length.ilog2();

Move to the beginning of the function

I guess that if this is too small then we can just do trivial interpolation without twiddles or anything

Code quote:

        // TODO(spapini): Handle small cases.
        let log_size = values.length.ilog2();

src/core/backend/avx512/circle.rs line 38 at r1 (raw file):

                log_size as usize,
            );
        }

Should this be implemented also for AVX512?

Code quote:

        unsafe {
            ifft::ifft(
                std::mem::transmute(values.data.as_mut_ptr()),
                &twiddles[1..],
                log_size as usize,
            );
        }

src/core/backend/avx512/circle.rs line 54 at r1 (raw file):

        _point: crate::core::circle::CirclePoint<E>,
    ) -> E {
        todo!()

Why did you change it?

Code quote:

    fn eval_at_point<E: crate::core::fields::ExtensionOf<BaseField>>(
        _poly: &CirclePoly<Self, BaseField>,
        _point: crate::core::circle::CirclePoint<E>,
    ) -> E {
        todo!()

src/core/backend/avx512/circle.rs line 64 at r1 (raw file):

        // TODO(spapini): Precompute twiddles.
        let twiddles = rfft::get_twiddle_dbls(domain);

Why this file is called rfft? (and not fft?)

Code quote:

rfft

Copy link
Contributor Author

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @shaharsamocha7)


src/core/backend/avx512/circle.rs line 38 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Should this be implemented also for AVX512?

This is the avx512 impl


src/core/backend/avx512/circle.rs line 54 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Why did you change it?

It does not bring the right results now. Next few PRs fix this.
The orde of the coefficients is different with the new fft impl.


src/core/backend/avx512/circle.rs line 64 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Why this file is called rfft? (and not fft?)

Because rust doesn;t let me have fft module inside fft module.

@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from da83eab to c29f8f0 Compare March 6, 2024 17:08
Copy link
Contributor Author

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @shaharsamocha7)


src/core/backend/avx512/circle.rs line 30 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Move to the beginning of the function

I guess that if this is too small then we can just do trivial interpolation without twiddles or anything

Done.

Yes, I'm adding this in the next few PRs.

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @spapinistarkware)


src/core/backend/avx512/circle.rs line 38 at r1 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

This is the avx512 impl

My bad


src/core/backend/avx512/circle.rs line 64 at r1 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

Because rust doesn;t let me have fft module inside fft module.

so what rfft stands for?
maybe we should change the dir name to NTT?

Copy link
Contributor Author

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @shaharsamocha7)


src/core/backend/avx512/circle.rs line 64 at r1 (raw file):

Previously, shaharsamocha7 wrote…

so what rfft stands for?
maybe we should change the dir name to NTT?

regular. it says so at the top of the module.
I can change it in another PR. Let's discuss a good name tomorrow:)

Copy link

graphite-app bot commented Mar 6, 2024

Merge activity

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/starkware-libs/stwo/394)
<!-- Reviewable:end -->
@spapinistarkware spapinistarkware force-pushed the spapini/02-22-Incorporate_fft_in_AVX_backend branch from c29f8f0 to 642cc8d Compare March 6, 2024 19:10
@graphite-app graphite-app bot merged commit 642cc8d into dev Mar 6, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants