Direct DXIL: unused raw loads and f16 conversions are dropped #2202
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by tibzejoker on 2026-11-25T09:58:17Z.
Module::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
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T10:06:55Z.
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.
Imported from ivall/xcl. Originally posted by tibzejoker on 2026-11-25T10:10:48Z.
@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.Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T10:46:59Z.
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.Imported from ivall/xcl. Originally posted by bielfreedom on 2026-11-25T11:04:56Z.
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.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:41:11Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:35:44Z.
Triage (#1607) – head
b09f06dMain already has this change. Commit
6ff86e3(merged in #3503) addsdx.op.legacyF16ToF32anddx.op.rawBufferLoad.to the pure-call list indxil/module/opt.rs. It also adds the sameflagged/reachableblock that keeps one raw load alive soRawAndStructuredBuffersstill matches the code (main's opt.rs around line 1470).Recommendation: close (superseded by main commit
6ff86e3/ #3503).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:50:48Z.
Closing as superseded: this change is already on
main(6ff86e30). main opt.rs lists dx.op.legacyF16ToF32 and dx.op.rawBufferLoad. as pure and keeps one raw load for the RawAndStructuredBuffers flag (same code as the PR at lines 530 and 1472)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed