Skip to content

AVX2/FMA kernels - #174

Merged
odraccir1 merged 2 commits into
masterfrom
ra/small_prime_ntt_SIMD
Oct 15, 2026
Merged

odraccir1 merged 2 commits into
masterfrom
ra/small_prime_ntt_SIMD

Conversation

@odraccir1

@odraccir1 odraccir1 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@odraccir1
odraccir1 requested a review from spaceships October 15, 2026 23:03
@odraccir1
odraccir1 merged commit 06d04c0 into master Oct 15, 2026
2 checks passed
@odraccir1
odraccir1 deleted the ra/small_prime_ntt_SIMD branch October 15, 2026 23:04
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.

1 participant