Skip to content

Use paired field passes in GLV affine reductions - #165

Draft
ValarDragon wants to merge 3 commits into
mainfrom
wip/msm-pr164-affine-reduction-20260823
Draft

Use paired field passes in GLV affine reductions#165
ValarDragon wants to merge 3 commits into
mainfrom
wip/msm-pr164-affine-reduction-20260823

Conversation

@ValarDragon

@ValarDragon ValarDragon commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep batched affine denominators, inverses, slopes, and final chord products
    in contiguous field-element passes;
  • seed the two inversion chains from their first denominators, avoiding two
    multiplications by one per reduction level;
  • use paired Montgomery multiplication and back-substitution kernels on Apple
    AArch64; and
  • preserve the release-mode fallback to the generic MSM if an exceptional
    zero denominator reaches the optimized reducer.

This is a draft follow-on to #161. Its Apple field kernels intentionally
overlap with #164, which currently lives on the separate CurveFFT stack. The
shared kernel code should be deduplicated when those stacks meet.

Performance

All figures are geometric centers of control/candidate/candidate/control
brackets with one Rayon worker. Lower is better.

Host MSM terms Control Candidate Change
Linux x86_64 2,150 13.5420 ms 13.3505 ms -1.41%
Linux x86_64 2,990 17.6400 ms 17.4380 ms -1.15%
Linux x86_64 5,678 30.1320 ms 29.7920 ms -1.13%
macOS arm64 2,150 5.1622 ms 5.0177 ms -2.80%
macOS arm64 2,990 6.7953 ms 6.6232 ms -2.53%
macOS arm64 5,678 11.6179 ms 11.3135 ms -2.62%

End-to-end screens:

Host Workload Control Candidate Change
Linux x86_64 Orchard prover 969.63 ms 963.79 ms -0.60%
Linux x86_64 Orchard verifier B1 15.633 ms 15.429 ms -1.31%
Linux x86_64 Orchard verifier B64 96.733 ms 96.205 ms -0.55%
macOS arm64 Orchard prover 343.83 ms 341.97 ms -0.54%
macOS arm64 Orchard verifier B1 5.312 ms 5.180 ms -2.48%
macOS arm64 Orchard verifier B64 36.270 ms 35.478 ms -2.18%

The macOS prover controls drifted from 340.56 ms to 347.14 ms across the
bracket. Its -0.54% geometric result is therefore screening evidence; the
direct MSM and verifier brackets are the stronger Apple measurements.

The verifier runs reused one authenticated corpus of 64 distinct valid proofs
with SHA-256
3230f733d208a9c905e18db8878234b6a3a4f5b56d1fb92a66a4ad7c2b82adb7.
Every binary validated the complete corpus before timing. Linux end-to-end
figures were pinned to one VM CPU after unpinned B64 samples showed migration
noise; control and candidate used identical affinity.

Validation

  • 139 Pasta unit tests and the doc test pass with the glv feature;
  • the no-default-features glv,deferred check passes;
  • release prover and verifier binaries build and run on Linux x86_64 and
    macOS arm64; and
  • optimized MSM differential and exceptional-denominator tests pass.

API surface

No downstream public API changes. The Apple-only implementation adds
crate-internal paired multiplication and batch-inversion back-substitution
helpers for Fp and Fq, plus field-module wrappers used by the sealed GLV
backend.

@ValarDragon
ValarDragon force-pushed the agent/msm-fuse-inversion-affine-finish branch from d360c8d to d6bb501 Compare August 23, 2026 12:58
@ValarDragon
ValarDragon force-pushed the wip/msm-pr164-affine-reduction-20260823 branch 2 times, most recently from 7aa4369 to 0201342 Compare August 23, 2026 13:26
@ValarDragon
ValarDragon force-pushed the agent/msm-fuse-inversion-affine-finish branch 2 times, most recently from 39102f1 to b7d69ee Compare August 23, 2026 16:05
@ValarDragon
ValarDragon force-pushed the wip/msm-pr164-affine-reduction-20260823 branch from 0201342 to 6904892 Compare August 23, 2026 16:05
@ValarDragon
ValarDragon force-pushed the agent/msm-fuse-inversion-affine-finish branch from b7d69ee to b0cccbe Compare August 23, 2026 17:14
@ValarDragon
ValarDragon force-pushed the wip/msm-pr164-affine-reduction-20260823 branch 2 times, most recently from 08609f1 to be5bd4c Compare August 24, 2026 12:07
@ValarDragon
ValarDragon force-pushed the agent/msm-fuse-inversion-affine-finish branch 2 times, most recently from 6c1ee05 to e29c2ec Compare August 24, 2026 12:17
@ValarDragon
ValarDragon force-pushed the wip/msm-pr164-affine-reduction-20260823 branch from be5bd4c to d5b647b Compare August 24, 2026 12:17
@ValarDragon
ValarDragon force-pushed the agent/msm-fuse-inversion-affine-finish branch from e29c2ec to d2ff3ca Compare August 24, 2026 12:21
@ValarDragon
ValarDragon force-pushed the wip/msm-pr164-affine-reduction-20260823 branch from d5b647b to 1108ada Compare August 24, 2026 12:21
Base automatically changed from agent/msm-fuse-inversion-affine-finish to main August 24, 2026 12:44
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