Repository navigation
Speed up ARM64 P-256 verification with checked register allocation - #1203
Merged
Merged
Conversation
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.
P-256 verification on ARM64 spends substantial time moving intermediate field values through scratch memory. Keep those values in scalar registers across field operations, specialize canonical correction/subtraction to P-256's sparse prime, and allocate the divstep matrix update the same way. Public scalar inversion finishes after nine batches when
g = 0, retaining the tenth-batch fallback.The generated instruction lists are independently checked by Lean certificates. Correctness, public-input timing, and restoration of the additional callee-saved registers are proved against the existing contract and 8 KB scratch buffer. There are no TCB or specification changes. The proof-only curve interface supplies the existing Montgomery inversion arithmetic theorem for the early finish.
Performance against main
5a8a04e8b, including its new 64-byte constant-table alignment (median latency; lower is better):Measurements use two interleaved rounds on M1 Max and four on N2, with 1-second warmups, 3-second measurements, and 100 samples. The final generated verifier is byte-for-byte identical to the measured candidate. N2 benchmark run. Measurement harnesses and results are outside the repository.
Validation: full Lean build (10,765 targets), full emitter audit and generated-source check, 174 unit tests and 236 integration tests (including CAVP/Wycheproof), formatting, Clippy with warnings denied, and repository audits all pass.