Skip to content

perf: encode leaves in coefficient form#279

Open
yoaveshel wants to merge 2 commits into
av_gkr_compilerfrom
ye_whir_coef_encoding
Open

perf: encode leaves in coefficient form#279
yoaveshel wants to merge 2 commits into
av_gkr_compilerfrom
ye_whir_coef_encoding

Conversation

@yoaveshel

@yoaveshel yoaveshel commented Apr 28, 2026

Copy link
Copy Markdown

What ❔

Switches WHIR intermediate-oracle leaves from evaluation form to multilinear-coefficient form, eliminating per-query field inversions and the fold_coset butterfly in internal/final rounds.

Circuit Before After Δ %
add_sub_lui_auipc_mop 931,108 889,719 -41,389 -4.45%
bigint_with_extended_control 1,480,246 1,455,231 -25,015 -1.69%
blake2_g_function 920,123 891,249 -28,874 -3.14%
blake2_with_extended_control 2,560,134 2,526,589 -33,545 -1.31%
inits_and_teardowns 791,019 733,470 -57,549 -7.28%
jump_branch_slt 955,521 906,471 -49,050 -5.13%
keccak_special5 1,405,569 1,384,002 -21,567 -1.53%
mem_subword_only 930,286 889,382 -40,904 -4.40%
mem_word_only 915,687 874,635 -41,052 -4.48%
shift_binop 971,378 922,668 -48,710 -5.01%
unsigned_mul_div 939,710 915,055 -24,655 -2.62%
TOTAL 12,800,781 12,388,471 -412,310 -3.22%

Transpiler cycle counts, sec_80, caches variant. Baseline = av_gkr_compiler (eval-form leaves) after rebase; numbers updated from the original measurement as the circuit set changed (FMA opcode, add/sub fix, unsigned_mul_div and blake2_g_function added).

Why ❔

Is this a breaking change?

  • Yes
  • No

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted.

@yoaveshel yoaveshel requested a review from shamatar April 29, 2026 07:19
Comment on lines +1415 to +1416
let extended_generator = domain_generator_for_size::<F>((trace_len * num_cosets) as u64);
let coset_generator = extended_generator.pow(num_cosets as u32);

@mcarilli mcarilli May 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think these two lines can be condensed to

 let coset_generator = domain_generator_for_size::<F>(trace_len as u64);

mcarilli added a commit that referenced this pull request Jun 10, 2026
…ffs (#308)

## What ❔

Adds GPU support for
#279.

Implements "Improving running time via alternate domain evaluation" from
page 15 of https://eprint.iacr.org/2024/1586.pdf.

The new kernel transforms values for each leaf in-place and preserves
natural coset order.
This maximizes uniformity with the non-transformed path and has several
benefits:
- Transformed output can be passed directly to
ab_blake2s_leaves_from_ntt_multi_coset_kernel.
- Transformed leaves can still be gathered by
schedule_query_merkle_paths_into_from_ntt.
- Unblocks in-place L2 chunking from the LDEs all the way to leaf
hashing.

To ease the transition, the current non-transformed path is still
present. Choosing the transformed or non-transformed path is controlled
by a boolean argument to `TraceHolder::commit_all[_into]_from_ntt`.

## Is this a breaking change?
- [ ] Yes
- [x] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted.

---------

Co-authored-by: mcarilli <mcarilli@gmail.com>
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