perf(shader): bound relative VGPR addressing before SSA expansion #646
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!646
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-646"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tommiehansen on GitHub · 2026-12-05 22:52 UTC · original
tommiehansen:perf/bounded-relative-vgpr-20261205→main· +638 −2 · 6 files · 8 commits · openWhy
M0-relative VGPR accesses can cause the shader translator to represent many possible registers even when the index is statically bounded. This inflates SSA construction and the work required to prepare shaders before pipeline creation. Reducing that work can help shader preparation during loading or streaming; it does not necessarily change the final GPU program.
What changes
Narrow literal M0 operands before SSA construction. For unresolved sites, reuse conservative SSA range proofs and keep the original lowering whenever the proof fails. The optimization is opt-in (
VICTORY_BOUNDED_RELATIVE_VGPRS=1) with a separate v2 cache identity. An earlier double-SSA implementation increased IR build time by 63–138%; moving literal narrowing before SSA corrected that regression.Benchmark results — Windows x64, shader preparation
CI 47585753406, head
60c334c. Eight paired blocks per shape, 128 exact arms. Times are medians of block medians; percentages are median within-block changes.Total includes lowering, DXIL validation and WARP PSO creation (30/32 winning blocks); PSO cache reuse may affect timings. Phi DXIL shrinks from 6888 to 4692 bytes; literal DXIL remains 4620 bytes. Earlier offline ACO audit reports identical final ISA, allocation and occupancy on the matched fixture, including a derived GFX1200 compiler profile. No physical AMD execution or gameplay FPS result.
Why this should be merged
The measured benefit is CPU-side shader preparation across both guest wave widths. The conservative proof and original fallback limit the scope. It is suitable for opt-in testing without promising GPU acceleration.
Validation and compatibility
280 original exact WARP cases, 128 additional exact preparation arms, Linux shader suite and Windows GPU compilation passed. The unrelated descriptor PSO failure was reproduced on unchanged upstream (control); the scoped gate is not a full Windows-suite pass.
Reproduce on Windows:
cargo test --locked --release -p victory-shader --lib bounded_relative_full_translation_cost -- --ignored --nocapture --test-threads=1. Please compare real title shader preparation/cache misses and physical RDNA compiler timings with the option off/on before considering default activation.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.