AMD: fewer registers in translated loops (LARP_LOOP_EXIT, LARP_JOIN_EDGES) #247
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/gamingwithhomie--larp!247
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-247"
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?
@ambrosia-works on GitHub · 2026-12-05 22:08 UTC · original
ambrosia-works:perf/amd-loop-exit-join-edges→amd-test· +316 −21 · 7 files · 1 commits · merged 2026-12-05 23:28 UTCSummary
Two shader-translator changes that cut register pressure in AMD's shader compiler. Both are ported from the cool_fox fork (
6becc5fc2,1e316adbe), where they were measured on an RX 7900 XT under Windows. They target this branch because the gain is AMD-specific.Both are on by default on Windows and off under Wine/Proton, where they were never tested against vkd3d-proton.
LARP_LOOP_EXIT=0|1andLARP_JOIN_EDGES=0|1override the default. Both names are inlarp_shader::SWITCHES, and their effective values are hashed into the shader cache's build key, so the translation cache rebuilds once.LARP_LOOP_EXITA counted loop that reached its iteration limit used to return from the program inside the loop. Because of that return, AMD's compiler kept the whole program's values live through the loop.
CS_Gather_Classified_19went from 256 VGPRs plus spills to 144 (the console's count).continueof an outer loop keeps its own count).live_edgesno longer takes the folded branch's condition as known on its edges, so values joined at the exit are not zeroed as dead.LARP_JOIN_EDGESModule::skip_empty_edgesremoves empty edge blocks (no phi, no instruction, only a branch) beforesingle_latches. A loop whose exits all lead to one join then has one exit block, as DXC writes it.8cb27ccfwent from 144 to 72 VGPRs and from 5 to 10 waves;57724872went from 96 to 45 VGPRs.Verification
cargo test --release --locked -p larp-shader: 2 passed, including the newempty_edge_blocks_are_left_out.cargo check --release --locked -p larp: no new warnings.larp translate <shaders.rpf> --validatewithLARP_SHADER_REPLACE=0and the Windows SDK validator, under three settings: both switches=0, defaults, and both=1.@gamingwithhomie on GitHub · 2026-12-05 23:08 UTC · original
Queued for AMD review round: 1,037 lines of translated-loop register work (LARP_LOOP_EXIT/LARP_JOIN_EDGES) needs an RDNA test report (which card, before/after registers + fps) before we can merge it into the AMD track. The idea targets exactly the RDNA device-hang family, so its worth doing carefully.