chore(pasta): fuse AArch64 repeated squaring - #244
Merged
Conversation
Contributor
Author
|
Follow-up direct sqrt benchmark on Apple M4:
Method: balanced control/candidate/candidate/control brackets, 100 Criterion samples per leg, 10-second warmup, 10-second measurement, Host: So the faster repeated-square loop improves complete Pasta sqrt by about 0.5-0.8%. This is consistent with the B1/B64 verifier remaining unchanged because sqrt is only a small part of those workloads. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standalone main-targeting version of #240. This cherry-picks only the AArch64 repeated-squaring commit and does not include the x86-64 work from stacked PR #239.
Integration
mainalready exposes repeated squaring internally throughSqrtTableHelpers::sqr_nandsqr_n_mul.FpandFqroute these throughsqr_n_runtimeandsqr_n_mul_runtime; the square-root tables andpow_vartimeare production callers. This PR changes only the Apple AArch64sqr_n_runtimebackend for chains longer than one. The existing fused square-and-multiply path remains instruction-for-instruction unchanged.No downstream public API is added. The new Rust entry point is
pub(super)inside the private Apple AArch64 backend, and the assembly symbol isprivate_extern.Apple M4 benchmarks
Single-core, Rust/Cargo 1.88.0,
aarch64-asm, 60 Criterion samples per primitive:mainsqr_n(2)sqr_n(8)sqr_n(32)sqr_n(128)sqr_n_mul(2)sqr_n_mul(8)sqr_n_mul(32)sqr_n_mul(128)The square-and-multiply deltas converge to zero as expected because that assembly path is unchanged.
Orchard-shaped end-to-end checks used
circuit,orbits, one Rayon worker, a balanced control/candidate/candidate/control bracket, and the same 64-proof fixture corpus:mainmeanThe one-Action prover settled at 285.11 ms on the adjacent control leg and 285.14 ms on the candidate leg: no measurable change, as expected.
Validation
cargo +1.88 test --locked -p zakura-pasta-curves --features aarch64-asmcargo +1.88 check --locked -p zakura-pasta-curves --no-default-features --features aarch64-asmcargo +1.88 fmt --all --checkgit diff --check