Recompiler: heap memory windows start after a null descriptor pair #1992

Manually merged
github merged 3 commits from gh-pr/1992/head into gh-pr/1992/base 2026-11-26 05:13:34 +00:00
Owner

@⁠bmjask on GitHub · 2026-11-25 00:28 UTC · original
bmjask:fix/heap-window-hang → main · +67 −4 · 4 files · 3 commits · merged 2026-11-25 01:58 UTC

With heap memory windows on (XCL_HEAP_WINDOWS=1), window k was raw UAV k of the shared descriptor heap (MEM_HEAP_BASE = 0). A T# of zeros (an empty console slot) has PC descriptor index 0 in word 0, so an image access through it read descriptor 0/1 – the 4 GiB raw buffer view of a memory window – as a texture. The windows now start at descriptor 4, and descriptors 0..3 hold null SRV / UAV views, so a zero T# reads zeros. Translator version 8 → 9 (new cache keys).

This is hardening found while investigating a GPU hang of a retail title with direct DXIL + heap windows; it does not fix that hang (the compute queue still stops at the same point), which is being bisected separately.

What is in it

  • recomp::MEM_HEAP_BASE = 4; the HLSL and direct DXIL heap lookups use it; console_heap writes null SRV/UAV views at descriptors 0..3.
  • Test zero_tsharp_does_not_reach_window_views; gpu_memory_windows_from_the_heap expects the new base.

Tested

  • hardware: NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), i9-12900K, rustc 1.100.0, debug (tests) / release (smoke)
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 998 passed, 0 failed, 45 ignored (after rebasing on 7994cd1)

Regression run
D:\xcl-worktrees\<worktree>\scripts\smoke.ps1 -Game 'D:\game' -Xcl D:\xcl-worktrees\<worktree>\target\release\xcl.exe with XCL_PRESS_AT=2:B,4:B,6:B,8:B XCL_PRESS_A_AT=10,15,20,25,30,40 (each worktree's own smoke.ps1; main = D:\xcl-worktrees\main-g14 (main de36462, second run with a warm cache), PR = D:\xcl-worktrees\heap-hang)

main:

xcl-smoke v1
commit: de36462e0b1043b915a418d4591ed1e397622ede
gpu: NVIDIA GeForce RTX 4090
title: 6ca5cab7
seconds: 60
exit: 0x0
frames shown: 1115 (PresentX 1115)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17081 MB
xcl-smoke v1
commit: daf52aba22971d33a5b89f586d10ee87c1c53280
gpu: NVIDIA GeForce RTX 4090
title: 6ca5cab7
seconds: 60
exit: 0x0
frames shown: 1442 (PresentX 1442)
presents per 2 s (last 3): 52 31 41
device removals: 0
crashes: 0
peak commit: 21197 MB

Not tested

  • Heap windows are opt-in; the smoke runs use the default (switch form). With XCL_HEAP_WINDOWS=1 the retail title still hangs at ~90 s (separate issue).
  • AMD / Intel GPUs.

AI use

  • Claude Code (Claude Opus 5.5): found the descriptor overlap, wrote the change and the test, ran the build, tests and regression runs.

🤖 Generated with Claude Code

**@⁠bmjask** on GitHub · 2026-11-25 00:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1992) `bmjask:fix/heap-window-hang` → `main` · +67 −4 · 4 files · 3 commits · merged 2026-11-25 01:58 UTC With heap memory windows on (`XCL_HEAP_WINDOWS=1`), window k was raw UAV `k` of the shared descriptor heap (`MEM_HEAP_BASE` = 0). A T# of zeros (an empty console slot) has PC descriptor index 0 in word 0, so an image access through it read descriptor 0/1 – the 4 GiB raw buffer view of a memory window – as a texture. The windows now start at descriptor 4, and descriptors 0..3 hold null SRV / UAV views, so a zero T# reads zeros. Translator version 8 → 9 (new cache keys). This is hardening found while investigating a GPU hang of a retail title with direct DXIL + heap windows; it does **not** fix that hang (the compute queue still stops at the same point), which is being bisected separately. **What is in it** - `recomp::MEM_HEAP_BASE` = 4; the HLSL and direct DXIL heap lookups use it; `console_heap` writes null SRV/UAV views at descriptors 0..3. - Test `zero_tsharp_does_not_reach_window_views`; `gpu_memory_windows_from_the_heap` expects the new base. **Tested** - hardware: NVIDIA GeForce RTX 4090 (driver 32.0.16.1088), i9-12900K, rustc 1.100.0, debug (tests) / release (smoke) - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: 998 passed, 0 failed, 45 ignored (after rebasing on 7994cd1) **Regression run** `D:\xcl-worktrees\<worktree>\scripts\smoke.ps1 -Game 'D:\game' -Xcl D:\xcl-worktrees\<worktree>\target\release\xcl.exe` with `XCL_PRESS_AT=2:B,4:B,6:B,8:B XCL_PRESS_A_AT=10,15,20,25,30,40` (each worktree's own smoke.ps1; main = `D:\xcl-worktrees\main-g14` (main `de36462`, second run with a warm cache), PR = `D:\xcl-worktrees\heap-hang`) main: ``` xcl-smoke v1 commit: de36462e0b1043b915a418d4591ed1e397622ede gpu: NVIDIA GeForce RTX 4090 title: 6ca5cab7 seconds: 60 exit: 0x0 frames shown: 1115 (PresentX 1115) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17081 MB ``` ``` xcl-smoke v1 commit: daf52aba22971d33a5b89f586d10ee87c1c53280 gpu: NVIDIA GeForce RTX 4090 title: 6ca5cab7 seconds: 60 exit: 0x0 frames shown: 1442 (PresentX 1442) presents per 2 s (last 3): 52 31 41 device removals: 0 crashes: 0 peak commit: 21197 MB ``` **Not tested** - Heap windows are opt-in; the smoke runs use the default (switch form). With `XCL_HEAP_WINDOWS=1` the retail title still hangs at ~90 s (separate issue). - AMD / Intel GPUs. **AI use** - Claude Code (Claude Opus 5.5): found the descriptor overlap, wrote the change and the test, ran the build, tests and regression runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A T# of zeros (an empty console slot) has PC index 0 in word 0, so image
shaders read ResourceDescriptorHeap[0] (SRV) / [1] (UAV). With heap windows
on, MEM_HEAP_BASE was 0: those descriptors were the memory windows' 4 GiB raw
buffer UAVs, read as textures, which hung the GPU (DXGI_ERROR_DEVICE_HUNG).
The windows now start at descriptor 4, and descriptors 0..4 of the shared
heap hold null SRV / UAV views. Translator version bumped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:32 +00:00
github manually merged commit daf52aba22 into gh-pr/1992/base 2026-11-26 05:13:34 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 01:06 UTC · original

AMD RDNA3 (RX 7800 XT, native wave64) test report for #1992 at 5db5b1d1 merged with main 2e1c9562 (clean merge). Note: the PR head moved to daf52aba (rebase + translator version 8 → 9) after this run finished; I did not rerun on daf52aba.

Tested

  • AMD Radeon RX 7800 XT 16 GB (RDNA3, native wave64, driver 32.0.31035.1003), Ryzen 7 5700X3D, 64 GB RAM, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11 (Windows Kits\10\bin\10.0.26100.0\x64), debug build, XCL_ADAPTER="RX 7800 XT".
  • Targeted runs (all passed, 0 failed, 0 skipped):
    • cargo test -p xcl --lib zero_tsharp_does_not_reach_window_views -- --nocapture: 1 passed, 0 failed (0.00s)
    • cargo test -p xcl --lib gpu_memory_windows_from_the_heap -- --nocapture: 1 passed, 0 failed (0.26s)
    • XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, 0 skipped (1.84s; heap_window_out_of_memory_falls_back_to_the_switch_form ran and passed with heap windows enabled)
  • Full workspace (cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture): 1001 passed, 1 failed, 45 ignored across 20 test binaries.
    • The 1 failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: res[30] = 0x1, CPU 0x7fffffff). Verified directly on origin/main 2e1c9562 on the same RX 7800 XT: it fails identically there (pre-existing on main, unrelated to this PR).
    • SKIPPED lines (7): the 6 intentional #1426 per-lane refusals in gpu::recomp::lower_dxil::tests (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32, wave32 and wave64) plus heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows (when XCL_HEAP_WINDOWS is unset). Zero no wave64 skips.

Not tested

  • Rebased head daf52aba, release build, scripts/smoke.ps1 title run, or a title run with XCL_HEAP_WINDOWS=1.

AI use

  • T3 Code (Antigravity), Gemini 4 Neon: checked out 5db5b1d1 in a temporary worktree, ran the targeted and workspace tests on @⁠oni-swr's machine, and wrote this report.
**@⁠oni-swr** on GitHub · 2026-11-25 01:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1992#issuecomment-7149206769) AMD RDNA3 (RX 7800 XT, native wave64) test report for #1992 at `5db5b1d1` merged with `main` `2e1c9562` (clean merge). Note: the PR head moved to `daf52aba` (rebase + translator version 8 → 9) after this run finished; I did not rerun on `daf52aba`. **Tested** - AMD Radeon RX 7800 XT 16 GB (RDNA3, native wave64, driver 32.0.31035.1003), Ryzen 7 5700X3D, 64 GB RAM, Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11 (`Windows Kits\10\bin\10.0.26100.0\x64`), debug build, `XCL_ADAPTER="RX 7800 XT"`. - Targeted runs (all passed, 0 failed, 0 skipped): - `cargo test -p xcl --lib zero_tsharp_does_not_reach_window_views -- --nocapture`: 1 passed, 0 failed (0.00s) - `cargo test -p xcl --lib gpu_memory_windows_from_the_heap -- --nocapture`: 1 passed, 0 failed (0.26s) - `XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture`: **4 passed, 0 failed, 0 skipped** (1.84s; `heap_window_out_of_memory_falls_back_to_the_switch_form` ran and passed with heap windows enabled) - Full workspace (`cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture`): **1001 passed, 1 failed, 45 ignored** across 20 test binaries. - The 1 failure is `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (`seed 722: res[30] = 0x1, CPU 0x7fffffff`). Verified directly on `origin/main` `2e1c9562` on the same RX 7800 XT: it fails identically there (pre-existing on `main`, unrelated to this PR). - `SKIPPED` lines (7): the 6 intentional `#1426` per-lane refusals in `gpu::recomp::lower_dxil::tests` (`V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`, wave32 and wave64) plus `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` (when `XCL_HEAP_WINDOWS` is unset). Zero `no wave64` skips. **Not tested** - Rebased head `daf52aba`, release build, `scripts/smoke.ps1` title run, or a title run with `XCL_HEAP_WINDOWS=1`. **AI use** - T3 Code (Antigravity), Gemini 4 Neon: checked out `5db5b1d1` in a temporary worktree, ran the targeted and workspace tests on @⁠oni-swr's machine, and wrote this report.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:08 UTC · original

Build and test and PR description are green on 5db5b1d.

Remaining before merge:

  1. Rebase onto main (dropping the manual TRANSLATOR_VERSION = 8 bump in kernel.rs, since #1950 took 8 and #1947 now auto-hashes gpu/dxil sources).
  2. One independent AMD GPU run (current test coverage is NVIDIA RTX 4090 only).
**@⁠raylitebull** on GitHub · 2026-11-25 01:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/1992#issuecomment-7149240608) `Build and test` and `PR description` are green on `5db5b1d`. **Remaining before merge:** 1. Rebase onto `main` (dropping the manual `TRANSLATOR_VERSION = 8` bump in `kernel.rs`, since `#1950` took `8` and `#1947` now auto-hashes `gpu/dxil` sources). 2. One independent **AMD** GPU run (current test coverage is NVIDIA RTX 4090 only).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 01:02 UTC · original · edited 2026-11-25 01:22 UTC

Full-suite run, since this PR has no test report yet. Tested exact head daf52ab (on its base 7994cd1).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 987 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: zero_tsharp_does_not_reach_window_views.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 997 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 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))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-25 01:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1992#issuecomment-7149136869) · edited 2026-11-25 01:22 UTC Full-suite run, since this PR has no test report yet. Tested exact head `daf52ab` (on its base `7994cd1`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **987 passed, 0 failed, 43 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `zero_tsharp_does_not_reach_window_views`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **997 passed, 0 failed, 45 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `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))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `7994cd1` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests and `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/1651)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:42 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1992#issuecomment-7152169872) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.