[pr-performance][shaders][AMD] shader: add DARNER_LOOP_EXIT and DARNER_JOIN_EDGES to reduce loop VGPR pressure #713
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!713
Loading…
Reference in a new issue
No description provided.
Delete branch "ggwp/Darner:perf/amd-loop-regs"
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?
Contributor role (optional)
What it changes
Port of
gamingwithhomie/larpPR #247 (12eddd4d, originally byambrosia-works/cool_fox, adapted to Darnerpost-merge):The problem on
post-merge: Two patterns in translated DXIL cause AMD's shader compiler (amdxc64) to keep excessive live values across loops and emit high VGPR counts / register spills:retinside the loop when hitting the iteration cap, forcingamdxc64to keep values live through the loop (CS_Gather_Classified_19: 256 VGPRs + spills -> 144 VGPRs in upstream measurement).CS 8cb27ccf: 144 -> 72 VGPRs,57724872: 96 -> 45 VGPRs in upstream measurement).Fix:
DARNER_LOOP_EXIT(default on on Windows, off under Wine;0/1overrides): folds the iteration limit into the branch leading into a dedicated latch so lanes leave through the loop's own exit instead of an abort return.DARNER_JOIN_EDGES(default on on Windows, off under Wine;0/1overrides):Module::skip_empty_edgesremoves empty phi-less pass-through edge blocks beforesingle_latches(exact IR transform, pinned by unit testempty_edge_blocks_are_left_out).darner_shader::SWITCHESand their effective values are hashed intoshader_cache.rs.How it was tested
b948640(based onpost-merge28a9b42; also run in-game in a combined AMD build with #676 and #684)cargo test --offline -p darner-shader --lib— 1 passed (emit::bitcode::tests::empty_edge_blocks_are_left_out), 0 failedcargo clippy --offline -p darner-shader --tests— passedcargo check --offline -p darner-gpu— passedcargo build --offline --release -p darner— succeeded (combined build)DARNER_LOOP_EXIT=0/DARNER_JOIN_EDGES=0).CS_Gather_Classified_19256 + spills -> 144,8cb27ccf144 -> 72,5772487296 -> 45). No standalone isolated A/B FPS table recorded onpost-mergealone.b948640:cargo test,cargo clippy,cargo check(all passed).Checklist
post-merge.Checked for overlap
lower.rsindescriptor_data/handle, different hunks, no conflict).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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.