Skip to content

bench: microbenches for the hot mixed base x extension field kernels (chunk 1 of #260)#261

Open
koko1123 wants to merge 1 commit into
leanEthereum:mainfrom
koko1123:bench-field-kernels
Open

bench: microbenches for the hot mixed base x extension field kernels (chunk 1 of #260)#261
koko1123 wants to merge 1 commit into
leanEthereum:mainfrom
koko1123:bench-field-kernels

Conversation

@koko1123

Copy link
Copy Markdown

Chunk 1 of the delayed modular reduction plan tracked in #260.

What

Ignored-test microbenches (same pattern as crates/backend/koala-bear/src/benchmark_poseidons.rs) for the four hot mixed base x extension kernels that later chunks will retile:

  • crates/backend/sumcheck/src/benchmark_product_sumcheck.rs -- product-sumcheck quadratic round (compute_product_sumcheck_polynomial over base-packed evals x extension-packed weights, i.e. the sumcheck_quadratic hot loop).
  • crates/whir/src/benchmark_first_round.rs -- WHIR round-0 combine (combine_and_compute_first_round; made pub(crate) so the bench module can reach it, no other production change).
  • crates/backend/poly/src/benchmark_kernels.rs -- eval_base_packed and finger_print_packed (memory-style 2-element and bytecode-style 13-element logup tuples).

Each bench first asserts the kernel output against an independent scalar reference computation (recursive evaluate_sequential for eval_base_packed, materialized eq-tables for the WHIR combine, plain scalar loops for the rest), so the harness doubles as a regression test when the kernels are rewritten in later chunks.

Run with e.g.:

cargo test --release --package poly --lib -- benchmark_kernels --nocapture --ignored
cargo test --release --package sumcheck --lib -- benchmark_product_sumcheck --nocapture --ignored
cargo test --release --package whir --lib -- benchmark_first_round --nocapture --ignored

Baseline numbers (Apple Silicon, NEON, current eager kernels)

product sumcheck quadratic round (20 vars): 0.416 ms/call, 2519 Melems/s
WHIR round-0 combine (20 vars, 4 statements): 3.884 ms/call, 270 Melems/s
eval_base_packed (22 vars): 1.105 ms/call, 3796 Melems/s
finger_print_packed (memory-style, 2 data, 16 alphas): 15.8 ns/call, 253M scalar rows/s
finger_print_packed (bytecode-style, 13 data, 16 alphas): 75.0 ns/call, 53M scalar rows/s

Checks

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -Dwarnings
  • cargo test --release --all

Chunks 2+ (Algebra::mixed_dot_product, delayed packed-quintic Mul, call-site retiling, NEON dot_product_8) will follow as separate PRs, each gated on these benches plus the E2E XMSS baseline, per the plan in #260.

🤖 Generated with Claude Code

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.

1 participant