Skip to content

Accelerate BN254 CRT export with AVX-512 IFMA - #182

Merged
odraccir1 merged 1 commit into
masterfrom
ra/crt_export_ifma
Oct 22, 2026
Merged

odraccir1 merged 1 commit into
masterfrom
ra/crt_export_ifma

Conversation

@odraccir1

@odraccir1 odraccir1 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Vectorize CRT reconstruction and BN254 export across eight coefficients, reducing the measured kernel time by approximately 64%.

The implementation:

• Uses AVX-512 IFMA for weighted CRT accumulation, exact bound certification, centering corrections, and Montgomery reduction.
• Incorporates radix adjustment into precomputed weights, producing the existing BN254 Montgomery representation directly.
• Preserves exact reconstruction fallback, rounding-mode handling, partial batches, and completed output prefixes when reconstruction encounters an invalid bound.

• Retains existing implementations for builds without the required instruction set.

All arithmetic remains exact. The fast-path certificate and accumulator bounds determine when vectorized reconstruction is valid; uncertified lanes use the existing exact fallback.

Measurements on an AMD EPYC 9454 with GCC 15.2, -O3 -march=native, and one pinned thread:

Output coefficients: Before, After, Speedup
14,938: 13.692 ms, 4.944 ms, 2.77×
29,875: 28.413 ms, 10.232 ms, 2.78×

These are median times from seven measured trials after two warmups, using clean production builds, eleven auxiliary primes, and twelve Fp12 coordinates. Measurements cover weighted CRT reconstruction and export, including output stores; setup, input conversion, and verification are excluded.

@odraccir1
odraccir1 requested a review from spaceships October 22, 2026 17:11
@odraccir1
odraccir1 merged commit e53f699 into master Oct 22, 2026
2 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.

1 participant