Skip to content

Reuse IPA coefficient storage and cache VK expression evaluation - #517

Merged
ValarDragon merged 1 commit into
mainfrom
perf/ipa-vk-plan-20260928
Sep 28, 2026
Merged

ValarDragon merged 1 commit into
mainfrom
perf/ipa-vk-plan-20260928

Conversation

@ValarDragon

Copy link
Copy Markdown
Contributor

Summary

Extracted from #507 into an independently reviewable PR against main.
This contains only the four Halo2 source changes from the validated combined
snapshot c0eddb54; IFMA arithmetic, affine/prefetch, and point decoding are
not included.

  • Transfer owned IPA generator coefficients into the MSM instead of cloning.
    Defer the constant coefficient until Guard consumption, covering every
    consumption and scaling path.
  • Reuse generator scalar storage during prepared MSM evaluation.
  • Cache an exact constraint-expression evaluation plan in the verification key,
    sharing common operations while preserving expression and root order.

Pinned-key and transcript hashes are unchanged. No proof or protocol changes.

Validation

Local ARM, Rust 1.97.1 release, orbits,unstable-verifier-fingerprint:
275 unit tests, 7 integration tests, and 9 doctests passed; 4 existing doctests
ignored. Formatting and git diff --check passed. Independent Guard, CSE,
dependency, and API review found no blocker. The four Rust files byte-match
the previously validated combined snapshot.

No isolated whole-proof speedup is claimed for this split. The former combined
#507 benchmark included additional optimizations and does not measure this PR
alone. A keygen-warm Apple M4 Max diagnostic measured plan construction at
about 0.38 ms, with 65,672 retained bytes per key, 37,024 scratch bytes per
verification, and 6,176 output bytes per circuit, excluding allocator metadata.
Existing prepared SRS table allocation is unchanged.

API surface

One internal helper is added:
pub(super) MSM::add_owned_g_scalars(&mut self, Vec<C::Scalar>).
There are no downstream public, pub(crate), trait, enum, feature, or existing
signature changes. Private Guard/VK state and derived Debug output change;
the evaluation plan is not exposed or included in pinned/transcript hashes.

The corresponding changes are being removed from #507; that PR retains the
IFMA backend and existing decoder.

@v12-auditor

v12-auditor Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Note

Complete: Audit complete. V12 did not find any issues that need review.

Open the full results here.

Analyzed four files, diff c71526e...4a68b68.

@ValarDragon

ValarDragon commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Fable reviewed as well, will merge after rc

@ValarDragon
ValarDragon merged commit f847a47 into main Sep 28, 2026
56 checks passed
@ValarDragon
ValarDragon deleted the perf/ipa-vk-plan-20260928 branch September 28, 2026 08:23
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