Repository navigation
zstd: align the sequence decode and execute loops to 64 bytes - #1240
Conversation
Use the same honeycombio/avo pin as huff0/_generate. The fork's arm64 lowering passes PCALIGN through, and it rejects a label placed directly on a PCALIGN, which the amd64 assembler mishandles (golang/go#74648, golang/go#81792). The regenerated assembly is byte-identical. The newer avo requires newer golang.org/x modules, which require go 1.25.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Place PCALIGN $64 before the decode/decodeSync and executeSimple main loops, which also raises each function's alignment to 64. Without it the loop heads land wherever the linker places the function, and the same code measured about ±2% apart between builds that differed only in what came before it. The padding runs once per call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe generator adds optional 64-byte alignment around prefetch and decode-loop boundaries. AMD64 and arm64 assembly routines add alignment directives at decoder and execution loop boundaries. Generator module settings and indirect dependencies also change. ChangesDecoder loop alignment
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to No actionable merge risk is established in the reviewed changes; the alignment is consistent between the generator and checked-in assembly. Proceed with normal project checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Aligns the zstd sequence decode and execute loops to 64 bytes, the same change #1236 made for huff0. This makes their performance independent of where the linker happens to place the functions; it does not claim a speedup.
(1) Move the asm generator to the current avo arm64 fork (fa13b9f)
zstd/_generatenow uses the same honeycombio/avo pin ashuff0/_generate. That fork's arm64 lowering passesPCALIGNthrough, and it fails generation if a label sits directly on aPCALIGN. The regeneratedseqdec_amd64.sandseqdec_arm64.sare byte-identical. The newer avo requires newergolang.org/xmodules, which requirego 1.25.0in_generate/go.mod.(2) Align the sequence decode and execute loops to 64 bytes (2c2acf9)
PCALIGN $64is placed before the main loop of eachsequenceDecs_decode*/decodeSync*function and ofsequenceDecs_executeSimple*: 10 functions on amd64 and 6 on arm64. It also raises each function's alignment to 64.executeSimple, the instruction before the loop head is the skip label of the last prefetch in the priming sequence. ThePCALIGNgoes before that label, not after it: a label on aPCALIGNmakes the amd64 assembler misroute the jump (cmd/asm: amd64 PCALIGN between labels generates wrong jump targets golang/go#74648) or, since Go 1.26, loop forever when it widens a branch (cmd/asm: amd64 assembler loops forever on a forward jump to a labelled PCALIGN when a branch needs widening golang/go#81792).Tests:
go test ./zstdpasses on amd64 (Zen 3); the regenerated assembly matches the generator.🤖 Generated with Claude Code
Summary by CodeRabbit