perf(sumcheck): replace par_bridge with par_chunks/par_iter (-7.1% big)#2729
Open
tamirhemo wants to merge 2 commits into
Open
perf(sumcheck): replace par_bridge with par_chunks/par_iter (-7.1% big)#2729tamirhemo wants to merge 2 commits into
tamirhemo wants to merge 2 commits into
Conversation
469b262 to
6cd6235
Compare
5c7edc7 to
86c3f39
Compare
par_bridge uses a mutex internally to pull items from a sequential iterator, causing lock contention under high parallelism. Replace with par_chunks_mut (for indexed array access) and into_par_iter (for range iteration), which use rayon's native work-stealing without a mutex. Changed files: - slop/crates/multilinear/src/restrict.rs — mle_fix_last_variable - slop/crates/jagged/src/poly.rs — eval and partial_jagged_polynomial - crates/hypercube/src/prover/zerocheck/sum_as_poly.rs — zerocheck sum Benchmark results (on top of E1 physical-cores + E2 mimalloc): fib: 26,504ms → 24,694ms (-6.8%) keccak: 34,845ms → 32,207ms (-7.6%) big: 37,899ms → 35,215ms (-7.1%) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6cd6235 to
6942ec5
Compare
86c3f39 to
07c5d15
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.
Summary
par_bridge()withpar_chunks_mut()/into_par_iter()in three hot-path filespar_bridgeuses a mutex internally to pull from sequential iterators, causing lock contentionChanged files
slop/crates/multilinear/src/restrict.rs—mle_fix_last_variableslop/crates/jagged/src/poly.rs—evalandpartial_jagged_little_polynomial_evaluationcrates/hypercube/src/prover/zerocheck/sum_as_poly.rs— zerocheck sum accumulationBenchmark results (on top of E1 + E2)
Cumulative improvement (E1+E2+E8 vs original baseline)
Stack
available_parallelism#2727 — E1: physical cores (-19.8%)Test plan
cargo test --release -p slop-multilinear— 0 tests (no test coverage for restrict.rs)cargo test --release -p slop-jagged— 13 passedcargo test --release -p sp1-hypercube— 14 passedcargo test --release -p sp1-prover test_e2e_node— full e2e (long)🤖 Generated with Claude Code