dxil: heap memory windows in the direct form #1714

Closed
github-bot wants to merge 1 commit from gh-pr/1714/head into gh-pr/1714/base
Owner

@⁠Sr-0w on GitHub · 2026-11-24 19:38 UTC · original
Sr-0w:direct-heap-windows → main · +82 −22 · 6 files · 1 commits · closed without merging

With XCL_HEAP_WINDOWS=1, the direct DXIL translator (#1426) refused every program that may address several memory windows ("unsupported: heap memory windows"), so they went back to the HLSL path. This takes them in the direct form, one access through the descriptor heap. That is the same shape as the HLSL path's heap form (#680), and it replaces the switch over the root UAVs, which the AMD driver compiles 2–4× slower.

What changes (gpu/dxil, +40 lines)

  • Shader::heap_raw_uav: a RWByteAddressBuffer handle (globallycoherent for compute) from ResourceDescriptorHeap[index].
  • Lw::heap_mems: with HEAP_WINDOWS in mem_windows and more than one window, no root UAVs are bound. Lw::with_mem makes one access through ResourceDescriptorHeap[MEM_HEAP_BASE + w] with a non-uniform index. A w outside the program's window count goes to window 0, as in the switch form.
  • Lw::multi_window replaces the three mems.len() > 1 checks (the window of a FLAT address, a V#, a BVH node), so the window is tracked in both forms.

Test

  • gpu_direct_memory_windows_from_the_heap runs the 4 GiB two-window program, the one gpu_memory_windows_from_the_heap runs on the HLSL path, through both direct forms on the GPU:
    • s_load, buffer load and store, global load, store and atomic, in window 1 next to window 0;
    • the heap form's DXIL is smaller than the switch's.
  • With the old refusal put back, it fails (direct DXIL: unsupported: heap memory windows).
  • tests.rs: direct_or is split into direct_of, which always translates, and direct_or, which does so under XCL_DIRECT_DXIL. direct_of passes heap_windows on.
  • gpu_memory_windows_from_the_heap with XCL_DIRECT_DXIL=1 now takes the direct heap form instead of falling back to the HLSL DXIL.

Measured on an AMD Radeon RX 7800 XT (RDNA3, native 64-lane waves), Ryzen 7 3700X, 64 GB, Windows 11 26300, Rust 1.100.0, DXC 1.9.2602.17.

  • cargo test --workspace -- --test-threads=4: 859 passed, 0 failed, 42 ignored. One SKIPPED line, heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows; it needs XCL_HEAP_WINDOWS=1 and is skipped on main too.
  • memory_windows tests with XCL_DIRECT_DXIL=1: 6 passed, 0 failed.
  • AMD driver time:
    • Sample: the slowest compute builds of my retail title runs. I found them in the title's shader pack by their DXIL size and translated them in the direct form, native wave64, 4 windows (what the title builds).
    • Method: CreateComputePipelineState with the test root signature, cold, one at a time. The 21 programs without textures are below; the test root signature refuses the others.
    • Each form's DXIL was built cold once. A second build of the same DXIL takes 0.0 s (the driver's own cache).
program switch, 4 windows heap, 4 windows
5683ddcd01491067 961 KB, 23.1 s 559 KB, 6.1 s
6e148dbd563de205 401 KB, 12.0 s 217 KB, 4.9 s
cc047f458010c5d2 586 KB, 10.1 s 355 KB, 5.7 s
1404420b38db8597 471 KB, 8.2 s 275 KB, 2.9 s
2e0055c25f49848a 277 KB, 7.6 s 174 KB, 3.9 s
34207613d17f8b96 453 KB, 6.9 s 295 KB, 3.7 s
73000efc296c082e 173 KB, 6.7 s 100 KB, 3.5 s
6da1f38b06d6c735 313 KB, 6.2 s 134 KB, 1.7 s
aa35926a5609067b 357 KB, 5.9 s 277 KB, 3.2 s
12 others 2.2–4.7 s each 0.7–2.7 s each
all 21 123.4 s 52.9 s

The heap form's DXIL is within 2–5 % of the one-window form's.

Not tested

  • NVIDIA and Intel, Linux, wave32-only GPUs (the split form goes through the same with_mem).
  • A title run with XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1: it comes next, and I'll post it here.
  • The mesh pass and VS / PS in the heap form: they go through the same with_mem, but no test of their own.

Discussed on #1269 and #1426.

AI use: Claude Code (Claude Opus 5.5) wrote the change and the test, ran the suite and the driver timings, and wrote this description.

🤖 Generated with Claude Code

**@⁠Sr-0w** on GitHub · 2026-11-24 19:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714) `Sr-0w:direct-heap-windows` → `main` · +82 −22 · 6 files · 1 commits · closed without merging With `XCL_HEAP_WINDOWS=1`, the direct DXIL translator (#1426) refused every program that may address several memory windows ("unsupported: heap memory windows"), so they went back to the HLSL path. This takes them in the direct form, one access through the descriptor heap. That is the same shape as the HLSL path's heap form (#680), and it replaces the switch over the root UAVs, which the AMD driver compiles 2–4× slower. **What changes** (`gpu/dxil`, +40 lines) - `Shader::heap_raw_uav`: a `RWByteAddressBuffer` handle (`globallycoherent` for compute) from `ResourceDescriptorHeap[index]`. - `Lw::heap_mems`: with `HEAP_WINDOWS` in `mem_windows` and more than one window, no root UAVs are bound. `Lw::with_mem` makes one access through `ResourceDescriptorHeap[MEM_HEAP_BASE + w]` with a non-uniform index. A `w` outside the program's window count goes to window 0, as in the switch form. - `Lw::multi_window` replaces the three `mems.len() > 1` checks (the window of a FLAT address, a V#, a BVH node), so the window is tracked in both forms. **Test** - `gpu_direct_memory_windows_from_the_heap` runs the 4 GiB two-window program, the one `gpu_memory_windows_from_the_heap` runs on the HLSL path, through both direct forms on the GPU: - s_load, buffer load and store, global load, store and atomic, in window 1 next to window 0; - the heap form's DXIL is smaller than the switch's. - With the old refusal put back, it fails (`direct DXIL: unsupported: heap memory windows`). - `tests.rs`: `direct_or` is split into `direct_of`, which always translates, and `direct_or`, which does so under `XCL_DIRECT_DXIL`. `direct_of` passes `heap_windows` on. - `gpu_memory_windows_from_the_heap` with `XCL_DIRECT_DXIL=1` now takes the direct heap form instead of falling back to the HLSL DXIL. **Measured** on an AMD Radeon RX 7800 XT (RDNA3, native 64-lane waves), Ryzen 7 3700X, 64 GB, Windows 11 26300, Rust 1.100.0, DXC 1.9.2602.17. - `cargo test --workspace -- --test-threads=4`: **859 passed, 0 failed, 42 ignored**. One `SKIPPED` line, `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows`; it needs `XCL_HEAP_WINDOWS=1` and is skipped on `main` too. - `memory_windows` tests with `XCL_DIRECT_DXIL=1`: 6 passed, 0 failed. - AMD driver time: - Sample: the slowest compute builds of my retail title runs. I found them in the title's shader pack by their DXIL size and translated them in the direct form, native wave64, 4 windows (what the title builds). - Method: `CreateComputePipelineState` with the test root signature, cold, one at a time. The 21 programs without textures are below; the test root signature refuses the others. - Each form's DXIL was built cold once. A second build of the same DXIL takes 0.0 s (the driver's own cache). | program | switch, 4 windows | heap, 4 windows | |---|---|---| | `5683ddcd01491067` | 961 KB, 23.1 s | 559 KB, 6.1 s | | `6e148dbd563de205` | 401 KB, 12.0 s | 217 KB, 4.9 s | | `cc047f458010c5d2` | 586 KB, 10.1 s | 355 KB, 5.7 s | | `1404420b38db8597` | 471 KB, 8.2 s | 275 KB, 2.9 s | | `2e0055c25f49848a` | 277 KB, 7.6 s | 174 KB, 3.9 s | | `34207613d17f8b96` | 453 KB, 6.9 s | 295 KB, 3.7 s | | `73000efc296c082e` | 173 KB, 6.7 s | 100 KB, 3.5 s | | `6da1f38b06d6c735` | 313 KB, 6.2 s | 134 KB, 1.7 s | | `aa35926a5609067b` | 357 KB, 5.9 s | 277 KB, 3.2 s | | 12 others | 2.2–4.7 s each | 0.7–2.7 s each | | **all 21** | **123.4 s** | **52.9 s** | The heap form's DXIL is within 2–5 % of the one-window form's. **Not tested** - NVIDIA and Intel, Linux, wave32-only GPUs (the split form goes through the same `with_mem`). - A title run with `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1`: it comes next, and I'll post it here. - The mesh pass and VS / PS in the heap form: they go through the same `with_mem`, but no test of their own. Discussed on #1269 and #1426. AI use: Claude Code (Claude Opus 5.5) wrote the change and the test, ran the suite and the driver timings, and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With XCL_HEAP_WINDOWS=1 the direct translator refused every program that
may address several memory windows, and they went back to the HLSL path.
Now `Lw::with_mem` makes one access through
`ResourceDescriptorHeap[MEM_HEAP_BASE + w]` (a non-uniform index), as the
HLSL path's heap form does, instead of a switch over the root UAVs; a
window outside the program's count goes to window 0, as in the switch.

On an RX 7800 XT the AMD driver builds the switch form of a retail title's
slow compute programs 2-4x slower: 21 of them took 123.4 s with the
switch over 4 windows and 52.9 s from the heap (cold builds, one at a time).

The 4 GiB memory-windows GPU test now also runs both direct forms; the heap
one fails with the old refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SKtJsfjasPuTLtS3mEXFru
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:02:26 +00:00
github-bot closed this pull request 2026-11-26 05:02:26 +00:00
Author
Owner

@⁠vitor127wt on GitHub · 2026-11-24 19:54 UTC · original

RTX 5070 Ti / Proton retail startup with direct DXIL and heap windows

With XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 on both builds, main fell back to HLSL for three compute shaders with unsupported: heap memory windows. This PR translated the same three inputs directly, with zero HLSL fallbacks. The cache used window key 260 on both builds (four windows with the heap bit set). On the PR, I verified that each direct DXIL diagnostic dump matched the cached compute bytecode. Total DXIL for the three inputs was 148,224 B on main and 134,792 B on the PR.

Tested

  • main c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 and PR head 48e8e801b4211cec5823094d323d0986edb66f49, both clean Windows x64 release builds. RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS kernel 7.3.5-2-cachyos, and Proton Experimental 11.0 (2026-11-12).
  • Rust 1.100.0, LLVM-MinGW 20261117 (x86_64-pc-windows-gnullvm), DXC 1.9.2609.5, vkd3d-proton ec207194 with the #257 patch, and dxil-spirv 7c048638.
  • Built with cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl. Ran scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 60 from #257 with fresh prefixes and caches, XCL_DIRECT_DXIL_STATS=1, XCL_DXIL_DUMP=all, and networking off.
  • Built the release library test binary with cargo test --locked --release --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run. Ran gpu_direct_memory_windows_from_the_heap, gpu_memory_windows_from_the_heap, gpu_heap_windows_reject_out_of_uma_aliasing separately via Proton Wine with --exact --test-threads=1 --nocapture and the same two flags. 3 passed, 0 failed, 0 ignored, 0 skipped.

Regression run

The blocks were generated by the Wine smoke script. I abbreviated the local folder name in the title field.

main

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1201 (PresentX 1201)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

PR head

xcl-smoke v1
commit: 48e8e801b4211cec5823094d323d0986edb66f49
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1242 (PresentX 1242)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

Scope — One 60 s startup run per build. The frame counts describe this pair. Linux cgroup peaks were 9.02 and 6.41 GiB. Wine reported 0 MB in the Windows peak-commit field.

AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the shader routing, and drafted this report.

**@⁠vitor127wt** on GitHub · 2026-11-24 19:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7142763525) **RTX 5070 Ti / Proton retail startup with direct DXIL and heap windows** With `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1` on both builds, `main` fell back to HLSL for three compute shaders with `unsupported: heap memory windows`. This PR translated the same three inputs directly, with zero HLSL fallbacks. The cache used window key `260` on both builds (four windows with the heap bit set). On the PR, I verified that each direct DXIL diagnostic dump matched the cached compute bytecode. Total DXIL for the three inputs was 148,224 B on `main` and 134,792 B on the PR. **Tested** - `main` `c160d86ef2efe3a07e4dfb473e4fa72eafb413c0` and PR head `48e8e801b4211cec5823094d323d0986edb66f49`, both clean Windows x64 release builds. RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS kernel `7.3.5-2-cachyos`, and Proton Experimental 11.0 (2026-11-12). - Rust 1.100.0, LLVM-MinGW 20261117 (`x86_64-pc-windows-gnullvm`), DXC 1.9.2609.5, vkd3d-proton `ec207194` with the #257 patch, and dxil-spirv `7c048638`. - Built with `cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl`. Ran `scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 60` from #257 with fresh prefixes and caches, `XCL_DIRECT_DXIL_STATS=1`, `XCL_DXIL_DUMP=all`, and networking off. - Built the release library test binary with `cargo test --locked --release --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run`. Ran `gpu_direct_memory_windows_from_the_heap`, `gpu_memory_windows_from_the_heap`, `gpu_heap_windows_reject_out_of_uma_aliasing` separately via Proton Wine with `--exact --test-threads=1 --nocapture` and the same two flags. **3 passed, 0 failed, 0 ignored, 0 skipped.** **Regression run** The blocks were generated by the Wine smoke script. I abbreviated the local folder name in the `title` field. `main` ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1201 (PresentX 1201) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` PR head ``` xcl-smoke v1 commit: 48e8e801b4211cec5823094d323d0986edb66f49 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1242 (PresentX 1242) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` **Scope** — One 60 s startup run per build. The frame counts describe this pair. Linux cgroup peaks were 9.02 and 6.41 GiB. Wine reported `0 MB` in the Windows peak-commit field. **AI use** — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the shader routing, and drafted this report.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 19:44 UTC · original · edited 2026-11-24 19:55 UTC

Correction: this run did not test this PR. My launch script passed only the first of its environment variables (powershell -File binds one value to a [string[]] parameter). So the run had XCL_DIRECT_DXIL=1 but not XCL_HEAP_WINDOWS=1: it ran main's direct switch form on this build. The 209 s against 136 s is therefore run-to-run spread on the same configuration, not this change. Another run of the same configuration right after it ended at 142 s. I'll redo the title run with both variables set, check in the log that they took effect, and post it here.

AI use: Claude Code (Claude Opus 5.5) wrote this correction.

**@⁠Sr-0w** on GitHub · 2026-11-24 19:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7142523857) · edited 2026-11-24 19:55 UTC **Correction: this run did not test this PR.** My launch script passed only the first of its environment variables (`powershell -File` binds one value to a `[string[]]` parameter). So the run had `XCL_DIRECT_DXIL=1` but **not** `XCL_HEAP_WINDOWS=1`: it ran `main`'s direct switch form on this build. The 209 s against 136 s is therefore run-to-run spread on the same configuration, not this change. Another run of the same configuration right after it ended at 142 s. I'll redo the title run with both variables set, check in the log that they took effect, and post it here. AI use: Claude Code (Claude Opus 5.5) wrote this correction.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 19:56 UTC · original

Windows NVIDIA check at 48e8e80: RTX 3070 (Ampere, 32-lane waves only), driver 616.56, Windows 11, DXC 1.8.2502.11.

  • gpu_direct_memory_windows_from_the_heap and gpu_memory_windows_from_the_heap pass, with and without XCL_DIRECT_DXIL=1, and again under XCL_REQUIRE_GPU=wave64, so neither is skipped. The 64-lane two-window program therefore runs through both direct forms on a 32-lane card. That covers the non-uniform ResourceDescriptorHeap index on NVIDIA's Windows driver; the earlier NVIDIA report was under Proton.
  • gpu::dxil + gpu::recomp: 275 passed, 0 failed, 19 ignored, 3 of 3 runs.

No game files; the PR's own synthetic tests only. AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-24 19:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7142824252) Windows NVIDIA check at `48e8e80`: RTX 3070 (Ampere, 32-lane waves only), driver 616.56, Windows 11, DXC 1.8.2502.11. - `gpu_direct_memory_windows_from_the_heap` and `gpu_memory_windows_from_the_heap` pass, with and without `XCL_DIRECT_DXIL=1`, and again under `XCL_REQUIRE_GPU=wave64`, so neither is skipped. The 64-lane two-window program therefore runs through both direct forms on a 32-lane card. That covers the non-uniform `ResourceDescriptorHeap` index on NVIDIA's Windows driver; the earlier NVIDIA report was under Proton. - `gpu::dxil` + `gpu::recomp`: 275 passed, 0 failed, 19 ignored, 3 of 3 runs. No game files; the PR's own synthetic tests only. AI-assisted (Claude Code).
Author
Owner

@⁠WebIdentity1 on GitHub · 2026-11-24 20:00 UTC · original

Independent RTX 3090 validation of exact head 48e8e801b4211cec5823094d323d0986edb66f49 on native Windows 10 (driver 591.74, Agility SDK 1.620.2). I verified the process environment contained both XCL_DIRECT_DXIL=1 and XCL_HEAP_WINDOWS=1, with XCL_ADAPTER=3090 and XCL_REQUIRE_GPU=mesh. Clean tracked source hashes matched before and after (292/292).

I saw the RTX 3070 compute check above after my runs; the incremental coverage below is the direct mesh heap-window GPU path.

  • cargo test --locked -p xcl --lib gpu_direct_memory_windows_from_the_heap -- --test-threads=1 --show-output --nocapture: 1 passed / 0 failed / 0 ignored, no skip or timeout. The test runs both direct switch and direct heap forms on the GPU and checks s_load, buffer load/store, global load/store/atomic across two windows.
  • cargo test --locked -p xcl --lib gpu_memory_windows_from_the_heap -- --test-threads=1 --show-output --nocapture: 1 / 0 / 0, no skip or timeout. With the two variables above, this now selects the direct heap translation instead of the earlier HLSL fallback.
  • I added a local, test-only diagnostic to gpu_mesh_mode_reads_memory_windows: call direct_of with Mode::Mesh, two windows, and heap_windows=true; dispatch its compute pass on the GPU and check three positions against window 1's values, with window 0 holding distinct decoys. This passed 1 / 0 / 0, no skip or timeout. It exercises the direct mesh heap accessor, which the PR's added compute test does not cover. The diagnostic patch SHA-256 is 385d011498809ce48538f79e290e7151b56dc8cdf54a6618421a69be836d8e3d:
@@ -3229,6 +3229,12 @@ fn gpu_mesh_mode_reads_memory_windows() {
     assert_eq!(positions(1)[0], [9.0; 4], "one window: window 0 at the same offset (the old MS / GS translation)");
+    let opt = on_gpu(Options { mode: Mode::Mesh(ms.clone()), wave64: true, mem_windows: 2, heap_windows: true, ..Default::default() });
+    let direct = direct_of(&code, &opt).expect("direct mesh translator accepts the split wave64 form");
+    let r = runner::run_in_arena(&direct, &st, &arena).expect("direct mesh heap-window dispatch");
+    assert_eq!((r.raw[0], r.raw[1]), (3, 1), "direct mesh GS_ALLOC_REQ counts");
+    let got: Vec<[f32; 4]> = (0..3).map(|v| std::array::from_fn(|c| f32::from_bits(r.raw[MESH_HEADER + v * vd + c]))).collect();
+    assert_eq!(got, vec![[-1.0, -1.0, 0.0, 1.0], [-1.0, 1.0, 0.0, 1.0], [0.0, -1.0, 0.0, 1.0]], "direct mesh heap form reads window 1");
 }

The diagnostic is uncommitted; I restored the Windows source to the exact head after testing. I did not run the full workspace suite, retail gameplay, driver compile timing, or a graphics VS/PS heap-form test in this check. The mesh check executes the translated compute phase, not the entire on-screen draw pipeline.

Codex (GPT-6) prepared the test-only diagnostic and report; the stated results came from the native Windows machine.

**@⁠WebIdentity1** on GitHub · 2026-11-24 20:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7142916733) Independent RTX 3090 validation of exact head `48e8e801b4211cec5823094d323d0986edb66f49` on native Windows 10 (driver 591.74, Agility SDK 1.620.2). I verified the process environment contained **both** `XCL_DIRECT_DXIL=1` and `XCL_HEAP_WINDOWS=1`, with `XCL_ADAPTER=3090` and `XCL_REQUIRE_GPU=mesh`. Clean tracked source hashes matched before and after (292/292). I saw [the RTX 3070 compute check above](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1714) after my runs; the incremental coverage below is the **direct mesh heap-window GPU path**. - `cargo test --locked -p xcl --lib gpu_direct_memory_windows_from_the_heap -- --test-threads=1 --show-output --nocapture`: **1 passed / 0 failed / 0 ignored**, no skip or timeout. The test runs both direct switch and direct heap forms on the GPU and checks s_load, buffer load/store, global load/store/atomic across two windows. - `cargo test --locked -p xcl --lib gpu_memory_windows_from_the_heap -- --test-threads=1 --show-output --nocapture`: **1 / 0 / 0**, no skip or timeout. With the two variables above, this now selects the direct heap translation instead of the earlier HLSL fallback. - I added a **local, test-only diagnostic** to `gpu_mesh_mode_reads_memory_windows`: call `direct_of` with `Mode::Mesh`, two windows, and `heap_windows=true`; dispatch its compute pass on the GPU and check three positions against window 1's values, with window 0 holding distinct decoys. This passed **1 / 0 / 0**, no skip or timeout. It exercises the direct mesh heap accessor, which the PR's added compute test does not cover. The diagnostic patch SHA-256 is `385d011498809ce48538f79e290e7151b56dc8cdf54a6618421a69be836d8e3d`: ```diff @@ -3229,6 +3229,12 @@ fn gpu_mesh_mode_reads_memory_windows() { assert_eq!(positions(1)[0], [9.0; 4], "one window: window 0 at the same offset (the old MS / GS translation)"); + let opt = on_gpu(Options { mode: Mode::Mesh(ms.clone()), wave64: true, mem_windows: 2, heap_windows: true, ..Default::default() }); + let direct = direct_of(&code, &opt).expect("direct mesh translator accepts the split wave64 form"); + let r = runner::run_in_arena(&direct, &st, &arena).expect("direct mesh heap-window dispatch"); + assert_eq!((r.raw[0], r.raw[1]), (3, 1), "direct mesh GS_ALLOC_REQ counts"); + let got: Vec<[f32; 4]> = (0..3).map(|v| std::array::from_fn(|c| f32::from_bits(r.raw[MESH_HEADER + v * vd + c]))).collect(); + assert_eq!(got, vec![[-1.0, -1.0, 0.0, 1.0], [-1.0, 1.0, 0.0, 1.0], [0.0, -1.0, 0.0, 1.0]], "direct mesh heap form reads window 1"); } ``` The diagnostic is uncommitted; I restored the Windows source to the exact head after testing. I did not run the full workspace suite, retail gameplay, driver compile timing, or a graphics VS/PS heap-form test in this check. The mesh check executes the translated compute phase, not the entire on-screen draw pipeline. Codex (GPT-6) prepared the test-only diagnostic and report; the stated results came from the native Windows machine.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 20:05 UTC · original

Title run with both variables set this time (XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, checked in the log: no 984 KB switch-form DXIL appears, and the heap form was used), RX 7800 XT, release build of this branch:

  • 30 fps until ~131 s, then the same fade stall as on main, title watchdog (+0x23cf683) at 209 s.
  • 288 compute builds, 19.7 MB of DXIL, 353 s of driver time spread over the workers; the longest single build was 33.7 s (it was 144 s with the switch form).

So the heap form shortens the worst driver builds, as the unit test shows, but it does not move the stall. Timed thread dumps at 130/150/170 s show no title thread in a compile. Only a preload worker is in the driver, and the title's threads wait in its own code while DirectStorage runs 2-5k requests per 2 s. I'm now looking at what the title waits on rather than at shaders.

AI use: Claude Code (Claude Opus 5.5) ran the test and wrote this comment.

**@⁠Sr-0w** on GitHub · 2026-11-24 20:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7143037271) Title run with both variables set this time (`XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1`, checked in the log: no 984 KB switch-form DXIL appears, and the heap form was used), RX 7800 XT, release build of this branch: - 30 fps until ~131 s, then the same fade stall as on `main`, title watchdog (`+0x23cf683`) at 209 s. - 288 compute builds, 19.7 MB of DXIL, 353 s of driver time spread over the workers; the longest single build was 33.7 s (it was 144 s with the switch form). So the heap form shortens the worst driver builds, as the unit test shows, but **it does not move the stall**. Timed thread dumps at 130/150/170 s show no title thread in a compile. Only a preload worker is in the driver, and the title's threads wait in its own code while DirectStorage runs 2-5k requests per 2 s. I'm now looking at what the title waits on rather than at shaders. AI use: Claude Code (Claude Opus 5.5) ran the test and wrote this comment.
Author
Owner

@⁠MatyEjsr on GitHub · 2026-11-24 20:12 UTC · original

Tested commit 48e8e801b4211cec5823094d323d0986edb66f49 (PR #1714) on an NVIDIA wave32-only (split-wave64) GPU.

Environment

  • OS: Windows 11 Pro for Workstations (Build 26200)
  • CPU: AMD Ryzen 7 7800X3D 8-Core Processor
  • GPU: NVIDIA GeForce RTX 3090 (24322 MiB VRAM, driver 617.42 / WDDM 32.0.16.1742)
  • RAM: 31.4 GB
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), debug build, DXC 1.9.2602.17 (21d28f72)

Tested

  • cargo build --workspace -j 8: succeeded in 6.11s.
  • cargo test --workspace -j 8 -- --test-threads=8: 859 passed, 0 failed, 42 ignored; 3 SKIPPED:
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
    • heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib memory_windows -- --nocapture: 6 passed, 0 failed, 0 ignored, 0 SKIPPED (0.29s). gpu_direct_memory_windows_from_the_heap and gpu_memory_windows_from_the_heap both pass on the RTX 3090 split-wave64 path, confirming the direct heap-window DXIL is smaller than the switch form and executes identically across both windows.
  • XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 cargo test -p xcl --lib memory_windows -- --nocapture and heap_window: 6 passed + 2 passed, 0 failed, 0 ignored, 0 SKIPPED (0.28s / 0.22s).
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests:: -j 8 -- --test-threads=8: 121 passed, 0 failed, 17 ignored, 2 SKIPPED (no wave64) (4.30s).
  • XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 cargo test -p xcl --lib gpu::dxil:: -j 8 -- --test-threads=8: 80 passed, 0 failed, 1 ignored, 0 SKIPPED (0.48s).
  • XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL_STATS=1 XCL_TRANSLATED_CACHE=0 cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 3 passed, 1 failed, 0 ignored, 0 SKIPPED (0.82s).
    • The 3 live D3D12 hook tests passed on RTX 3090 with 3 sparse VRAM windows + 1 coherent window and heap windows active (zero direct-DXIL fallback lines):
      • async_compute_pso_registers_real_pso_and_not_standin (1864 B DXIL, 0 ms)
      • heap_window_out_of_memory_falls_back_to_the_switch_form (injected heap-window OOM fell back to switch form: 2892 B DXIL, 0 ms)
      • console_wave64_compute_through_the_pso_hook_dispatch_and_read_back (2636 B DXIL, 4 ms; split-wave64 dispatch + readback matched)
    • The 1 failure (offline_compute_pipeline_is_reused_by_a_second_process at crates/xcl/tests/gpu_compute_e2e.rs:114) is pre-existing under XCL_DIRECT_DXIL=1 (reproduces identically without XCL_HEAP_WINDOWS=1) because the test looks for a top-level *.dxil file from dxc::compile_cached rather than translated/v2/.

Review notes

  1. TRANSLATOR_VERSION needs a bump (crates/xcl/src/gpu/dxil/kernel.rs:38): TRANSLATOR_VERSION is still 4, and crates/xcl/build.rs does not hash src/gpu/dxil/*.rs into XCL_TRANSLATOR_SOURCE_ID. Anyone who previously ran with XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 (or =all) cached the HLSL-fallback DXIL under translated/v2/<ident(v4)>/..._<windows|0x100>_<split>.bin and will keep hitting those stale HLSL entries instead of the new direct DXIL heap-window containers until TRANSLATOR_VERSION is bumped to 5.
  2. Consistency note (not a regression): Lw::with_mem clamps w >= n to window 0, matching direct DXIL's existing switch form (hi & 3), whereas the HLSL path rejects out-of-UMA windows (gpu_heap_windows_reject_out_of_uma_aliasing only exercises HLSL). Fine for this PR, just worth noting if direct DXIL later adopts out-of-UMA bounds checks.
  3. PR checks: the PR description check currently fails because the description uses **Test** / **Measured** and plain AI use: instead of the required **Tested** / **AI use** sections, and still needs the main + head xcl-smoke blocks under **Regression run**.

Not tested

  • AMD (native wave64) or Intel GPUs, Linux/Wine, retail title smoke run (scripts/smoke.ps1), XCL_SAMPLE_RPF-gated gpu_pso_e2e tests, and dedicated GPU tests for mesh/VS/PS in the direct heap-window form.

AI use

  • agy with gemini-4-neon-high: reviewed the diff, ran the build and GPU test suites on RTX 3090, and wrote this report.
**@⁠MatyEjsr** on GitHub · 2026-11-24 20:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7143193465) Tested commit `48e8e801b4211cec5823094d323d0986edb66f49` (PR #1714) on an NVIDIA wave32-only (split-wave64) GPU. **Environment** - OS: Windows 11 Pro for Workstations (Build 26200) - CPU: AMD Ryzen 7 7800X3D 8-Core Processor - GPU: NVIDIA GeForce RTX 3090 (24322 MiB VRAM, driver 617.42 / WDDM 32.0.16.1742) - RAM: 31.4 GB - Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), debug build, DXC 1.9.2602.17 (21d28f72) **Tested** - `cargo build --workspace -j 8`: succeeded in 6.11s. - `cargo test --workspace -j 8 -- --test-threads=8`: 859 passed, 0 failed, 42 ignored; 3 `SKIPPED`: - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` - `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib memory_windows -- --nocapture`: 6 passed, 0 failed, 0 ignored, 0 `SKIPPED` (0.29s). `gpu_direct_memory_windows_from_the_heap` and `gpu_memory_windows_from_the_heap` both pass on the RTX 3090 split-wave64 path, confirming the direct heap-window DXIL is smaller than the switch form and executes identically across both windows. - `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 cargo test -p xcl --lib memory_windows -- --nocapture` and `heap_window`: 6 passed + 2 passed, 0 failed, 0 ignored, 0 `SKIPPED` (0.28s / 0.22s). - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests:: -j 8 -- --test-threads=8`: 121 passed, 0 failed, 17 ignored, 2 `SKIPPED` (`no wave64`) (4.30s). - `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 cargo test -p xcl --lib gpu::dxil:: -j 8 -- --test-threads=8`: 80 passed, 0 failed, 1 ignored, 0 `SKIPPED` (0.48s). - `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL_STATS=1 XCL_TRANSLATED_CACHE=0 cargo test -p xcl --test gpu_compute_e2e -- --nocapture`: 3 passed, 1 failed, 0 ignored, 0 `SKIPPED` (0.82s). - The 3 live D3D12 hook tests passed on RTX 3090 with 3 sparse VRAM windows + 1 coherent window and heap windows active (zero direct-DXIL fallback lines): - `async_compute_pso_registers_real_pso_and_not_standin` (1864 B DXIL, 0 ms) - `heap_window_out_of_memory_falls_back_to_the_switch_form` (injected heap-window OOM fell back to switch form: 2892 B DXIL, 0 ms) - `console_wave64_compute_through_the_pso_hook_dispatch_and_read_back` (2636 B DXIL, 4 ms; split-wave64 dispatch + readback matched) - The 1 failure (`offline_compute_pipeline_is_reused_by_a_second_process` at `crates/xcl/tests/gpu_compute_e2e.rs:114`) is pre-existing under `XCL_DIRECT_DXIL=1` (reproduces identically without `XCL_HEAP_WINDOWS=1`) because the test looks for a top-level `*.dxil` file from `dxc::compile_cached` rather than `translated/v2/`. **Review notes** 1. **`TRANSLATOR_VERSION` needs a bump (`crates/xcl/src/gpu/dxil/kernel.rs:38`)**: `TRANSLATOR_VERSION` is still `4`, and `crates/xcl/build.rs` does not hash `src/gpu/dxil/*.rs` into `XCL_TRANSLATOR_SOURCE_ID`. Anyone who previously ran with `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1` (or `=all`) cached the HLSL-fallback DXIL under `translated/v2/<ident(v4)>/..._<windows|0x100>_<split>.bin` and will keep hitting those stale HLSL entries instead of the new direct DXIL heap-window containers until `TRANSLATOR_VERSION` is bumped to `5`. 2. **Consistency note (not a regression)**: `Lw::with_mem` clamps `w >= n` to window 0, matching direct DXIL's existing switch form (`hi & 3`), whereas the HLSL path rejects out-of-UMA windows (`gpu_heap_windows_reject_out_of_uma_aliasing` only exercises HLSL). Fine for this PR, just worth noting if direct DXIL later adopts out-of-UMA bounds checks. 3. **PR checks**: the `PR description` check currently fails because the description uses `**Test**` / `**Measured**` and plain `AI use:` instead of the required `**Tested**` / `**AI use**` sections, and still needs the `main` + head `xcl-smoke` blocks under `**Regression run**`. **Not tested** - AMD (native wave64) or Intel GPUs, Linux/Wine, retail title smoke run (`scripts/smoke.ps1`), `XCL_SAMPLE_RPF`-gated `gpu_pso_e2e` tests, and dedicated GPU tests for mesh/VS/PS in the direct heap-window form. **AI use** - agy with gemini-4-neon-high: reviewed the diff, ran the build and GPU test suites on RTX 3090, and wrote this report.
Author
Owner

@⁠thiagocalile on GitHub · 2026-11-24 20:27 UTC · original

Tested commit 48e8e801b4211cec5823094d323d0986edb66f49 on an AMD Radeon RX 6600 (RDNA2, native 64-lane waves): all targeted tests passed.

Tested

  • Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, RDNA2, native wave64 + mesh shaders, driver 32.0.21045.29003; XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11, debug build.
  • XCL_ADAPTER=radeon cargo test -p xcl --lib gpu::dxil -- --test-threads=4: 80 passed, 0 failed, 1 ignored (27.55s).
  • XCL_ADAPTER=radeon XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, 0 ignored (42.71s).
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 856 passed, 3 failed, 42 ignored (38.3s).
    • The 3 workspace failures are pre-existing on main on this RX 6600 (placed_title_textures_share_vram_and_preserve_pixels: 3D mip subresource mismatch, plus 2 mutex-poison cascades transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory; tracked by #1028).
    • SKIPPED (not counted as coverage): heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows (plus D3D12 debug-layer tests skip because d3d12SDKLayers.dll is not installed).

Not tested

  • Retail title run (scripts/smoke.ps1 — no game executable here), D3D12 debug layer, NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Antigravity (Gemini 4 Neon) ran the test suites on my RX 6600 and drafted this report; I checked the results before posting.
**@⁠thiagocalile** on GitHub · 2026-11-24 20:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7143568467) Tested commit `48e8e801b4211cec5823094d323d0986edb66f49` on an AMD Radeon RX 6600 (RDNA2, native 64-lane waves): all targeted tests passed. **Tested** - Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, RDNA2, native wave64 + mesh shaders, driver `32.0.21045.29003`; `XCL_ADAPTER=radeon`), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (`10.0.26200.0`), Rust `1.100.0` (`stable-x86_64-pc-windows-msvc`), DXC `1.8.2502.11`, debug build. - `XCL_ADAPTER=radeon cargo test -p xcl --lib gpu::dxil -- --test-threads=4`: **80 passed, 0 failed, 1 ignored** (`27.55s`). - `XCL_ADAPTER=radeon XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture`: **4 passed, 0 failed, 0 ignored** (`42.71s`). - `XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4`: **856 passed, 3 failed, 42 ignored** (`38.3s`). - The 3 workspace failures are pre-existing on `main` on this RX 6600 (`placed_title_textures_share_vram_and_preserve_pixels`: 3D mip subresource mismatch, plus 2 mutex-poison cascades `transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory`; tracked by #1028). - `SKIPPED` (not counted as coverage): `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` (plus D3D12 debug-layer tests skip because `d3d12SDKLayers.dll` is not installed). **Not tested** - Retail title run (`scripts/smoke.ps1` — no game executable here), D3D12 debug layer, NVIDIA / Intel GPUs, Linux / Wine. **AI use** - Antigravity (Gemini 4 Neon) ran the test suites on my RX 6600 and drafted this report; I checked the results before posting.
Author
Owner

@⁠ivall on GitHub · 2026-11-24 20:50 UTC · original

Closing this: #1693, which is merged, added heap memory windows to the direct DXIL path, so this now conflicts with main and duplicates it (group D45 in #1607). If something here is still missing on main, a small follow-up PR on top of it is very welcome. Your title run in this thread, with the point that the heap form does not move the stall, stays useful.

This says nothing about the quality of the code here. If this PR covers a case the other one does not, say so and I'll reopen it.

Thank you for the work.

AI use: Claude Code (Claude Opus 5.5) read the diffs and the checks in #1607 and wrote this comment, on the maintainer's behalf.

**@⁠ivall** on GitHub · 2026-11-24 20:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7144121990) Closing this: #1693, which is merged, added heap memory windows to the direct DXIL path, so this now conflicts with `main` and duplicates it (group D45 in #1607). If something here is still missing on `main`, a small follow-up PR on top of it is very welcome. Your title run in this thread, with the point that the heap form does not move the stall, stays useful. This says nothing about the quality of the code here. If this PR covers a case the other one does not, say so and I'll reopen it. Thank you for the work. AI use: Claude Code (Claude Opus 5.5) read the diffs and the checks in #1607 and wrote this comment, on the maintainer's behalf.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 22:18 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main (multiple files in gpu/dxil/ and gpu/recomp/tests.rs) — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-24 22:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1714#issuecomment-7146076528) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** (multiple files in `gpu/dxil/` and `gpu/recomp/tests.rs`) — needs a rebase before it can be tested.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.