keccakf_amd64: 1.1x faster BMI2 permutation #38
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.44) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 246 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.330
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #38"
general
weight: 0.35
chfast
Improve Keccak performance on x86 with BMI2 further, on top of the 2-round loop from #36, by following the implementation shape of evmone's Keccak and the assembly clang produces for it.
These steps make the generator more complex, because these optimizations are not uniform (e.g. theta has 5 D words, but only 3 fit into the available registers, and lane 24 is a special case). The generator grows from 134 to 156 lines of code (including a simplification pass), the generated asm from 464 to 483 lines. I have doubts the generator makes sense at this point. It may be easier to work on the Go asm directly (we point AI at the generator or the asm anyway).
| | permutation | Sum256 32 B | Sum256 1 KiB |
|---|---|---|---|
| master, cycles | 1024 | 1097 | 8417 |
| this PR, cycles | 925 | 996 | 7640 |
| speedup | 1.11× | 1.10× | 1.10× |
| master, retired ops | 4554 | 4747 | 37005 |
| this PR, retired ops | 4460 | 4655 | 36264 |
Per step, cycles per permutation: 1024 → 947 → 931 → 925, retired ops: 4554 → 4506 → 4507 → 4460. For reference: evmone's kernel built with clang 23 is 938 (918 with ipsilon/evmone#1839, which applies the chi order there), clang's code translated to Go asm is 928.
Measured with perf on a Ryzen 9 5950X (Zen 3).