Repository navigation
AVX2/FMA kernels - #174
Merged
Merged
AVX2/FMA kernels#174
Conversation
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.
Add four-lane AVX2/FMA kernels to the BN254 Fp12 small-prime backend.
• Vectorize forward and inverse radix-4 butterflies, inverse normalization, and pointwise multiplication and squaring.
• Reuse packed modulus and reciprocal constants across each batch.
• Share butterfly and extension-field formulas between scalar and packed paths, preserving exact residue bounds.
• Retain scalar handling for short transforms and tails, and the exact integer fallback for unsupported floating-point modes.
Measured on an AMD EPYC 9454 with GCC 15.2, -O3 -DNDEBUG -march=native, one pinned CPU, identical synthetic inputs, and no
instrumentation. Results compare 93857d6 against 2b6e7a5 at degree 14,938, using five measured trials after two warmups.
Operation Before After Speedup
Modular multiplication 1,625.0 ms 1,072.8 ms 1.51×
Modular squaring 1,456.4 ms 989.4 ms 1.47×
Multiplication 770.9 ms 524.2 ms 1.47×
Squaring 604.9 ms 453.0 ms 1.34×
Low product 609.7 ms 363.9 ms 1.68×
Prepared low product 499.5 ms 293.7 ms 1.70×
Cyclic remainder 356.7 ms 258.2 ms 1.38×
Division with remainder 853.9 ms 550.7 ms 1.55×
These are complete polynomial-operation timings, including conversion and CRT reconstruction/export.