Repository navigation
perf: parallelize trace compaction and bytecode cycle tables - #54
Open
sumchecker wants to merge 4 commits into
Open
sumchecker wants to merge 4 commits into
sumchecker wants to merge 4 commits into
Conversation
TraceBackend::try_new converted every raw trace row on one thread. At 2^30 cycles that took about a minute on a 192-vCPU host, a fifth of the whole proof, with the rest of the machine idle. Convert the rows with rayon under the `parallel` feature, then drop the trailing padding rows. The compact trace is unchanged: rows before the last real cycle are kept even when they compact to the default row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Stage 6b bytecode read-RAF cycle phase built one full 2^log_T eq table per stage cycle point and added each into its combined table: eight dense tables and a read-modify-write pass apiece. At 2^30 cycles that was 16 GiB per table, and the prepare step took over 20 s without speeding up as vCPUs were added. Accumulate every weighted term into the combined table in one parallel pass from each point's ~sqrt(T) TensorEqTable factors. The tables hold the same field values. At 2^28 on 32 threads, prepare drops from 7.6 s to 1.9 s. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
📏 PR diffNote Actual code changed: 170 lines🟢 +90 added 🔴 −80 removed Tests, docs, fixtures, and helper scripts excluded.
Every changed line is classified once. |
Rayon's `Result` collect loses indexedness, so it stages every thread's segment and concatenates them on one thread. For full-trace tables that is a serial copy of the whole table: 64 GiB of compact trace rows and 16 GiB of instruction operands at 2^30 cycles. Use `jolt_utils::par_collect_windows`, which writes each index in place and keeps the lowest-index error, for the compact trace rows, the instruction claim-reduction operand table and the register increment bind. At 2^28 on 32 threads the claim-reduction prepare drops from 1.27 s to 0.51 s. Collects over per-chunk folds keep the rayon collect: they have too few items for the fixed collect chunk to spread across threads. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The bytecode reference-parity tests cover weighted_eq_sum through the production kernel, so the test that re-added the deleted per-stage loop as its oracle goes. The interior-padding test now builds each cycle row, since TraceRow is not Copy under field-inline. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
sumchecker
marked this pull request as ready for review
October 6, 2026 16:08
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.
Motivation
Two prover phases leave most cores idle on large CPU machines. At 2^30 cycles on a 192-vCPU C4D runner, trace compaction ran on one thread for about a minute (a fifth of the proof). The Stage 6b bytecode cycle prepare took 23 s and was slower than on 96 vCPUs. Several full-trace tables were collected through rayon's
Resultcollect, which concatenates the per-thread segments on one thread.Key Changes
jolt-witness:TraceBackend::try_newcompacts rows with rayon underparallel, then truncates the trailing padding rows. Rows before the last real cycle are kept, as before.jolt-kernels: newsupport::weighted_eq_sumcomputesΣ_k w_k·eq(p_k, ·)in one parallel pass from each point'sTensorEqTablefactors. The bytecode read-RAF cycle phase uses it for its combined and fused tables instead of materializing and adding one full eq table per stage. The tables hold the same field values.jolt-witnessandjolt-kernels: the compact trace rows, the instruction claim-reduction operand table and the register increment bind collect throughjolt_utils::par_collect_windows. It writes in place and keeps the lowest-index error. Collects over per-chunk folds are unchanged.Based on #53. Neither commit touches a file changed by #51–#53.
Breaking Changes
None.
Testing
jolt-witnesstests under no features,parallel,field-inlineandparallel,field-inline, including a new test for padding before the last cycle;jolt-kernelstests, including the bytecode reference-parity tests, underparallel,parallel,akitaandparallel,akita,field-inline; clippy-D warningsfor those feature sets;cargo fmt --check.End-to-end proofs on GCP C4D (AMD EPYC 9B45) machines, one per size, before → after this PR: sha2-chain proving time in seconds, every proof verified, peak RSS unchanged:
🤖 Generated with Claude Code