dxil: opt-in InstCombine / float web promotion / intra-loop DCE (VICTORY_SHADER_OPT=1024) #122
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!122
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-121"
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 13:18 UTC · original
SovietBearz0r:minivi-shader-opt→main· +2358 −57 · 4 files · 3 commits · draftPort MiniVI's InstCombine / float Select+PHI web promotion / intra-loop DCE into the DXIL optimiser as an off-by-default pass set:
VICTORY_SHADER_OPT=1024(ordefault|1024).What
opt::INST_COMBINE = 1024bit incrates/victory-dxil/src/bitcode/opt.rs, included inMODULE/ALLbut not inDEFAULT(stays 63 — default output is unchanged, proven by a contract test).20be1548(+2062), adapted to this tree's optimiser which has drifted substantially (main has its own folds,pure_reads,simplify_cfg; the source's were merged by hand, not cherry-picked):and/or/cmp/select,dx.op.binary.i32/dx.op.unaryBits.i32folds, min/max/clamp, bool selects,is_complement;Select+PHIweb promotion (i32 bitcast webs → f32) and thebitcast(select(..))peephole;slot_word mark_pureforSLOT_STRIDES/VIEW_SIZESloads via the existingpure_readsmechanism (this one is a deliberate correctness fix, henceTRANSLATOR_VERSION20→21 so caches retranslate).pred::ONE, loop-header FACTS, dx.op folds, shift overflow/BFE/BFI/CBUF known-bits, float-equality/irreducible-loop non-substitution, handle-select invariants) and the random-program differential suite now also runsINST_COMBINEandINST_COMBINE|DEAD.dc55250f, ~2.5k L) — main has its own smallersimplify_cfg; that remains a follow-up slice.Verification
cargo test -p victory-dxil: 34 passed (13 new);cargo test -p victory-shader --lib: 320 passed, 2 ignored (~4 min pipeline included), differential suite green.cargo check -p victory,cargo xtask policy, clippy-p victory-dxil -D warnings: clean.VICTORY_SHADER_OPT=1024vs unset on AMD RX 9070 XT and NVIDIA — watch for visual corruption/hangs (miscompile surface: known-bits, integer dx.op folds, float web promotion) and frame time; the bump forces one retranslation pass.Source: Androtim/MiniVI
20be1548(opt.rs, +2062), adapted to this tree's optimiser; SimplifyCFG/LICM deliberately deferred.@ReTerryDavis on GitHub · 2026-12-05 17:38 UTC · original
Marking this as draft for now. We're keeping
mainclear of large unverified default-off compiler passes (+2,366 lines inopt.rswith zero in-game A/B perf or visual soak data yet, and it also directly conflicts with #126 inopt.rs).Note also that this PR includes a default-ON 3-line change in
lower/memory.rs(pure_reads.insert(id)forSLOT_STRIDES/VIEW_SIZES) that bumpsTRANSLATOR_VERSION(invalidating everyone's shader cache) inside an otherwise opt-in PR — if thatpure_readsfix stands on its own, it's better split into a tiny focused PR whileINST_COMBINEis soaked and benchmarked in-game first.@SovietBearz0r on GitHub · 2026-12-05 19:10 UTC · original
Split done per the review: the default-on
pure_readschange (+ itsTRANSLATOR_VERSION20→21 bump) is now its own tiny PR — #162 — and has been removed from this branch. #122 now contains only the opt-in passes:DEFAULTis still 63,TRANSLATOR_VERSIONstays 20 (the opt-in mask is already part of the shader-cache key), andlower/memory.rs+lib.rsare byte-identical to main. The branch was updated by merging current main (not force-pushed). Still draft for the in-game A/B soak ofVICTORY_SHADER_OPT=1024you asked for; no data can be produced here.@SovietBearz0r on GitHub · 2026-12-05 20:20 UTC · original
First in-game data point on this branch (AMD side). Machine: RX 9070 XT 16 GB (RDNA4, driver 32.0.32029.2010), Ryzen 9 9900X, Windows, diag build,
bench.ps1builtin:cruise route,-Gpu 0. Same binary (the #122 branch build) for both sides; baseline = the play profile (VICTORY_SHADER_OPT=255via-GpuOpt), on-side=1279(255 + INST_COMBINE). 2 runs per side, medians; 0 shaders translated during the measured spots (cache was warmed before measuring).Small positive on average, and the back spot's p99/-lows improved. Same caveats as the PR body: one card, two runs, one route, no visual A/B; the NVIDIA/RDNA3 data and a longer soak are still needed.
pure_readsis split out to #162; this branch now only carries the opt-in pass.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.