Direct DXIL: unused raw loads and f16 conversions are dropped #2212
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2212
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2212"
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?
@tibzejoker on GitHub · 2026-11-25 09:58 UTC · original
tibzejoker:dxil-dead-calls→main· +54 −1 · 1 files · 1 commits · openModule::optimizekept unuseddx.op.rawBufferLoadanddx.op.legacyF16ToF32calls: neither is in the list of calls dead-code removal may take. A raw load setsRawAndStructuredBufferswhile the module is built, so when every raw load of a program is unused the first one stays and the flags still match the code. Part of #1269 (claimed here).On 573 sampled programs (
xcl shaders shaders.rpf --direct --sample 600 --seed 3 --max-bytes 40000 --validate,XCL_HEAP_WINDOWS=1), all validator-clean before and after:main568e7dbdxc -dumpbin)A small gain: about 21 000 unused raw loads and 3 100 unused f16 conversions in that sample.
What is in it
crates/xcl/src/gpu/dxil/module/opt.rs:removabletakesdx.op.rawBufferLoad.*anddx.op.legacyF16ToF32; after liveness, one raw load is kept when none is live. Testunused_raw_loads_and_f16_conversions_go_but_one_raw_load_stays(fails without the change).Tested
cargo test --workspace -- --test-threads=4(throughscripts/test.ps1): 1155 passed, 0 failed, 46 ignored.no wave64, 13 wave64 variants of the instruction tests, 1no heap windows, 3 per-lane f16 refusals (V_CVT_F16_F32,V_PK_MUL_F16,V_MUL_F16).--validate: 573 / 573 translated, 0 validator errors, before and after.Regression run
main:This PR:
Not tested
AI use
🤖 Generated with Claude Code
@DarkPanda69 on GitHub · 2026-11-25 10:06 UTC · original
AMD with native wave64 (listed as untested), plus an RTX 3060, paired against
mainwith the direct translator on for the whole GPU suite, since this changes the direct backend's output for every program.Head
b09f06dapplied onmain568e7db, debug, Windows 11 Pro 26200,XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4, onmainand on this PR for each card:mainPer-test comparison: on both cards the only difference is the new
unused_raw_loads_and_f16_conversions_go_but_one_raw_load_stays(ok). No existing test changes result or skip state. The failures are the same onmain:gpu_image_get_resinfo_1d_arrayon both cards (the direct-path bug #2046 fixes) and, on the RX 9070 XT only, the fuzz seeds 722 and 1599 tracked in #2115.Not tested: a title with
XCL_DIRECT_DXIL=1, driver compile time.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@tibzejoker on GitHub · 2026-11-25 10:10 UTC · original
@DarkPanda69 Thanks for running it on RDNA4 and the 3060 with
XCL_DIRECT_DXIL=1. That covers the AMD and native wave64 side I listed as untested.@raylitebull on GitHub · 2026-11-25 10:46 UTC · original
Diff review on
b09f06d(crates/xcl/src/gpu/dxil/module/opt.rs) looks clean, CI passed, and both NVIDIA (RTX 4090 / RTX 3060) and AMD (RX 9070 XT) runs passed.b09f06dnow conflicts inopt.rsafter #2194 (simplify_cfg) landed onmain— please rebase ontomainso we can get CI green and merge.@bielfreedom on GitHub · 2026-11-25 11:04 UTC · original
AMD Windows driver timing for #2212: on the RX 9070 XT the DXIL shrinks by 1.9 %, but AMD's
CreateComputePipelineStatetime doesn't move (−0.4 %, within noise). The AMD compiler seems to drop these unused loads itself, so the gain here is in DXIL size and translation, not driver time.Setup
568e7db;b09f06d.fnv64) and per-CreateComputePipelineStatetime.Method
XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0,XCL_PIPELINE_THREADS=1.XCL_PSO_DISK_CACHE=0and a fresh exe name per run, because the AMD driver cache is keyed on the exe file name.84eee477d68b6fdf(CS_RaytracingResolve) and620491641aa9bad6.Results (means of 2 rounds; all 104 builds succeeded, 0 refused)
84eee477d68b6fdf: 1,025,520 → 1,003,012 B (−2.2 %), driver 52.7 → 52.6 s.95cc13288a27a96e, plain here): 3,916,120 → 3,912,160 B. It still reached 24 GB after 153 s and was killed (base: 153 s).Tests on this card (
XCL_REQUIRE_GPU=1,XCL_ADAPTER=9070)unused_raw_loads_and_f16_conversions_go_but_one_raw_load_stays: passed.Read / inference
Not tested
XCL_DIRECT_DXIL=1.XCL_HEAP_WINDOWS=1.AI use: Claude Code (Claude Opus 5.5) ran the measurements and the test and drafted this. The account owner is away; counts and timings only, no game data.
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.