perf(shader): add DXIL pure LICM, canonical ptr-path LDS forwarding, and barrier dedup #1126
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/fxceless--victory-fork!1126
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1126"
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?
@Vladimir-Human on GitHub · 2026-11-25 20:44 UTC · original
Vladimir-Human:shader/dxil-opt-licm-alloca→main· +4655 −95 · 2 files · 3 commits · openAI-assisted clean-room contribution (
victory-shader, synthetic DXIL bitcode tests + hardware GPU parity only — no title files used).Summary
Adds four sound DXIL bitcode optimization passes inside
crates/victory-shader/src/emit/bitcode/opt.rs(and exposes pass-mask test control incrates/victory-shader/src/emit/mod.rswhile keepingtranslation_fingerprintandtranslate_plainuntouched):FACTS): folds redundant compares/selects along dominating branches without introducing AMDfcmp one.LICM = 64): hoists loop-invariant pure value-only DXIL math calls, loads on non-escaping invariant slots, and bounded GEPs across split loop preheaders (split_preheader, keeping dominators/SSA/outer loops coherent), while strictly gating non-guaranteed blocks and tracking per-instructionWriteKind::All/dx.op.discardcutoffs.LOADS = 16): canonicalizes scalar-leaf GEP paths (trace_ptrwith signed indices, per-level bounds, strict leaf types, unbounded SSA hop depth matchingescaped_globals) and forwards intra-block stores across disjoint pointers.BARRIERS = 128): removes provably redundant consecutive barriers without accumulating hazard state across unrelated regions.crates/victory-shader/src/emit/bitcode/opt.rsandcrates/victory-shader/src/emit/mod.rs(git merge-treeclean againstorigin/main).Verification
cargo test -p victory-shader --all-targets: 226 passed, 0 failed (4 ignored in default run), includingdxil_opt_hw_gpu_bit_exact_parity_and_validationwithVICTORY_REQUIRE_HW_GPU=1on discrete hardware.cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.-13.1%to-32.3%GPU loop shader cost reduction and2.13xfaster translation on the synthetic DXIL benchmark suite (dxil_opt); a fresh uncontested idle-hardware benchmark run will follow in a follow-up comment once queued multi-repo work finishes.c36971b2): keep WIDE=64 and move LICM=128, BARRIERS=256 04e3856634@Vladimir-Human on GitHub · 2026-11-25 21:30 UTC · original
Merged
origin/main(c36971b2) cleanly into this PR to resolve theVICTORY_SHADER_OPTbit-64 conflict with upstreamWIDE:WIDE = 64andDEFAULT = ALL & !WIDEverbatim (so wide console loads stay opt-in by default).LICM = 128andBARRIERS = 256(ALL = 511,DEFAULT = 447).wide_loadslowering andemit::tests::scalar_buffer_loads_read_the_same_dwords_one_call_or_four.Re-verified on RTX 4070 SUPER / i5-13400F (
--locked):cargo test -p victory-shader --all-targets --locked: 227 passed; 0 failed; 4 ignoredVICTORY_SHADER_OPT=511scalar_buffer_loads_read_the_same_dwords_one_call_or_four: passedVICTORY_REQUIRE_HW_GPU=1dxil_opt_hw_gpu_bit_exact_parity_and_validation: passedcargo clippy -p victory-shader --all-targets --locked -- -D warnings: 0 warnings@Vladimir-Human on GitHub · 2026-11-26 09:56 UTC · original
Pushed
6b6d888adding bounded intra-block read-after-read LDSdx.op.barriercoalescing underBARRIERS(256, included inDEFAULT = 447):dx.op.barrier(80, mode)calls between consecutive non-escapingaddrspace(3)(LDS) read phases when bounded on the left by a covering group+TGSM barrier ((mode & 9) == 9) and on the right by either a covering group+TGSM barrier orTerm::Ret(for group/TGSM-only modes), cutting Wave32split_ldswrite -> read -> read -> overwrite -> readbarriers5 -> 4(BWBRBRBWBR->BWBRRBWBR) and end-of-shaderwrite -> read -> read -> ret3 -> 2(BWBRBR->BWBRR).barrier(8), or branch (preventing WAR races across control-flow edges).VICTORY_REQUIRE_HW_GPU=1) + Microsoft D3D12 WARP + Windows SDKdxil.dllvalidator &dxc -dumpbin:cargo test -p victory-shader --all-targets --locked: 229 passed; 0 failed; 4 ignored (all 192 output dwords matched on both physical Wave32 and WARP)cargo clippy -p victory-shader --all-targets --locked -- -D warnings: 0 warningscargo run --locked -p xtask -- policy --staged: asset policy: 2 files okView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.