Repository navigation
Recompiler: flatten direct DXIL root-UAV loads for compute - #2368
Conversation
|
AMD Windows driver timing for #2368: on the RX 9070 XT, AMD's Setup
Method
Census (all 2,689 retail compute programs, translation only): 2,641 change. 2,639 grow and 2 shrink, for +1.3 % of DXIL in total. 26 programs (means of 2 rounds; all 104 builds succeeded, 0 refused)
The gain grows with program size:
Read / inference
Tests on this card (
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the census, measurements and tests and drafted this. Counts and timings only, no game data. |
|
Ran the two new root-UAV load tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC/DXIL 1.9.2609.5, debug build. Both What this adds: the author's hardware results are all on an RTX 5090 32 GB with Windows SDK DXC/DXIL 1.8.2502.11. This adds a second Blackwell part (16 GB) with DXC/DXIL 1.9.2609.5, and the thread has no test report from another machine yet. Not tested: the retail shader-pack cold PSO benchmarks, the synthetic dispatch timings, a paired 60 s smoke run, AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
In direct DXIL root-UAV window mode (`XCL_DIRECT_DXIL=1`, `XCL_HEAP_WINDOWS=0`), every scalar/buffer/flat read previously went through `with_mem_many_tys`, emitting a per-load `switch i32` + guard CFG and `phi` nodes over all 4 root-UAV windows (`u2..u5`). Compute shaders with hundreds of loads grew thousands of basic blocks, triggering multi-second to multi-minute cold NVIDIA driver compiles and high compiler commit memory. Replace multi-window direct DXIL read-only raw loads on non-graphics stages (`self.gfx.is_none()`, `self.heap_mem.is_none()`) with branchless straight-line loads via `with_mem_raw_loads`: - Resolve the effective window `w_eff = sel(guard, w, n)` once and compare `w_eff == k` across windows `0..n`, reading offset `0` on unselected windows/lanes and merging with `select`. - Preserve `xcl-dev#1693` semantics: out-of-range window indices and inactive lanes select `0` while emitting only valid offset-0 reads on bound windows. - Ensure `bind.rs` (`u2..u5`, filtering `v != 0`) and `runner::dispatch_with` always bind valid non-null buffers for all 4 root-UAV window slots. - Exclude graphics stages (`VS`/`PS`, `self.gfx.is_some()`), where flattening root-UAV loads regressed straight-line PS cold NVIDIA compile time by 5.64x (1,632 -> 9,203 ms on `0829441`). - Keep stores/atomics (`xcl-dev#2288`), `bvh_intersect`, `XCL_HEAP_WINDOWS` (`xcl-dev#1695`), and HLSL emission (`xcl-dev#1380`/`xcl-dev#2191`) unchanged. Measured on RTX 5090 (driver 621.01, Windows 11, release) against `3f4495a` (including PR xcl-dev#2346 non-coherent compute windows, 3 paired interleaved trials per spec with cold root-signature keys and fresh exe copies): - `cs-500-raw-w32` (non-coherent / coherent): 5,133 -> 1,748 ms (2.94x) / 5,129 -> 1,751 ms (2.93x); peak commit 309 -> 191 MiB - `cs-1000-raw-w32` (non-coherent / coherent): 19,742 -> 5,156 ms (3.83x) / 19,767 -> 5,132 ms (3.85x); peak commit 993 -> 259 MiB (-73.9%) - `cs-1000-raw-w64` (split wave64): 19,709 -> 5,171 ms (3.81x); peak 994 -> 259 MiB - `cs-1000-w32` (mixed w/ 33% FormatLoad, non-coherent / coherent): 49,431 -> 17,977 ms (2.75x) / 49,944 -> 18,058 ms (2.77x); peak 1.34 GiB -> 464 MiB - Synthetic GPU dispatch (128 loads/lane, uniform & mixed, w32 & split w64): 1.84x to 4.68x faster (3.296-6.688 us vs 9.696-22.608 us), 100% readback match. Assisted-by: T3 Code (gemini-pro-orchestrator-neon) Assisted-by: Codex in T3 Code (gpt-6.2-sol)
58bb1f5 to
c685e12
Compare
|
Independent test and smoke report for head Tested
Regression run (
PR Not tested: NVIDIA/Intel GPUs, Linux/Wine, or world load past the 60 s smoke window. AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Tested: current PR head merged onto current Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Independent RTX 3080 Ti check on clean c685e12, whose parent is 3ceb550. Windows 11 build 26300, NVIDIA 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, SDK DXC/DXIL 1.8.2502.11. Offline Cargo; Tested
Not tested: retail smoke, cold NVIDIA driver compile time, AMD/Intel, or full title output. This report does not establish merge readiness. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the checks and drafted this report. |
|
NVIDIA test report for
AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run. |
Port #2368's Lw::with_mem_raw_loads and mem_ld_chunks into Direct DXIL lowering so non-graphics stages running in root-UAV form (in_switch_form fallback or XCL_HEAP_WINDOWS=0) emit straight-line branchless loads reading offset 0 on unselected windows / inactive lanes and merging via select, eliminating per-load switch CFGs and handle PHIs. Includes regression tests in core_tests.rs covering branchless root-UAV loads, exec/OOB semantics, and branchless Direct DXIL PS heap-flat loads. Assisted-by: Antigravity (Gemini 4 Neon High)
Fall back to windows[0] when uma_window_vas() entries 1..3 are zero so branchless Direct DXIL root-UAV loads (6ea50d1) and prelude indirect passes never bind a null root UAV. Assisted-by: Antigravity (Gemini 4 Neon High)
|
Closing and reopening at once, only to get a CI run on today's |
|
Merging: direct-DXIL compute loads from the root memory windows become straight-line loads and selects. Stores, atomics, graphics stages and heap windows keep their form. The cold-compile gain is measured by others above: 1.86 times over 26 large programs on AMD RDNA4, about half the peak memory (bielfreedom), and the RTX 5090 table in the description. I did not repeat those. Tested on AMD RDNA4 (native wave64), Windows, DXC 1.8.2502.11, debug, AI use: Claude Code (Claude Opus 5.5) read the diff and the thread, ran the tests and wrote this on the maintainer's behalf. |
|
A crash in dxil-spirv's CFG structurizer after this change (Linux + vkd3d-proton 3.2.0, retail title world load). Environment: Linux x64, RTX 5090, NVIDIA 620.73.04, Proton 11's Wine, vkd3d-proton 3.2.0 ( Tree:
So a null node reaches the post-dominator walk as the second argument; Attribution, same tree and knobs, only this commit reverted (
Two reverted runs against three merged ones is a small sample, but the crash is deterministic in place (same frame, same null read) and absent in both reverted runs, and the only difference between the trees is this commit. Whatever the flatten emits for at least one console compute program ends up in dxil-spirv's structurizer as a CFG with a null successor/post-dominator edge — could the flattened path leave a branch target unset (or an empty edge) in the emitted DXIL, or is this a known dxil-spirv null-edge case that the DXIL shape exposes? I can run any patch on this box and report back with the same A/B. Logs, screenshots and the crash log stay local (they contain title data). AI use: omp (DeepSeek V4.1 Flash 1017) ran the builds, the A/B legs and the disassembly, and wrote this comment from those logs. |
|
RX 6800M failure control for merged PR #2368. The same focused test was run on clean Environment: AMD Radeon RX 6800M, driver Command on each head: cargo test -p xcl --lib raw_loads_in_root_windows_respect_exec_and_bounds -- --test-threads=1 --show-outputBoth test processes exited This result does not attribute the crash to #2368 or #2221. I did not run an A/B against #2368's parent. AI use: OpenAI Codex (GPT-6; exact variant unavailable) inspected the recorded logs and prepared this report. |
|
Follow-up on my comment above, with a result that argues against a clean attribution: the same merged tree ( The reverted tree is still 0 in 3 (283 s, 266 s, 303 s with If someone wants the crash under a debugger rather than a guess, the runs that crash are the ones with AI use: omp (DeepSeek V4.1 Flash 1017) ran the legs and wrote this. |
|
One more datum, and it moves the fault away from XCL's background workers: the same merged tree with So: the null post-dominator is not specific to If it helps, the next step I would take here is to replay one of those large records alone ( AI use: omp (DeepSeek V4.1 Flash 1017) ran the leg and wrote this. |
Part of #2088. Replace per-load
switch i32CFGs across the 4 root-UAV memory windows (u2..u5) in direct DXIL (XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0) with branchless straight-linerawBufferLoad+selecton non-graphics stages (self.gfx.is_none()).In direct DXIL root-UAV mode, every scalar, buffer, or flat load previously branched through
with_mem_many_tys, emitting a per-load 5-armswitchand mergephinodes. Compute shaders with hundreds or thousands of loads grew thousands of basic blocks, driving multi-minute cold NVIDIA driver compiles and multi-gigabyte driver commit spikes. Flattening read-only loads resolves the effective windoww_eff = sel(guard, w, n)once, comparesw_eff == kacross windows0..n, reads offset0on unselected windows/lanes, and selects the result — preserving#1693out-of-range (0) and inactive-lane (0) semantics while issuing only valid offset-0 reads on bound windows.Scope and relationship to other work
with_mem_many_tys, PR Recompiler: guard direct DXIL window stores with bit tests #2288),bvh_intersect,XCL_HEAP_WINDOWS=1(PR Recompiler: heap memory windows without a guard (min + null view), and the 64-bit atomics check #1695), and the HLSL path (PR Recompiler: big compute programs read their memory windows without a switch #1380 / PR Recompiler: pick root-UAV memory windows with bit tests, not a switch #2191) are untouched.VS/PS,self.gfx.is_some()) keep theswitchpath. Measuringps-200-loadson0829441showed that flattening root-UAV loads on Pixel Shaders regressed NVIDIA cold compile time 5.64x (1,632 -> 9,203 msstraight-line,2,224 -> 2,592 mslooped). On3f4495a(with PR Recompiler: emit globallycoherent on compute memory windows only when needed #2346 non-coherent compute windows), both non-coherent andGLC-coherent compute speed up consistently with zero regression, while PS DXIL stays byte-identical (dxil_hash=98a91ac649117912,132,508 B).bind.rs(u2..u5, filteringv != 0) andrunner::dispatch_withalways bind valid non-null buffers for all 4 root-UAV window slots so unselected offset-0 reads never touch GPU VA0.What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs: addwith_mem_raw_loadsandmem_ld_chunks, routing direct DXIL read-only raw loads (mem_ld,mem_ld_n,ld_raw_guarded,ld_raw_u32_guarded,s_buffer_load,s_load, single-componentBufKind::FormatLoad) through branchless offset-0 loads +selectwhenself.heap_mem.is_none() && self.gfx.is_none().crates/xcl/src/hle/d3d12x/bind.rs: filterv != 0when populatingu2..u5so an unpopulated(0, 0)UMA_BUFFERslot falls back tofirst.crates/xcl/src/gpu/recomp/runner.rs: bind root UAVsu2..u5indispatch_with(previously onlyu2was bound).crates/xcl/src/gpu/dxil/core_tests.rs: addraw_loads_in_root_windows_are_branchless(IR shape across wave32, split-wave64, native-wave64, heap windows, stores/atomics, and PS exclusion) andraw_loads_in_root_windows_respect_exec_and_bounds(GPU readback over 4 windows, offset-0 canaries, window bounds,hi == 0-> w0, 64-bit carry across windows, maskedEXEC, and unaligned format loads).Tested
shaders.rpfdirect-DXIL scan & validation (3f4495a->58bb1f5,splitenabled for wave64 on RTX 5090, 4 root UAV windows): 2,682 / 2,682 unique compute records translated directly (0HLSL fallbacks,0DXIL validation errors across all emitted pieces), modifying 2,635 compute records.shaders.rpfcoldCreateComputePipelineStatebenchmarks on RTX 5090 (3f4495a->58bb1f5, release builds, 3 paired interleaved trials per record, isolatedXCL_DXIL_CACHE, fresh per-run.execopies, distinct unused root-constant layout keysShaderRegister=6, Num32BitValues=1..39; immediate same-layout warm replays took0.82–15.80 ms; 0 errors, 0 timeouts, 0 device removals):3f4495a)58bb1f5)219287eb2f6021fe95cc13288a27a96e73fb752d7f62c3a5dca1b25b4487801884eee477d68b6fdf620491641aa9bad656c0cd3b82a00c6e4585e350d1b864e3715d367152768991a4c70d5842b40e132099a37cbf86d15530a7bbba88b255cc777348c43857fdd23f4495a->58bb1f5(3 paired interleaved trials, 128 root-window loads/lane across 4 windows, 128 groups x 128 timed dispatches after 8 warmups, 100% readback dwords verified, 0 device removals):uniform wave32:10.560 -> 3.296 us(3.20x faster)uniform split-wave64:9.696 -> 5.280 us(1.84x faster)mixed wave32:22.608 -> 4.832 us(4.68x faster)mixed split-wave64:21.408 -> 6.688 us(3.20x faster)58bb1f5(with an isolated freshXCL_DXIL_CACHE):XCL_ADAPTER=5090cargo build --workspace --locked --offline -j 8: passed.XCL_ADAPTER=5090XCL_SAMPLE_RPF=$RetailPack:cargo test -p xcl --lib --locked --offline -j 8 gpu_retail -- --nocapture: 1 passed, 0 failed, 0 ignored.cargo test -p xcl --lib --locked --offline -j 8 raw_loads_in_root_windows -- --nocapture: 2 passed, 0 failed, 0 ignored, 0SKIPPED.cargo test -p xcl --lib --locked --offline -j 8 compute_globallycoherent_only_when_needed -- --nocaptureandgpu_compute_coherent_and_cached_loads -- --nocapture: 1 passed, 0 failed each (0SKIPPED).cargo test --workspace --locked --offline -j 8 --no-fail-fast -- --test-threads=4 --nocapture: 1,273 passed, 4 failed, 46 ignored, 26SKIPPEDnotices across 23 test binaries (xcl --lib: 1,204 passed, 4 failed, 26 ignored; the 4 failures are pre-existing RTX 5090gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3seeds 70, 545, 1019, 1507 hittingCreateComputePipelineState: 0x8007000E, identical to cleanmain).XCL_ADAPTER=warpcargo test -p xcl --lib --locked --offline -j 8 -- --test-threads=4 --nocapture: 1,208 passed, 0 failed, 26 ignored, 322SKIPPEDnotices.Rebased workspace verification on the same RTX 5090 (driver 621.01), Windows 11 build 26300, Rust 1.100.0 MSVC, DXC 1.8.2502.11. The original offline benchmarks above retain their measured revisions.
cargo build --workspace --locked --offline -j 8passed on both revisions.cargo test --workspace --locked --offline -j 8 --no-fail-fast -- --test-threads=4withXCL_ADAPTER=5090,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0and separate DXIL caches reported 1,341 passed, 6 failed, 46 ignored, 26 SKIPPED notices on3ceb550and 1,343 passed, 6 failed, 46 ignored, 26 SKIPPED notices onc685e12across 24 test result blocks.CreateComputePipelineState0x8007000Eon seeds 70, 545, 1019, and 1507. The bridged-mask barrier assertion andoffline_compute_pipeline_is_reused_by_a_second_processalso failed on both revisions.Rebased head GPU skips
SKIPPED gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refusedSKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missingSKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsRegression run
Release builds from both clean commits used
cargo build -p xcl --release --locked --offline -j 8. Both ran./scripts/smoke.ps1 -Game $RetailTitleFolder -Seconds 60 -Xcl $ReleaseExe -OutDir $SmokeOutwithXCL_ADAPTER=5090,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0,XCL_PSO_TRACE=1, andXCL_FRAME_DUMP=300. Each run started with separate emptyXCL_DATA_ROOTandXCL_DXIL_CACHEdirectories. All three paired sampled frames matched byte-for-byte by SHA-256.Clean main
Clean head
Not tested
XCL_HEAP_WINDOWS=1(unchanged by this PR).58bb1f5(earlier Radeon iGPU check passed 2/0 onraw_loads_in_root_windowsbefore excluding graphics stages and rebasing onto3f4495a).AI use
T3 Code (Antigravity harness, gemini-pro-orchestrator-neon) designed and implemented the direct DXIL flattening and tests, extended the offline pack benchmark harness, ran the tests, retail cold PSO benchmarks, and paired 60 s smoke runs, and drafted this description.
Codex in T3 Code (gpt-6.2-sol) resolved the rebase, ran the workspace and smoke comparisons on the new commits, and updated the report.