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

perf,memory: fft without precompute #472

Merged
merged 18 commits into from
Dec 21, 2023
Merged

perf,memory: fft without precompute #472

merged 18 commits into from
Dec 21, 2023

Conversation

gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Dec 14, 2023

In short, this PR allows for fft.NewDomain() to have an option fft.WithoutPrecompute() which initializes the domain without precomputing (all) twiddles & coset tables.

For large domains, this save a huge amount of memory at the cost of 20-30% CPU perf downgrade.

To simplify code, it modifies existing inner DIF and DIT fft methods to take a precomputed twiddle table and a starting stage; so twiddles can still be precomputed but we skip the first stages (each stage we skip we save domain.Cardinality / stage*2 memory).

Copy link

📦 github.com/consensys/gnark-crypto/ecc/bls12-377/fr/fft
TestBitReverse 0s

📦 github.com/consensys/gnark-crypto/ecc/bls12-377/fr/fri
TestFRI 0s

Copy link

📦 github.com/consensys/gnark-crypto/ecc/bls12-377/fr/fft
TestBitReverse 0s

📦 github.com/consensys/gnark-crypto/ecc/bls12-377/fr/fri
TestFRI 0s

Copy link
Collaborator

@ivokub ivokub left a comment

Choose a reason for hiding this comment

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

Conditional accept - I do not have enough knowledge about FFTs and twiddles to understand if done correctly. But making the computation optional seems correct.

If not urgent then I would ask @ThomasPiellard to confirm.

internal/generator/fft/template/options.go.tmpl Outdated Show resolved Hide resolved
@gbotrel gbotrel merged commit 5d5eded into master Dec 21, 2023
4 checks passed
@gbotrel gbotrel deleted the feat/fftnoprecompute branch December 21, 2023 17:19
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