dxil: opt-in loop-invariant code motion (VICTORY_SHADER_OPT=256, default off) #163
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/ReTerryDavis--ReVIctory!163
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-162"
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?
@SovietBearz0r on GitHub · 2026-12-05 19:31 UTC · original
SovietBearz0r:shader-opt-licm→main· +497 −8 · 5 files · 1 commits · draftLICM split out of #126, per the review there ("once individual passes are soaked in-game with real A/B results (ideally split cleanly)"). Default off; existing output unchanged.
What
opt::LICM = 256inVICTORY_SHADER_OPT(e.g.=319= defaults 63 + LICM): natural-loop detection, dominance/preheader placement and conditional-entry splitting; never moves loads (no volatile/in-bounds proof), effect instructions break the chain. Sub-switchVICTORY_LICM_CBUF(1 = constant-buffer rows at constant indices only — the default; 2 also descriptor handles; 0 neither).DEFAULTstays 63; the opt-in mask is already in the shader-cache key, so no version bump for default users;VICTORY_LICM_CBUF≠1 is appended to the key.Tree.idom) change is LICM-only and kept out of the barrier branch. The sharedMODULE/ALL/DEFAULTbookkeeping block is pass-specific here (mask union is 1023 when LICM+BARRIERS are merged).Verification
cargo test -p victory-dxil22 passed (base 21 + hoist/keep test);cargo test -p victory-shader --lib323 passed / 2 ignored, and 323 passed withVICTORY_SHADER_OPT=319;cargo check -p victory; policy 442 files; clippy-D warningsclean.=319vs default 63, report avg FPS, 1% low, p50/p95/p99 frame time, GPU busy, and visual equality; alsoVICTORY_LICM_CBUF=0/1/2to justify the conditional-row policy. Include one RDNA3/4 and one NVIDIA card, cold+warm shader cache.Source: MiniVI/sixmoon via longroad lineage (source claim RTX 2080 Ti 23.4→25 fps needs independent replication).
@SovietBearz0r on GitHub · 2026-12-05 20:20 UTC · original
First in-game data point — and it is a negative one on AMD, so please don't merge this as-is; reporting it rather than dropping it.
Machine: RX 9070 XT 16 GB (RDNA4, driver 32.0.32029.2010), Ryzen 9 9900X, Windows, diag build,
bench.ps1builtin:cruise,-Gpu 0. Same binary for both sides; baseline = the play profile (VICTORY_SHADER_OPT=255via-GpuOpt), on-side=511(255 + LICM). 2 runs per side, medians; 0 shaders were translated during the measured spots on both sides (the lap's cache lines show 45-49 translations only during loading, before the first spot; the spot windows are clean).That is not noise (both on-runs were consistently slow; the parity runs before/after are back at ~32 fps), and it is the opposite sign of the source's NVIDIA measurement. Two plausible explanations: (a) the port has an interaction bug on RDNA4 — e.g. the pass hoisting loads the driver then spills/serialises heavily; (b) the source numbers don't carry over to this card/title build. The sibling splits are neutral-to-positive on the same rig: barrier dedup #164 is within noise, InstCombine #122 is +0.5..+3.7%.
I don't have NVIDIA hardware to reproduce the intended setup; if you have seen the pass on AMD or have a hint (e.g. interaction with WIDE/DOM_LOADS, which the play profile enables), I'll dig further. Until then this one should stay draft / not be recommended.
@Saksukella on GitHub · 2026-12-05 21:55 UTC · original
Tested combined with PR #163 (LICM) + VICTORY_BATCH_PFP=1 on AMD Radeon RX 9070 XT (RDNA 4, 16 GB) / Ryzen 9 7900X / Windows 11, production --release build on
8bff52b+ PR #81 (DXR 1.1 HWRT) + PR #87, fixed deterministic route (motel_strip, 10s idle + 15s 67 mph cruise, locked noon clear weather, FSR 4.1.2 Balanced 4K, FG off, VICTORY_WIDE_THREADS=8, fully warmed pipe=0 via play.ps1 -Warm):8bff52b+ #81 + #87, --release, opt=255)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.