Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves small FFT performance (~50% for sizes < 1024) by adding specialized kernels for 512 and 1024-element FFTs that avoid recursion overhead. The changes introduce new optimized paths that perform outer butterfly stages inline before delegating to existing 256-element kernels.
- Adds dedicated kernels (kerDIFNP_512, kerDITNP_512, kerDIFNP_1024, kerDITNP_1024) for both DIF and DIT FFT algorithms
- Updates dispatch logic to route 512 and 1024-element FFTs to specialized kernels when ASM support is available
- Generated code applied to babybear and koalabear field implementations
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/generator/field/template/fft/fft.go.tmpl | Adds template code for 512/1024 element kernels and updates dispatch logic with new size checks (conditional on HasASMKernel) |
| field/koalabear/fft/fft.go | Generated code: adds four new kernel functions and updates difFFT/ditFFT dispatch to check for n==512 and n==1024 |
| field/babybear/fft/fft.go | Generated code: adds four new kernel functions and updates difFFT/ditFFT dispatch to check for n==512 and n==1024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improve small size fft runtime (~50%) by avoiding overhead for small sizes (< 1024) .
Note
Optimizes small FFT sizes by bypassing recursion for
n=512andn=1024.kerDIFNP_512/kerDITNP_512andkerDIFNP_1024/kerDITNP_1024infield/babybear/fft/fft.goandfield/koalabear/fft/fft.godifFFT/ditFFTto directly call these kernels whenstage >= twiddlesStartStageandn ∈ {512,1024}internal/generator/field/template/fft/fft.go.tmplto emit the same kernels and conditional dispatch (guarded byHasASMKernel)Written by Cursor Bugbot for commit 21ae715. This will update automatically on new commits. Configure here.