Skip to content

perf(banderwagon): vector MSM for large proof checks - #163

Open
flyq wants to merge 3 commits into
liquan/perf/batch-witness-decodefrom
liquan/perf/vector-msm
Open

flyq wants to merge 3 commits into
liquan/perf/batch-witness-decodefrom
liquan/perf/vector-msm

Conversation

@flyq

@flyq flyq commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports PR #3 of suryuhh/salt-optimizations (commit 35436e1): the variable-base MSM of proof verification, eight-wide on AVX-512 IFMA.

multi_scalar_mul runs a Pippenger whose bucket accumulation and reduction use vector lanes when the host has AVX-512 IFMA and the MSM has at least 8,192 points. Smaller MSMs and other hosts keep the scalar path, so only large witnesses change.

Stacked on the batch-decode PR (liquan/perf/batch-witness-decode). Nothing under salt/src changes.

Changes on top of the external commit

  • One cutoff for every thread count. The external dispatch used 8,192 points in a multi-thread rayon pool and 128 in a one-thread pool, which also sent the IPA's fixed 274-point MSM to the vector path. It is 8,192 everywhere now, so the path depends on input size and CPU alone. The single-thread cutoff has not been measured here and can be revisited with numbers.
  • The bucket reduction starts at the highest non-empty bucket. It walked all 2^c - 1 buckets per group of windows with two full additions each. A signed digit's magnitude is at most 2^(c-1), so the upper half is never written and the walk added the identity to the identity there. Not measured.

Testing

Passing on this head, on an Apple Silicon machine:

  • cargo fmt --all -- --check; cargo clippy --all-targets -- -D warnings, native and --target x86_64-unknown-linux-gnu
  • cargo test; with test-bucket-resize (CI's settings); the random stress test; --no-default-features with and without test-bucket-resize
  • cargo check -p salt --target riscv64imac-unknown-none-elf --no-default-features
  • cargo check --all-targets --target i686-unknown-linux-gnu
  • Suppression hygiene. The mutation gates have nothing to do: no salt/src change.

Not run:

  • Any AVX-512 path, including the reduction change above. No such CPU or emulator on the machine used; the module was only compiled and linted for x86_64. lane_msm_matches_ark_msm checks the result against arkworks for every window size and runs in the Test Suite (AVX-512 IFMA) job.
  • Benchmarks. bench_lane_msm (ignored test) gives ns per point on a host with IFMA.

Merging

Please keep this trailer in the squash message:

Co-authored-by: suryuhh <suryuhh@users.noreply.github.com>

🤖 Generated with Claude Code

suryuhh and others added 3 commits November 14, 2026 00:39
(cherry picked from commit 35436e1a689010bc9cc8ac566648916c0ef5b7ca)
The dispatch sent an MSM to the vector path from 8,192 points in a
multi-thread rayon pool and from 128 in a one-thread pool. It now uses
8,192 everywhere, so which path runs depends on the input size and the
CPU alone. On a host with AVX-512 IFMA, a one-thread pool therefore takes
the scalar Pippenger for 128 to 8,191 points; the single-thread cutoff has
not been measured here yet and can be revisited with numbers.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…st non-empty bucket

The reduction walked every bucket of the store, 2^c - 1 per group of
windows, with two full additions each. A signed digit's magnitude is at
most 2^(c-1), so the upper half of the buckets is never written and the
walk added the identity to the identity there. Track the highest
non-empty bucket per group while the runs are scheduled and start the
walk at it.

Not measured: it needs a host with AVX-512 IFMA (bench_lane_msm).
lane_msm_matches_ark_msm covers the result on such a host.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Mutation testing - PASS

Nothing to test: no viable mutants were generated.

@github-actions

Copy link
Copy Markdown

Mutation testing - PASS

Nothing to test: no viable mutants were generated.

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 5.33141% with 657 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
banderwagon/src/ifma_msm.rs 0.49% 599 Missing and 1 partial ⚠️
banderwagon/src/ifma.rs 0.00% 47 Missing ⚠️
banderwagon/src/element.rs 77.27% 9 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
banderwagon/src/lib.rs 70.00% <ø> (ø)
banderwagon/src/element.rs 79.72% <77.27%> (-12.28%) ⬇️
banderwagon/src/ifma.rs 1.54% <0.00%> (-89.59%) ⬇️
banderwagon/src/ifma_msm.rs 0.49% <0.49%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Performance Benchmark Comparison

Compared 5 benchmark(s) against the latest main baseline.

Detailed Comparison
Benchmark Baseline Throughput (Kelem/s) New Throughput (Kelem/s) Change
update 10000 KVs/1 threads 83.52 81.66 -2.23%
update 10000 KVs/2 threads 160.32 158.24 -1.30%
update 10000 KVs/4 threads 299.94 294.70 -1.75%
update 10000 KVs/8 threads 490.69 477.45 -2.70%
update 10000 KVs/16 threads 617.42 596.16 -3.44%

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants