Repository navigation
ML-DSA on AArch64: check norms in vector registers - #7084
Merged
Merged
Conversation
vg_mldsa_norm_lt compared one coefficient at a time, in general-purpose registers. A coefficient a < q is out of bounds exactly when (a - bound) mod 2^32 <= q - 2 bound, so it now takes the minimum of (a - bound) mod 2^32 over the polynomial, 16 coefficients at a time, and compares it once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHJ19UwwasyKpuVuqb
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.
ML-DSA verification gets 1.7–2.5% faster on AArch64, by checking with vector instructions that the coefficients of the signature's
zare small enough.Speed
Benchmarks run on Neoverse N2:
mldsa44_verifymldsa65_verifymldsa87_verifyCode size
AArch64, in bytes: +92 (
vg_mldsa_norm_lt, 64 → 156).Implementation
A coefficient
a < qis out of bounds ifbound ≤ a ≤ q − bound, which is the same as(a − bound) mod 2³² ≤ q − 2·bound. The old code tested each coefficient by itself. The new code takes the minimum of(a − bound) mod 2³²over the polynomial, 16 coefficients per iteration, and compares it once.The loop that the old code used (
mapLoop) had no other user, so it and its proof are gone.There are no changes to
TCB/orSpec/.Generated by Claude Code