Repository navigation
Tune the existing r51 backend for Zen 5 cold verification - #2
Merged
Merged
Conversation
7layermagik
marked this pull request as ready for review
July 30, 2026 05:11
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.
Summary
This PR improves cold-signature performance in Narya's existing forced
r51backend, focusing on the native x8 path and the packed n=1/n=2 tails on Zen 5. The changes reduce field-arithmetic call overhead and memory traffic, specialize recoding and scalar reduction, improve partial-batch scheduling, and add measured CPU-specific dispatch choices. The public API and acceptance predicate are unchanged; automatic selection remainsgeneric, andr51remains opt-in and unaudited.The published
mainrelease numbers for 1,232-byte cold verification on the same Ryzen 7 9700X were:At the final live-path implementation commit (
bbc6c2194438090b0c48ac9bd95eab6b92602d6f), the same public cold benchmark measured:The cumulative table compares two documented public release snapshots; use it for the overall before/after, not causal attribution. The exact-parent and same-binary timeline below supplies the per-change evidence. All reported Narya rows were allocation-free and recorded zero internal-fault fallbacks. Exact commands, environment details, raw output, and checksums are committed under
docs/results/.Review tracks
The implementation and its exact-parent measurements were developed as one
interleaved, tested history. To preserve that history without rebasing,
squashing, or duplicating commits, review is split into three passes rather
than three independently mergeable branches:
r51 changes through
bbc6c21: x8 arithmetic, recoding and reduction,packed n=1/n=2 tails, CPU policy, and exported-backend routing. This pass
answers whether the optimized implementation preserves the field, point,
lane-ownership, predicate, and fallback contracts.
.github/workflows/ci.yml,the new and changed
*_test.gofiles, assembly declaration/layoutcontracts, and the follow-up hardening commits
3321a9cand59cf0c3.This pass answers whether every native path is exercised under SDE or real
hardware and whether unsafe workspace/ABI assumptions are compiler-checked
or stated explicitly.
docs/**,tools/formal/**, the non-dispatched whole-window boundary,checksums, negative results, and proof-scope statements. This pass validates
provenance and claimed measurements; it does not expand the supported
runtime contract.
The passes are dependency-ordered: review the executable formulas and routing
first, use the validation track to challenge them second, and then audit
whether the evidence accurately supports the surviving claims. All three
passes resolve against the same final SHA.
Changes introduced by this PR
Existing x8 cold route
Existing x4/packed tail routes
VPMULLQfold for packed-x4 products.Dispatch and evidence
Measured optimization timeline
These rows are chronological, exact-parent or same-binary A/Bs for changes retained by this PR. They are not additive: each row measures its change at its own checkpoint, and host drift, link layout, and earlier changes alter later baselines. Unless noted, values are complete cold-verifier changes for 1,232-byte messages.
e6370a57b22c5ba23884713a61795c773f322d3a68c995f4eb1c1cccf0a1bbb45da72190384db9f9df33daaa776e1c253ad11db24f1de35e55f4362db0a23954d6430985a3b8bbc6c21The fixed-base affine Stage-2 continuation at
b2f40c8is retained because its same-binary comb component improved 4.33%, but it is omitted from the table above because no trustworthy isolated complete-verifier percentage was established. Neutral and rejected candidates are documented but are not counted as speedups.Which PR changes transfer beyond Go?
This section describes only changes introduced by this branch, not the inherited Narya architecture.
Broadly reusable algorithm or representation changes
These can transfer to C, C++, Rust, or another implementation, subject to re-proving the representation/range contracts and remeasuring the complete verifier.
Language-neutral but AVX-512/CPU-specific changes
VPMULLQfold selection.The mechanisms transfer, but the winning schedule is microarchitecture-dependent.
Go-specific or Go-amplified changes
VZEROUPPERboundaries. Another language may have a much smaller call-boundary cost.The no-cgo API, original Plan 9 assembly wrappers, pooled workspaces, and broader zero-allocation architecture predate this PR and are not claimed here.
Predicate and failure behavior
The acceptance contract is inherited and unchanged:
DalekStrictstill rejects non-canonical S, small-order A, small-order R, and non-canonical R while accepting the target predicate's non-canonical A encodings;genericand incrementInternalFaultFallbacks;generic.New tests specifically pin packed-pair lane ownership, result indexing, invalid-equation isolation, scalar/recode equivalence, and the new CPU-policy decisions.
Tests and evidence
Current HEAD:
59cf0c3cc7b139e05caa3f389ee87dfbbbac19beChecks rerun locally at HEAD:
go test -count=1 ./...go test -tags purego -count=1 ./...go test -race ./ed25519 ./sha512mbgo vet ./...GOOS=linux GOARCH=amd64 go vet ./...git diff --checkPinned native Zen 5 evidence additionally covers:
Raw benchmark/profiler artifacts are preserved with checksums. Their fixed-width tool output contains alignment whitespace, so the authored source/document diff check excludes
docs/results/**rather than rewriting the evidence bytes.Supported versus experimental
The supported change ends at
bbc6c21. The following additions remain explicitly non-dispatched research evidence:Experimental*symbols and negative/neutral A/B results.The whole-window search, certificates, source archive, implementation mapping, and remaining source-to-machine refinement gap are indexed under
docs/formal/.Review focus
Remaining gates
This remains a draft and
r51remains forced-only pending:See
docs/SAFETY_FREEZE_2026-07-29.mdanddocs/results/zen5-packed-pair-whole-window-2026-07-29/.