Skip to content

kimchi: merge witness commitment and interpolation into single pass#3486

Closed
dannywillems wants to merge 1 commit intomasterfrom
dw/prover-avoid-witness-clone
Closed

kimchi: merge witness commitment and interpolation into single pass#3486
dannywillems wants to merge 1 commit intomasterfrom
dw/prover-avoid-witness-clone

Conversation

@dannywillems
Copy link
Member

@dannywillems dannywillems commented Feb 7, 2026

Summary

  • Merge the witness column commitment and polynomial interpolation into a single parallel loop
  • Eliminates the full witness array clone (~30 MB for domain size 2^16)
  • Removes 15 redundant Evaluations constructions and 15 redundant iFFTs

Before

Two separate parallel loops:

  1. witness.clone().into_par_iter() — clones all 15 columns, commits each
  2. (0..COLUMNS).into_par_iter() — clones each column again, interpolates each

Total: 30 column copies, 30 iFFTs (15 for Lagrange-basis commit + 15 for interpolation)

After

One parallel loop using witness.par_iter() (borrows):

  1. Clone column once for from_vec_and_domain
  2. Commit via commit_evaluations_non_hiding (borrows &Evaluations)
  3. Interpolate in-place via interpolate(self) (arkworks ifft_in_place)

Total: 15 column copies, 15 iFFTs

Benchmark results

cargo bench --bench proof_criterion -p kimchi (Apple M-series, sample size 10):

Benchmark master optimized Change
1014 gates (SRS 2^16) 671.10 ms 674.64 ms +0.53% (p=0.50, noise)
32758 gates (SRS 2^16) 1.3233 s 1.2669 s -4.26% (p=0.00)

Improvement scales with circuit size — larger witness columns benefit more from eliminating redundant clones and iFFTs.

Test plan

  • cargo clippy -p kimchi --all-targets --all-features passes clean
  • Benchmark shows statistically significant improvement at scale
  • CI passes

Combine the witness column commitment and polynomial interpolation
into one parallel loop, eliminating:
- The full witness array clone (15 columns * domain_size elements)
- 15 redundant Evaluations constructions
- 15 redundant iFFTs (interpolations)

Before: clone all 15 columns for commitment, then clone each column
again for interpolation, performing 30 total column copies and 15
iFFTs for commitment + 15 for interpolation.

After: clone each column once, commit, then interpolate in-place,
performing 15 total column copies and 15 iFFTs.
@dannywillems
Copy link
Member Author

This was vibe-coded, PR opened by Claude automatically.

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

Comments