Repository navigation
Avx2 775 trim - #782
Merged
Merged
Avx2 775 trim#782
Conversation
Benchmarks: base against this PR, on one runner1902ed0 merged into its base, against the base 9d37339: each benchmark run in turns on one runner, base and PR 5 times each. A size is shown when it changed; a time or a peak memory when it moved the same way in every round and its median by at least 1% (the change is the median ratio, with the rounds' range). Threads shows the named configuration; Keccak GKR
Every resultKeccak GKR
|
From #775: the grind permutes its candidates in lanes and reads the one lane it tests, rather than transposing whole states through keccak_f_many; same smallest nonce. 1400 leanXMSS at 8 / 4 threads: Zen 4 -1.3% / -1.2%, Arrow Lake -0.7% / -1.1%. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From #775: where AVX-512 VBMI with GFNI is missing, gather the byte columns with unpacks and a shuffle, then bit-transpose them by one GFNI affine map, or by three masked-swap rounds without GFNI. 1400 leanXMSS at 8 / 4 threads: Arrow Lake -0.7% / -1.2%. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From #775: the table pass builds its rows by byte maps, GFNI affine or vpshufb nibble lookups, on every AVX2 target rather than only on AVX-512 with GFNI; the x86 fold_groups arms it leaves unused go. 1400 leanXMSS at 8 / 4 threads: Arrow Lake -0.8% / -1.4%. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From #775: products_into, the round message and the fused fold run eight lanes at a time with VPCLMULQDQ on AVX2 too, as two x4 halves, with x8 and f128x8 sharing their method names. 1400 leanXMSS at 8 / 4 threads: Arrow Lake -0.5% / -2.0%. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From #775: the product sums are taken on each product's values at six points of GF(2^8), by byte maps and GF2P8MULB, rather than on its carry-less coefficients, which the inverse evaluation map recovers once a layer. 1400 leanXMSS at 8 / 4 threads: Zen 4 -2.4% / -3.2%, Arrow Lake -2.1% / -3.8%. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From #775: a digit-bucket part is a whole block position on AVX2 too, six registers, so each bucket's loop runs once per digit rather than twice and the half-position arm goes. Only AVX2 without GFNI (Zen 3, Haswell) runs the buckets; elsewhere it is a simplification. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e made From #775: each bucket's sum adds into the sums of its value's two nibbles as it is made, rather than into 256 sums halved eight times, so a digit's scratch is 32 parts on the stack. It pays where the buckets are the product path; 1400 leanXMSS on an Apple M4 Max at 8 / 4 threads: -0.8% / -0.2%. Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TomWambsgans
force-pushed
the
avx2-775-trim
branch
from
November 18, 2026 13:53
7f7ed68 to
1902ed0
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.
experimental: AVX2 speedups from #775, trimmed
7 of the 18 commits of #775 by @kevaundray, each simplified, with tests added and re-measured: +1,172/-551 in 14 files, against #775's +2,943/-875 in 31. Rebased on main. The proof bytes are unchanged, the verifier is untouched, and the stable prover changes only through the shared grind, which returns the same nonces.
keccak256: search grinding nonces with first_noncekeccak_f_many; same smallest nonceprimitives: AVX2 arms for bit_transpose_64byteskeccak_gkr: table rows by byte maps on AVX2vpshufbnibble maps on every AVX2 target; the x86fold_groupsarms it leaves unused golean_vm_core: bus GKR vertical kernels on AVX2+VPCLMULQDQx4halves;x8andf128x8share their method nameskeccak_gkr: GFNI product sums on values at six pointskeccak_gkr: whole-position parts on AVX2keccak_gkr: fold digit bucket sums by nibblesLeft out of #775 (11 commits)
9d7e41f76(rows padded to four lanes, +175/-118) is slower at 8 threads on Zen 4 and Arrow Lake: rows that aren't a multiple of 8 lanes lose the encode's streaming stores.08209e93a(L0 leaves hashed from their data lanes, +91/-51) gains nothing at 8 or 4 threads without it.8a3fe5188(level-0 lane fold on AVX2, +536/-12) gains at most 0.4% on Arrow Lake at 8 and 4 threads.8f7705d64(BitFold row transpose, +202/-126): on GFNI CPUs it only touches the ring-switch lift, and its own A/B shows under 1% single-threaded. Not measured here.c52813010,836ec09f0,918df52d1);skip_clmul(c1fc8efc3,491743d4a);ae7b9f5d5,ff71b8aa1).first_nonceis a 15-line search over the unchangedpermute, rather than experimental: AVX2 single-thread speedups (taken from riscv branch) #775'spermuterefactor. The two are equal end to end on Arrow Lake; on Zen 4, experimental: AVX2 single-thread speedups (taken from riscv branch) #775's version is about 1.2% faster (1400 leanXMSS at 8 and 4 threads, interleaved).Results
Proving time against main,
--repeat 3, two interleaved rounds:aggregate --xmss 1400 --log-inv-rate 2recursion --n 4 --xmss-per-leaf 1400 --leaf-log-inv-rate 2 --log-inv-rate 1* On the previous revision of this branch. The only change since on Apple's paths is one memset fewer per digit in the bucket sums.
Nothing measured is slower. Not measured: the sphincs and blob aggregations, and CPUs without GFNI (Haswell, Zen 3), whose paths commits 2, 3, 6 and 7 change.
Checks
identical_proofsat 1 and 3 threads on 9 x86 builds: native Zen 5, znver4, znver3, alderlake, skylake-avx512, haswell, x86-64-v3+gfni, x86-64-v4+vpclmulqdq, and znver4 without AVX-512.-D warningsand its tests on its own, on native, haswell, znver3 and znver4 without AVX-512.🤖 Generated with Claude Code