Skip to content

Optimize dense q1 row dot products - #208

Draft
1sgtpepper wants to merge 1 commit into
NethermindEth:mainfrom
1sgtpepper:feature/dense-q1-row-dot-products
Draft

Optimize dense q1 row dot products#208
1sgtpepper wants to merge 1 commit into
NethermindEth:mainfrom
1sgtpepper:feature/dense-q1-row-dot-products

Conversation

@1sgtpepper

@1sgtpepper 1sgtpepper commented Jun 6, 2026

Copy link
Copy Markdown

What changed

Part of #134.

The normal ZipPlus::prove_f path now prepares dense q_1 once for repeated row dot products. Fixed-width runtime Montgomery fields shift each q_1 element once and multiply it by the canonical signed coefficient residue, avoiding a Montgomery projection for every coefficient while preserving the existing field result and transcript layout. Fixed and boxed field configurations keep the prior projection semantics.

The production Zinc+ prover reaches this path through its existing PCS openings. The Zip+ prover benchmarks now use non-Boolean evaluation points so their q_1 tensors are dense.

Validation

  • Linter check on 7e4f71c: nightly formatting, Clippy across all targets and features, and typo checks
  • Coverage (Push) on 7e4f71c: cargo llvm-cov --workspace --lcov --output-path lcov.info --ignore-filename-regex '^examples/'

@1sgtpepper 1sgtpepper mentioned this pull request Jun 6, 2026
4 tasks
@1sgtpepper
1sgtpepper marked this pull request as ready for review June 9, 2026 04:00
@1sgtpepper
1sgtpepper marked this pull request as draft July 1, 2026 07:54
1sgtpepper added a commit to 1sgtpepper/zinc-plus that referenced this pull request Jul 8, 2026
… error types, add b-equivalence tests

Public API:
- Restore FromWithConfig<&Zt::CombR> bound on prove/prove_f/prove_single,
  protocol prover macros, and bench functions. MontgomeryIntegerInnerProduct
  is now additive rather than a replacement.

Error types:
- Revert InnerProductError to exhaustive two-variant enum (remove
  #[non_exhaustive] and FieldConfigMismatch).
- Add MontgomeryError (pub, in montgomery_inner_product) with
  LengthMismatch and FieldConfigMismatch variants.
- Add From<MontgomeryError> for ZipError converting at the phase_prove
  boundary.

Prover:
- Replace batch_size==1 special case with unified b-accumulation loop.
- Use MontgomeryError→ZipError conversion via ? operator.

Tests:
- Add montgomery_b_matches_field_lift_for_single_poly — direct old-vs-new
  b equivalence with wide signed CombR.
- Add montgomery_b_matches_field_lift_for_multi_poly_batch — same for
  batch_size=3 with pre-sampled alphas.
1sgtpepper added a commit to 1sgtpepper/zinc-plus that referenced this pull request Jul 8, 2026
… error types, add b-equivalence tests

Public API:
- Restore FromWithConfig<&Zt::CombR> bound on prove/prove_f/prove_single,
  protocol prover macros, and bench functions. MontgomeryIntegerInnerProduct
  is now additive rather than a replacement.

Error types:
- Revert InnerProductError to exhaustive two-variant enum (remove
  #[non_exhaustive] and FieldConfigMismatch).
- Add MontgomeryError (pub, in montgomery_inner_product) with
  LengthMismatch and FieldConfigMismatch variants.
- Add From<MontgomeryError> for ZipError converting at the phase_prove
  boundary.

Prover:
- Replace batch_size==1 special case with unified b-accumulation loop.
- Use MontgomeryError→ZipError conversion via ? operator.

Tests:
- Add montgomery_b_matches_field_lift_for_single_poly — direct old-vs-new
  b equivalence with wide signed CombR.
- Add montgomery_b_matches_field_lift_for_multi_poly_batch — same for
  batch_size=3 with pre-sampled alphas.
1sgtpepper added a commit to 1sgtpepper/zinc-plus that referenced this pull request Jul 8, 2026
… error types, add b-equivalence tests

Public API:
- Restore FromWithConfig<&Zt::CombR> bound on prove/prove_f/prove_single,
  protocol prover macros, and bench functions. MontgomeryIntegerInnerProduct
  is now additive rather than a replacement.

Error types:
- Revert InnerProductError to exhaustive two-variant enum (remove
  #[non_exhaustive] and FieldConfigMismatch).
- Add MontgomeryError (pub, in montgomery_inner_product) with
  LengthMismatch and FieldConfigMismatch variants.
- Add From<MontgomeryError> for ZipError converting at the phase_prove
  boundary.

Prover:
- Replace batch_size==1 special case with unified b-accumulation loop.
- Use MontgomeryError→ZipError conversion via ? operator.

Tests:
- Add montgomery_b_matches_field_lift_for_single_poly — direct old-vs-new
  b equivalence with wide signed CombR.
- Add montgomery_b_matches_field_lift_for_multi_poly_batch — same for
  batch_size=3 with pre-sampled alphas.
@1sgtpepper
1sgtpepper force-pushed the feature/dense-q1-row-dot-products branch from ac7d221 to 6ec2cef Compare July 11, 2026 05:11
@1sgtpepper
1sgtpepper force-pushed the feature/dense-q1-row-dot-products branch 3 times, most recently from 02a4ca5 to 212861a Compare August 10, 2026 16:21
@1sgtpepper
1sgtpepper force-pushed the feature/dense-q1-row-dot-products branch from 212861a to 7e4f71c Compare August 10, 2026 16: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