Cache per-level FFT twiddle tables - #324
Merged
Merged
Conversation
ValarDragon
marked this pull request as ready for review
September 2, 2026 22:07
|
Note Complete: Audit complete. No review-worthy issues remain after automated review. One finding was auto-invalidated. Open the full results here. Analyzed one file, diff |
Co-authored-by: burbach7 <burbach7@outlook.com>
ValarDragon
force-pushed
the
perf/cache-fft-twiddle-tables
branch
from
September 2, 2026 22:45
b3ffaae to
4b72e48
Compare
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.
This extracts the portable FFT-cache component of #290. It deliberately omits
the evaluator batching and x86-only field-arithmetic dependency from that PR;
the evaluator-only component regressed the one-action Mac screen.
What changed
proving-key twiddle arrays.
strided scalar loop for small levels.
The tables are constructed eagerly by
keygen_pk; proof creation and explicitcommitment preparation do not lazily initialize them. The proof format,
transcript, and verifier behavior are unchanged.
Performance
All latency measurements below were made from
ca2f53cwith candidate2847a60. This branch is rebased onto currentmainate1cbe51d, which alsocontains the prepared-MSM fold from #320, so I am not treating the older timing
data as a post-#320 measurement.
The harness was
prepared_first_proof.rsat SHA-2563db624e0908ddb5d87f6d95dbedb619f2efadc662600551e26051403562c8828, builtwith Rust 1.97.1, release ThinLTO,
--no-default-features, and--features circuit,multicore. Runtime worker counts were set only withRAYON_NUM_THREADS.On a 10-core Apple arm64 host with 10 Rayon workers, 100 fully counterbalanced
control/candidate pairs gave:
The one-action result is neutral; the four-action improvement is resolved and
agreed across candidate-first and candidate-second positions (-0.740 ms and
-0.847 ms). Three thermally or competitively contaminated attempts were
rejected by the runner and repeated.
On an x86_64 Linux host with six Rayon workers, 100 ABBA pairs per action count
were neutral: -0.217 ms (-0.174%), bootstrap 95% CI [-1.461, +0.951] ms at one
action, and +0.161 ms (+0.047%), CI [-0.966, +1.280] ms at four actions.
The benchmark's four-run action schedule aliases key-generation block position
with action count. The apparent Mac key-generation deltas reversed sign between
one and four actions, so the run does not identify a setup benefit or cost and
none is claimed here.
Memory and correctness
For the Orchard k=11 domain, the additional per-level caches retain 585,656
bytes per independently generated proving key under stable 64-bit accounting:
585,312 bytes of field elements, 312 bytes of
Vecdescriptors, and 32 bytesfor the two added
Archandles. This excludes allocator metadata, allocationrounding, and
Arcreference-count headers. Cloned proving keys share theallocations.
Seeded control and candidate proofs were byte-identical on both hosts:
d2af1db7354fd2d31b3d3ae8108708e5a31b8cfd944f8961c72e21e99d8ae2c7a0d03e72a4e71464550f28fab844cd1a777065fd791a9659dc394fc8985e0f01The rebased branch passes the full
zakura-halo2-proofstest suite with themulticorefeature, no-default-features checks both with and withoutmulticore, formatting, and the cache-size/sharing regression test across thecurrent Orchard domain.
There are no public or
pub(crate)API additions or signature changes, nodependency or feature changes, and no new
unsafecode. The cached values arefixed domain roots and do not depend on witnesses, challenges, or secrets.