Shader: backward dead-code elimination in DXIL bitcode emission #697
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!697
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-697"
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?
@wbkepler on GitHub · 2026-11-24 07:00 UTC · original
wbkepler:shader/dxil-dead-code-elimination→main· +521 −94 · 2 files · 1 commits · openSummary
Replaces fixed-point phi-only liveness in
victory-shaderModule::writewith a single-pass backward worklist over reachable reverse-postorder blocks seeded from side-effecting roots (stores, atomics, barriers, void/non-pure calls,dx.op.atomic*) and branch conditions:dx.opdeclarations from emitted DXIL bitcode.VecduringFUNCTION_BLOCKserialization.ShaderFlags(TYPED_UAV_LOADS,WAVE_OPS,INT64,RESOURCE_HEAP,SAMPLER_HEAP) viaModule::active_flagsinShader::finishso declared flags andSFI0match live post-DCE usage.Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passed (victory-shader: 72/72 including 3 new bitcode/DCE/dxil.dllvalidation tests)cargo xtask policy— passed (151 files ok)@iurysf on GitHub · 2026-11-24 08:27 UTC · original
Measured offline against main
c2e7254withvictory translate --list --validateover the title'sshaders.rpf+ executable (26,096 programs), dxil.dll 1.9.2602.17, comparing outcomes program by program: no outcome changes. All 25,902 programs translate, fail, validate or get rejected exactly as on main: 21,983 validated, 185 rejected, 3,734 failed. So the dead-code elimination doesn't break validation anywhere in this corpus. (I didn't measure the size or compile-time effect.)AI-assisted.
@molodayamama on GitHub · 2026-11-24 14:01 UTC · original
Independent Windows check of
2eea8e2e817032c7574c64b2adb8fa870504d75a(Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).cargo test -p victory-shader --locked --lib dead_instructions_and_unused_declarations_are_eliminated -- --test-threads=1 --nocapture: 1 passed.cargo test -p victory-shader --locked --lib side_effecting_atomics_with_unused_results_stay_live -- --test-threads=1 --nocapture: 1 passed.cargo test -p victory-shader --locked --lib post_dce_shader_flags_validate_with_dxil -- --test-threads=1 --nocapture: 1 passed.The focused tests cover removal of dead instructions and unused declarations, keeping a side-effecting atomic with an unused result, and DXIL shader flags. This checks the emitted module and the local validator, without submitting a dispatch.
Only source-built synthetic fixtures were used. AI-assisted verification.
@Marvisak on GitHub · 2026-11-25 01:16 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/bitcode.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View 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.