Repository navigation
Open
Description
Overview of the performance work on the GKR prover: gkr_reduce in the prover and verifier, and crates/gkr. Part of #41.
Benchmark
cargo bench -p prover --bench prover -- gkr, shape (10, 15), M3 Pro (5 performance + 6 efficiency cores).
| State | All threads | One thread |
|---|---|---|
| Before #55 | 363 ms | 480 ms |
| #55 | 166 ms | 283 ms |
| Pre-#146 main | 115 ms | 215 ms |
| #146 | 68 ms | 158 ms |
All numbers are medians. The last two rows were measured on 2026-10-22. For one thread, #55 used single_threaded.patch and the later rows RAYON_NUM_THREADS=1.
Done
- Grand product GKR: core structure #40: Core structure of the grand product GKR.
- GKR integration #49: GKR integrated into the prover and verifier. Removed the deallocations and the deque from the prove layer. Replaced the m-table with a factored claim discharged through the PCS.
- GKR: benchmark and profiling setup + improvements #55: Benchmark and profiling setup: divan bench, profiling example, and
single_threaded.patch. Also:- transposed the bit table before leaf construction, so the walk is sequential;
- fixed the exponential over-allocation in
SuffixTable::new; - made the m-table accumulation branchless;
- zeroed vectors with
bytemuck'szeroed_vec.
- GKR: Second optimisation set #60: Second pass over the round loop:
SuffixTableflattened into one preallocated buffer, reused across layers;batched_evalconsumes the circuit instead of cloning the leaves;eq_factorinlined in closed form;- rayon fold replaced by 2-wide interleaved PMULL chains, with a fused multiply-reduce in
mul3_wide; - layer sumcheck chunked to reduce variance.
- Separate Bit Transpose from Bittable #137: Separated the bit transpose from
BitTable.BitTablestays the protocol's view of the witness, andBitMatrixdoes the bit operations. The witness is read asu128words. - GKR: lookup tables and bucketing #146: Lookup tables and bucketing for the bottom three layers (also closed Generate GKR product forests with lazy L2/L4/L8 storage #107 and Parallelize forest construction and select public lazy schedules #116):
- Layers 0–2 (the leaves and the two layers above them) are never built. Their nodes come from 16-entry lookup tables indexed by nibbles of the transposed bits.
- Round 1 of the sumchecks of layers 0–2 reads the nibbles and the lookup tables directly.
- The lookup tables, layer 3 and the layers above it are built in parallel.
- Round 1 of the leaves and of layer 1 splits eq into
eq_hi · eq_lo.
No longer applies
- m-table items (add assign, bit enumerator): GKR integration #49 removed the m-table.
- Branchless leaf construction: the leaves are not built after GKR: lookup tables and bucketing #146.
In progress
- Split Suffix Table optimisation #152 (resolves Split Suffix Table optimisation #58): Split Suffix (prefix) Table optimisation — replaces the dense eq table with low/high tables (cuts
Build eq tablesfrom ~15.5–25.8 ms to ~0.14–0.15 ms and GKR RSS rise from 254 MiB to 128 MiB on 600-block SHA-256).
To do
Follow-ups to #146
At (10, 15) on all threads, about 25 of the 68 ms run on a single thread. Removing that would bring the bench to about 43 ms.
- Eq tables:
EqTables::newtakes about 18.5 ms, all of it serial — in progress in Split Suffix Table optimisation #152 (Split Suffix Table optimisation #58). - Zeroing with calloc runs on one thread (about 4.3 ms):
eq_memory,bound_childrenand layer 3 are fully written before they are read. - Parallel bit transpose in
LutLayers::new(BitMatrix::transposeincrates/common/src/matrix.rs, about 2.1 ms). - Don't split the dense round loops below 2^15 lanes (about 0.45 ms per proof).
- Fuse bind with the next round's sums (Fuse GKR dense folding with the next round message pass #109).
round_sumsandbindare bound by memory bandwidth. - Layer 3 optimisation (Layer 3 optimisation #144): fold layer 4 in layer 3's pass, or apply LUT-style techniques without materialising layer 3 in full.
Remaining BitZ-PoC ports (trimmed to active high-leverage items)
- Split Suffix Table optimisation #58 Split the eq (suffix) table — in progress in Split Suffix Table optimisation #152
- Use bit-selected lookup prefixes in the GKR sumcheck #108 Bit-selected lookup prefixes (rounds 2–3 on top of GKR: lookup tables and bucketing #146)
- Fuse GKR dense folding with the next round message pass #109 Fuse dense folding with the next round's message (Split Suffix Table optimisation #58)
- Execute two GKR dense rounds from one bivariate grid pass #110 Two dense rounds from one bivariate grid pass (Split Suffix Table optimisation #58, Fuse GKR dense folding with the next round message pass #109)
- Skip structurally padded all-one GKR trees analytically #112 Skip padded all-one trees analytically (Split Suffix Table optimisation #58)
- Add x86 carryless-multiply kernels to the GKR field backend #118 x86 carryless-multiply kernels
(Completed by #146: #107, #116. Closed as premature / PoC-layout-specific / low-priority experiments: #111, #113, #114, #115, #117, #128, #129.)
Related
- Prover and verifier optimisation: tracking issue #41: prover and verifier optimisation tracker
- Size the rayon pool to the performance cores #48: size the rayon pool to the performance cores
- Relax constraints #143: relax implementation constraints (including LUT minimum layer/tree bounds)
- Layer 3 optimisation #144: layer 3 optimisation
Metadata
Metadata
Assignees
Labels
No labels
Activity
xrvdg commentedon Sep 11, 2026
#55
zkfriendly commentedon Nov 24, 2026
Updated tracker against
main(34addac): moved merged #137 and #146 to Done, added open PR #152 (resolving #58) under In progress, updated partial-progress notes for #107/#108/#116, and linked #143 and #144.