D3D12.X: shaders that index the heaps themselves get the heaps' addresses #1803

Open
github-bot wants to merge 1 commit from github-bot/gh-1803 into main AGit
Owner

@⁠veyn-sudo on GitHub · 2026-11-24 20:55 UTC · original
veyn-sudo:pr/heap-addresses → main · +81 −6 · 4 files · 1 commits · open

A root signature with CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED (0x400) or SAMPLER_HEAP_DIRECTLY_INDEXED (0x800) has the console pass the 32-bit address of the bound view heap / sampler heap in user SGPRs after the root arguments, the view heap's first. XCL left these registers 0, so shaders that index the heaps themselves read their descriptors from address 0 on. On a retail title this showed as a flickering line at the top of the loading pictures: they ask for a clamping sampler and got a wrapping one.

What is in it

  • console_list.rs: the root signature's two flags in Layout::heaps; with_heaps appends the addresses after the arguments; unit test
  • console_heap.rs: base, the 32-bit address of a heap's slots
  • bind.rs, list_x.rs: SetDescriptorHeaps remembers the heaps' addresses per list (reset by Reset / ClearState), and draws and dispatches pass them

Tested

  • RTX 2070 SUPER (driver 617.14), i7-9700K, Windows 11 (26300), Rust 1.99.0; tests in debug, title in release
  • cargo test --workspace -- --test-threads=4: 892 passed, 0 failed, 42 ignored (run on the same tree; only the commit message was reworded after it). SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
  • new test heap_addresses_follow_the_arguments
  • registers, measured on the retail title: 110 of 153 root signatures at its first screen have a flag. All 540 built compute shaders with such a signature (218 view heap, 3 sampler heap, 319 both) have exactly one user SGPR more per flag than their arguments take. Pixel shaders, by where m0 comes from: 49,572 pipelines with 0x800 fit; with 0x400 204 fit and 102 do not take m0 from after the arguments
  • loading pictures: flickering line in 32 of 72 captured frames before and 0 of 98 after (both on my local branch with other changes), 0 of 21 with this change on b9b6ea6

Regression run

main:

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1578 (PresentX 1578)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15220 MB

PR:

xcl-smoke v1
commit: cb0075140a4eaf38b3d5b3a67727241d97e5ddb2
gpu: NVIDIA GeForce RTX 2070 SUPER
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1567 (PresentX 1567)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15209 MB

Not tested

  • AMD, Intel and other NVIDIA GPUs
  • pixel shaders with both flags, and arguments that overflow the registers into memory
  • dispatches replayed from recorded console command words (console_list.rs) are unchanged: they still get no heap addresses
  • the 60 s regression runs do not reach the loading pictures or the world

AI use

  • Claude Code with Claude Opus 5.5 found the cause, wrote the code, the test, the measurements and this description, and ran the tests

🤖 Generated with Claude Code

**@⁠veyn-sudo** on GitHub · 2026-11-24 20:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803) `veyn-sudo:pr/heap-addresses` → `main` · +81 −6 · 4 files · 1 commits · open A root signature with `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` (0x400) or `SAMPLER_HEAP_DIRECTLY_INDEXED` (0x800) has the console pass the 32-bit address of the bound view heap / sampler heap in user SGPRs after the root arguments, the view heap's first. XCL left these registers 0, so shaders that index the heaps themselves read their descriptors from address 0 on. On a retail title this showed as a flickering line at the top of the loading pictures: they ask for a clamping sampler and got a wrapping one. **What is in it** - `console_list.rs`: the root signature's two flags in `Layout::heaps`; `with_heaps` appends the addresses after the arguments; unit test - `console_heap.rs`: `base`, the 32-bit address of a heap's slots - `bind.rs`, `list_x.rs`: `SetDescriptorHeaps` remembers the heaps' addresses per list (reset by Reset / ClearState), and draws and dispatches pass them **Tested** - RTX 2070 SUPER (driver 617.14), i7-9700K, Windows 11 (26300), Rust 1.99.0; tests in debug, title in release - `cargo test --workspace -- --test-threads=4`: 892 passed, 0 failed, 42 ignored (run on the same tree; only the commit message was reworded after it). SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - new test `heap_addresses_follow_the_arguments` - registers, measured on the retail title: 110 of 153 root signatures at its first screen have a flag. All 540 built compute shaders with such a signature (218 view heap, 3 sampler heap, 319 both) have exactly one user SGPR more per flag than their arguments take. Pixel shaders, by where m0 comes from: 49,572 pipelines with 0x800 fit; with 0x400 204 fit and 102 do not take m0 from after the arguments - loading pictures: flickering line in 32 of 72 captured frames before and 0 of 98 after (both on my local branch with other changes), 0 of 21 with this change on b9b6ea6 **Regression run** main: ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: NVIDIA GeForce RTX 2070 SUPER title: retail-title seconds: 60 exit: 0x0 frames shown: 1578 (PresentX 1578) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15220 MB ``` PR: ``` xcl-smoke v1 commit: cb0075140a4eaf38b3d5b3a67727241d97e5ddb2 gpu: NVIDIA GeForce RTX 2070 SUPER title: retail-title seconds: 60 exit: 0x0 frames shown: 1567 (PresentX 1567) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15209 MB ``` **Not tested** - AMD, Intel and other NVIDIA GPUs - pixel shaders with both flags, and arguments that overflow the registers into memory - dispatches replayed from recorded console command words (`console_list.rs`) are unchanged: they still get no heap addresses - the 60 s regression runs do not reach the loading pictures or the world **AI use** - Claude Code with Claude Opus 5.5 found the cause, wrote the code, the test, the measurements and this description, and ran the tests 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A root signature with CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED or SAMPLER_HEAP_DIRECTLY_INDEXED has the
console put the 32-bit address of the bound view heap / sampler heap into user SGPRs after the
root arguments, the view heap's first. XCL left these registers 0, so the shaders read their
descriptors from address 0 on.

Measured on a retail title: 110 of 153 root signatures at its first screen have one of the flags.
All 540 of its compute shaders with such a root signature that were built (218 with the view heap
flag, 3 with the sampler heap flag, 319 with both) have exactly one user SGPR more per flag than
their arguments take; those with both load T# from the first. The pixel shaders of 49 572 pipelines with the
sampler flag have one more as well (by where their m0 comes from). The pictures of its loading screen took a wrapping sampler
instead of the clamping one they ask for: a flickering line at their top edge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:05:44 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 21:31 UTC · original · edited 2026-11-24 22:20 UTC

Full-suite run, since this PR has no test report yet. Tested exact head cb00751 (on its base 4178e88).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, 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 pso_measurement_compiles_an_exact_synthetic_record: 890 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: heap_addresses_follow_the_arguments.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 892 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (#1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and there pso_measurement_compiles_an_exact_synthetic_record ran and passed.

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-24 21:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7145053606) · edited 2026-11-24 22:20 UTC Full-suite run, since this PR has no test report yet. Tested exact head `cb00751` (on its base `4178e88`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, 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 pso_measurement_compiles_an_exact_synthetic_record`: **890 passed, 0 failed, 42 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `heap_addresses_follow_the_arguments`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **892 passed, 0 failed, 42 ignored**. SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - Two tests were skipped with `--skip` on NVIDIA. Both fail on main `7f7e768` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns their skips into failures. `heap_window_out_of_memory_falls_back_to_the_switch_form` skips when `XCL_HEAP_WINDOWS` is unset (#1651), and `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` skipped because Developer Mode was off. Developer Mode was turned on before the AMD run, and there `pso_measurement_compiles_an_exact_synthetic_record` ran and passed. **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

@⁠Raul-Paiva on GitHub · 2026-11-24 23:25 UTC · original

An independent confirmation of the cause, from a world-load compute shader, and one result on a world-loading run with this PR. Counts only.

Setup: RTX 3070 Laptop 8 GB (32-lane waves, split wave64), driver 32.0.16.2124, i7-11800H, 32 GB RAM, Windows 10 19045, rustc 1.100.0, release. Same retail title as on #1269 (XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1, warm caches).

The registers, measured before this PR (local logging in bind_abi, not part of any PR), on cs a9f2cd53943d5dc4 (WindNew:CS_CopyLatestWindFieldForRenderingWithSmooth), the pipeline XCL_DRED=1 + #1592 names in a world-load page fault at GPU VA 0x0 (#1269, comment 7146340225):

  • the root signature has two parameters, both tables ([Table { at: 0 }, Table { at: 4 }], 8 B inline); the program has 7 user SGPRs (compute_user_sgprs), so s4 and s5 are the tables and s6 is the one past the arguments – as your description says;
  • the program loads T#s with s_load_dwordx8 s[16:23], s[6:7], s3 and s_load_dwordx8 s[32:39], s[6:7], s3, where s3 = 32 × index and the index is read from records of 0x90 bytes in a V# at s4 + 0xc0 (dword at + 0x8c);
  • on main s6 was 0 at both dispatches logged;
  • with s6 set to the address of the view heap the title set (a local stand-in for this PR's with_heaps), the indices in those records (98 and 9838) resolve to well-formed T#s in heap slots (word 0 = PC indices 200 and 21728, 2-D images), so the address is the view heap's start, as in this PR.

This PR in a world-loading run: main 20cf130 + #684, #501, #1592, #1697 + this PR (cb00751, applied as is), plus local logging. Two runs: presents stop at 66.6 s and 67.9 s, then the device is removed (0x887a0007) at 66.7 s and 69.7 s with DRED page fault at GPU VA 0x0 and no partly executed list in the report. The same tree without this PR, one run: removed at 78.3 s, same page fault. With my local stand-in instead of this PR on an older base, the removal also came (93 – 106 s, 3 runs). So this PR fixes the registers, but on this card it does not remove the world-load fault at VA 0x0 – that one has another cause, still open on #1269 – and with 2 runs against 1, I cannot say whether the earlier removal time is due to it.

Not tested: the pixel-shader and sampler-heap halves of the PR; console-list replays; AMD; the full suite on the PR's head (@⁠futurepro62's report above covers it).

AI use: Claude Code (Claude Opus 5.5) ran the builds and runs, read the logs and wrote this comment.

**@⁠Raul-Paiva** on GitHub · 2026-11-24 23:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7147386439) An independent confirmation of the cause, from a world-load compute shader, and one result on a world-loading run with this PR. Counts only. **Setup:** RTX 3070 Laptop 8 GB (32-lane waves, split wave64), driver 32.0.16.2124, i7-11800H, 32 GB RAM, Windows 10 19045, rustc 1.100.0, release. Same retail title as on #1269 (`XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1`, warm caches). **The registers, measured before this PR** (local logging in `bind_abi`, not part of any PR), on `cs a9f2cd53943d5dc4` (`WindNew:CS_CopyLatestWindFieldForRenderingWithSmooth`), the pipeline `XCL_DRED=1` + #1592 names in a world-load page fault at GPU VA 0x0 (#1269, comment 7146340225): - the root signature has two parameters, both tables (`[Table { at: 0 }, Table { at: 4 }]`, 8 B inline); the program has 7 user SGPRs (`compute_user_sgprs`), so s4 and s5 are the tables and s6 is the one past the arguments – as your description says; - the program loads T#s with `s_load_dwordx8 s[16:23], s[6:7], s3` and `s_load_dwordx8 s[32:39], s[6:7], s3`, where `s3 = 32 × index` and the index is read from records of 0x90 bytes in a V# at s4 + 0xc0 (dword at + 0x8c); - on `main` s6 was 0 at both dispatches logged; - with s6 set to the address of the view heap the title set (a local stand-in for this PR's `with_heaps`), the indices in those records (98 and 9838) resolve to well-formed T#s in heap slots (word 0 = PC indices 200 and 21728, 2-D images), so the address is the view heap's start, as in this PR. **This PR in a world-loading run:** `main` `20cf130` + #684, #501, #1592, #1697 + this PR (`cb00751`, applied as is), plus local logging. Two runs: presents stop at 66.6 s and 67.9 s, then the device is removed (`0x887a0007`) at 66.7 s and 69.7 s with `DRED page fault at GPU VA 0x0` and no partly executed list in the report. The same tree without this PR, one run: removed at 78.3 s, same page fault. With my local stand-in instead of this PR on an older base, the removal also came (93 – 106 s, 3 runs). So this PR fixes the registers, but on this card it does not remove the world-load fault at VA 0x0 – that one has another cause, still open on #1269 – and with 2 runs against 1, I cannot say whether the earlier removal time is due to it. **Not tested:** the pixel-shader and sampler-heap halves of the PR; console-list replays; AMD; the full suite on the PR's head (@⁠futurepro62's report above covers it). **AI use:** Claude Code (Claude Opus 5.5) ran the builds and runs, read the logs and wrote this comment.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 00:05 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 00:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7148119840) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. Thanks!
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 04:33 UTC · original

XCL PR #1803 verification

Head cb0075140a4eaf38b3d5b3a67727241d97e5ddb2. The detached checkout was clean before and after testing.

STOR-WINLAB ran Windows x64 build 10.0.26200.9974 on an AMD x64 CPU (family 23, model 113) with an Intel Arc A770 and driver 32.0.101.9175. The suite log confirms A770 selection. DXC 1.9.2609.5 was pinned and verified with dxc.exe --version. Rust was 1.100.0 (0ef1bc386 2026-11-09), stable-x86_64-pc-windows-msvc.

Tested

  • cargo build --workspace succeeded and cargo test --workspace --no-run built 19 test executables. Both ran outside the Arc mutex with unoptimized profiles, debug info disabled, and incremental compilation off.
  • cargo test -p xcl --lib hle::d3d12x::console_list::tests::heap_addresses_follow_the_arguments -- --exact ran outside the mutex with XCL_ADAPTER=NONE_CPU_ONLY. 1 passed, 0 failed, 0 ignored, 0 skipped. The test verifies one address per direct-indexing flag after the root arguments, view before sampler when both are enabled, and truncation to the compute user-SGPR budget.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once via Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1. Exit 1. All 20 test result: lines (19 binaries and one doctest run) sum to 874 reported passed, 18 failed, 42 ignored. The new test also passed in this run.

Workspace failures and skips

  • 17 library failures. Thirteen reported CreateComputePipelineState error 0x80070057. Four reported mismatches in FMA contraction, implicit-LOD sampling, packed f16 lane preservation, and wave64 pixel reductions.
  • One e2e failure. The bundled test title’s RSSetDepthBiasX check read blue where it expected green.
  • Seven exact SKIPPED lines: no wave64 (2), tiled tier below 2 (1), driver-cache control unavailable (1), D3D12 debug tooling unavailable (2), and no heap windows (1). All seven appear among the 874 reported passes and provide no coverage.

Not tested

Matched main baseline, retail-title smoke run, or dedicated GPU validation of the direct-indexing heap-address path. This run cannot establish whether the workspace failures also occur on main.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1803-suite.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 04:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7152951330) # XCL PR #1803 verification Head `cb0075140a4eaf38b3d5b3a67727241d97e5ddb2`. The detached checkout was clean before and after testing. STOR-WINLAB ran Windows x64 build `10.0.26200.9974` on an AMD x64 CPU (family 23, model 113) with an Intel Arc A770 and driver `32.0.101.9175`. The suite log confirms A770 selection. DXC `1.9.2609.5` was pinned and verified with `dxc.exe --version`. Rust was `1.100.0 (0ef1bc386 2026-11-09)`, `stable-x86_64-pc-windows-msvc`. **Tested** - `cargo build --workspace` succeeded and `cargo test --workspace --no-run` built 19 test executables. Both ran outside the Arc mutex with unoptimized profiles, debug info disabled, and incremental compilation off. - `cargo test -p xcl --lib hle::d3d12x::console_list::tests::heap_addresses_follow_the_arguments -- --exact` ran outside the mutex with `XCL_ADAPTER=NONE_CPU_ONLY`. **1 passed, 0 failed, 0 ignored, 0 skipped.** The test verifies one address per direct-indexing flag after the root arguments, view before sampler when both are enabled, and truncation to the compute user-SGPR budget. - `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once via `Invoke-ArcTest.ps1` with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`. Exit 1. All 20 `test result:` lines (19 binaries and one doctest run) sum to **874 reported passed, 18 failed, 42 ignored**. The new test also passed in this run. **Workspace failures and skips** - 17 library failures. Thirteen reported `CreateComputePipelineState` error `0x80070057`. Four reported mismatches in FMA contraction, implicit-LOD sampling, packed f16 lane preservation, and wave64 pixel reductions. - One `e2e` failure. The bundled test title’s `RSSetDepthBiasX` check read blue where it expected green. - Seven exact `SKIPPED ` lines: no wave64 (2), tiled tier below 2 (1), driver-cache control unavailable (1), D3D12 debug tooling unavailable (2), and no heap windows (1). All seven appear among the 874 reported passes and provide no coverage. **Not tested** Matched `main` baseline, retail-title smoke run, or dedicated GPU validation of the direct-indexing heap-address path. This run cannot establish whether the workspace failures also occur on `main`. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1803-suite.log` and published.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 10:25 UTC · original

Thanks for checking it independently. Two things that may save you time:

  • The parser exists as a PR now: #2217. gpu::xbox::root_layout(fssm, stage) reads the two tables with every offset and count bounds-checked and returns, per stage, the root slots (type, first user-data dword, SGPR count) and the user-data dwords of the view-heap and sampler-heap entries when the stage has them; xcl disasm prints them under each stage. It changes no binding or translation, so it should not get in your way: build on it, or lift the function into this PR if that is simpler for you, whichever you prefer.
  • On our sets differing (your 0 mesh stages with a sampler-heap entry and no view-heap entry, against my 128): my counts are over every hardware stage of every FSSM block of every container in the pack, not the first block of each container, and not matched by name. That alone could account for it, but I have not checked which containers my 128 come from. With #2217 xcl disasm <container> shows the entries, so the two decodes can be compared on a given container if you tell me one where yours finds no such stage.

Offline only, as before (a decoder over the pack, plus the unit tests and the suite on #2217); nothing here was run in the title.

AI use: Claude Code (Claude Fable 5.2) wrote this reply.

**@⁠CharlyRien** on GitHub · 2026-11-25 10:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7159679095) Thanks for checking it independently. Two things that may save you time: - **The parser exists as a PR now: #2217.** `gpu::xbox::root_layout(fssm, stage)` reads the two tables with every offset and count bounds-checked and returns, per stage, the root slots (type, first user-data dword, SGPR count) and the user-data dwords of the view-heap and sampler-heap entries when the stage has them; `xcl disasm` prints them under each stage. It changes no binding or translation, so it should not get in your way: build on it, or lift the function into this PR if that is simpler for you, whichever you prefer. - **On our sets differing** (your 0 mesh stages with a sampler-heap entry and no view-heap entry, against my 128): my counts are over every hardware stage of every FSSM block of every container in the pack, not the first block of each container, and not matched by name. That alone could account for it, but I have not checked which containers my 128 come from. With #2217 `xcl disasm <container>` shows the entries, so the two decodes can be compared on a given container if you tell me one where yours finds no such stage. Offline only, as before (a decoder over the pack, plus the unit tests and the suite on #2217); nothing here was run in the title. **AI use**: Claude Code (Claude Fable 5.2) wrote this reply.
Author
Owner

@⁠veyn-sudo on GitHub · 2026-11-25 10:27 UTC · original

@⁠CharlyRien thanks. Our comments crossed: you answered the first version of mine, which was wrong, and I had just replaced it with a measurement (above).

In short: in the title, 10,000 (shader, root signature) pairs at pipeline creation had no mismatch between your table and the root signature's flags, the 1,095 sampler-only ones included. So the flags are enough for what I measured, and I won't lift #2217 into this PR. If a pipeline turns up where they differ, the table is the way to go.

On the sets: yours is right that sampler-only mesh stages exist. The run has 115 such MS / AS pairs; my pack decoding only took the first FSSM block of containers it could match by name and missed them. No need to compare containers for that.

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

**@⁠veyn-sudo** on GitHub · 2026-11-25 10:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7159710909) @⁠CharlyRien thanks. Our comments crossed: you answered the first version of mine, which was wrong, and I had just replaced it with a measurement ([above](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1803)). In short: in the title, 10,000 (shader, root signature) pairs at pipeline creation had no mismatch between your table and the root signature's flags, the 1,095 sampler-only ones included. So the flags are enough for what I measured, and I won't lift #2217 into this PR. If a pipeline turns up where they differ, the table is the way to go. On the sets: yours is right that sampler-only mesh stages exist. The run has 115 such MS / AS pairs; my pack decoding only took the first FSSM block of containers it could match by name and missed them. No need to compare containers for that. AI use: Claude Code (Claude Opus 5.5) wrote this.
Author
Owner

@⁠veyn-sudo on GitHub · 2026-11-25 10:14 UTC · original · edited 2026-11-25 10:28 UTC

Correction: my first version of this comment said the flags alone aren't enough. A run of the title says they are, so I'm leaving the PR as it is.

I compared each stage's table with the flags of the root signature its pipeline is created with, at every pipeline creation in the first 75 s of the title: no mismatch. At the last count that was 10,000 distinct (shader, root signature) pairs:

pairs sampler heap only
CS 2,734 7
VS 1,069 234
PS (with a VS) 2,085 637
MS / AS 2,162 115
PS (mesh pipelines) 1,950 102

So the stages that use only the sampler heap are real, mesh ones included (my pack decoding missed those), but their root signatures have only the sampler flag: VS and PS of a pipeline agree too. In every pair with a heap entry, the arguments also end where the PR puts the addresses.

This ran on a local tree with the PR merged and other changes (RTX 2070 SUPER, release, 1.0.2.1), not on the PR's head. Not covered: pipelines created later than that, other titles, and any FSSM block after the first of a container (some VS have two). The 102 pixel pipelines in the description that don't take m0 from after their arguments are not explained by this.

AI use: Claude Code (Claude Opus 5.5) wrote the check, ran it and wrote this.

**@⁠veyn-sudo** on GitHub · 2026-11-25 10:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7159422405) · edited 2026-11-25 10:28 UTC **Correction:** my first version of this comment said the flags alone aren't enough. A run of the title says they are, so I'm leaving the PR as it is. I compared each stage's table with the flags of the root signature its pipeline is created with, at every pipeline creation in the first 75 s of the title: no mismatch. At the last count that was 10,000 distinct (shader, root signature) pairs: | | pairs | sampler heap only | |---|---|---| | CS | 2,734 | 7 | | VS | 1,069 | 234 | | PS (with a VS) | 2,085 | 637 | | MS / AS | 2,162 | 115 | | PS (mesh pipelines) | 1,950 | 102 | So the stages that use only the sampler heap are real, mesh ones included (my pack decoding missed those), but their root signatures have only the sampler flag: VS and PS of a pipeline agree too. In every pair with a heap entry, the arguments also end where the PR puts the addresses. This ran on a local tree with the PR merged and other changes (RTX 2070 SUPER, release, 1.0.2.1), not on the PR's head. Not covered: pipelines created later than that, other titles, and any FSSM block after the first of a container (some VS have two). The 102 pixel pipelines in the description that don't take m0 from after their arguments are not explained by this. AI use: Claude Code (Claude Opus 5.5) wrote the check, ran it and wrote this.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 05:01 UTC · original · edited 2026-11-25 10:31 UTC

Correction (25 Nov, after the in-title check in #1803): the claim below that the flag rule gets sampler-only stages wrong does not hold in the title. It was an inference, not a measurement: the pack holds stages, not pipelines, and I assumed such a stage could be bound under a root signature that has both flags. Measured at pipeline creation over 10,000 (shader, root signature) pairs, those stages come with root signatures that have only the sampler flag, and the VS and PS of a pipeline agree. So the headline's second half, the third point's conclusion and the fourth point are withdrawn. The format, the counts and the other points are unchanged. Original comment follows, unedited.


The console container states, per stage, which heap bases a shader wants and in which user-data dword. Decoded offline for every stage of the retail title's shader pack, it confirms this PR's placement, and points at one case the flag rule gets wrong: stages that use only the sampler heap.

The format (a 20-byte entry per root slot / range in a table the stage record points to, with types 5 = view-heap base and 6 = sampler-heap base) is written up in #724. No run of the title is behind this comment; it is a Python decoder over the pack, checked against disassembly for a few programs.

  • Confirms: wherever a stage has heap entries they come right after its last root argument, view heap first, sampler heap next when both are present. 0 exceptions. 91 % of all stages have at least one (62 % of the compute programs, all but 23 of the mesh stages).
  • Compute: the table's end equals the USER_SGPR count XCL reads, for every compute program, which matches your "exactly one user SGPR more per flag".
  • The case the flags miss: 1 735 stages have a sampler-heap entry and no view-heap entry (1 176 pixel, 417 vertex, 128 mesh, 10 compute, 2 + 2 others). They expect the sampler-heap base in the first register after their arguments. Under a root signature that has both flags, with_heaps puts the view heap there. This may be your 102 pixel pipelines that "do not take m0 from after the arguments"; I could not match them offline, because the pack holds stages, not pipelines.
  • VS and PS of one pipeline can differ (one sampler-only, the other both), so one shared placement cannot be right for both; the table gives it per stage.
  • Mesh: the two-pass path (#724 / #2092) needs the same addresses, at dword + 8 (s23 / s24 for the title's most common mesh layout).

Not tested: any of this in the title; ES / GS registers (only compute and mesh were checked against code).

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the decoder and the counts) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 05:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7153373203) · edited 2026-11-25 10:31 UTC **Correction (25 Nov, after the in-title check in https://git.gtahub.st/github/xcl-dev--xcl/pulls/1803):** the claim below that the flag rule gets sampler-only stages wrong does not hold in the title. It was an inference, not a measurement: the pack holds stages, not pipelines, and I assumed such a stage could be bound under a root signature that has both flags. Measured at pipeline creation over 10,000 (shader, root signature) pairs, those stages come with root signatures that have only the sampler flag, and the VS and PS of a pipeline agree. So the headline's second half, the third point's conclusion and the fourth point are withdrawn. The format, the counts and the other points are unchanged. Original comment follows, unedited. --- **The console container states, per stage, which heap bases a shader wants and in which user-data dword. Decoded offline for every stage of the retail title's shader pack, it confirms this PR's placement, and points at one case the flag rule gets wrong: stages that use only the sampler heap.** The format (a 20-byte entry per root slot / range in a table the stage record points to, with types 5 = view-heap base and 6 = sampler-heap base) is written up in https://git.gtahub.st/github/xcl-dev--xcl/pulls/724. No run of the title is behind this comment; it is a Python decoder over the pack, checked against disassembly for a few programs. - **Confirms**: wherever a stage has heap entries they come right after its last root argument, view heap first, sampler heap next when both are present. 0 exceptions. 91 % of all stages have at least one (62 % of the compute programs, all but 23 of the mesh stages). - **Compute**: the table's end equals the `USER_SGPR` count XCL reads, for every compute program, which matches your "exactly one user SGPR more per flag". - **The case the flags miss**: 1 735 stages have a sampler-heap entry and no view-heap entry (1 176 pixel, 417 vertex, 128 mesh, 10 compute, 2 + 2 others). They expect the sampler-heap base in the first register after their arguments. Under a root signature that has both flags, `with_heaps` puts the view heap there. This may be your 102 pixel pipelines that "do not take m0 from after the arguments"; I could not match them offline, because the pack holds stages, not pipelines. - **VS and PS** of one pipeline can differ (one sampler-only, the other both), so one shared placement cannot be right for both; the table gives it per stage. - **Mesh**: the two-pass path (#724 / #2092) needs the same addresses, at dword + 8 (`s23` / `s24` for the title's most common mesh layout). Not tested: any of this in the title; ES / GS registers (only compute and mesh were checked against code). **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the decoder and the counts) did this and drafted the comment.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 10:31 UTC · original

@⁠veyn-sudo understood, and thanks for running it: that settles the point I raised.

The sampler-only stages exist, but I only had the pack (stages, no pipelines) and assumed one could be bound under a root signature with both flags. Your 10,000 pairs show that does not happen where you measured, and that the VS and PS of a pipeline agree, which I had also guessed wrong. I have put a correction at the top of my earlier comment so that nobody reads it as an open objection to this PR. Nothing to change here from my side.

#2217 stays what its description says: a xcl disasm aid that changes no binding. It is not needed for this PR. Your check is also the first in-title confirmation that the table's type-5 / type-6 entries mean what the decoder says, which is useful to know for that parser.

No run of mine is behind this reply.

AI use: Claude Code (Claude Fable 5.2) wrote this reply.

**@⁠CharlyRien** on GitHub · 2026-11-25 10:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7159815058) @⁠veyn-sudo understood, and thanks for running it: that settles the point I raised. The sampler-only stages exist, but I only had the pack (stages, no pipelines) and assumed one could be bound under a root signature with both flags. Your 10,000 pairs show that does not happen where you measured, and that the VS and PS of a pipeline agree, which I had also guessed wrong. I have put a correction at the top of [my earlier comment](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1803) so that nobody reads it as an open objection to this PR. Nothing to change here from my side. #2217 stays what its description says: a `xcl disasm` aid that changes no binding. It is not needed for this PR. Your check is also the first in-title confirmation that the table's type-5 / type-6 entries mean what the decoder says, which is useful to know for that parser. No run of mine is behind this reply. **AI use**: Claude Code (Claude Fable 5.2) wrote this reply.
Author
Owner

@⁠Gevroska on GitHub · 2026-11-25 14:01 UTC · original · edited 2026-11-25 15:23 UTC

I checked what happens to the guest descriptor-heap bases when a command list changes state. I ran five standalone Rust CPU cases against the clean merge preview of cb007514 with main at 06c9f550, which includes #929. All five passed.

  • Replacing a view-only binding with a sampler-only binding cleared the old view base. Replacing it again with a view-only binding cleared the sampler base. An empty binding cleared both.
  • Reset and ClearState both cleared the guest bases. ClearState preserved the allocator and recording storage.
  • A split copied the source bases over stale values in a reused backing list. Clearing the continuation left the primary untouched until copy-back, which then cleared the primary’s stale bases too.

This covers the guest state used by ordinary translated draws and dispatches. Native wrapper execution, GPU descriptor reads, and any effect on title loading remain unverified. I used Codex GPT-6.2 Sol for the fixture and a separate GPT-6.2 Sol agent at high reasoning to verify the source and results.

I reviewed and approved this comment before posting.

**@⁠Gevroska** on GitHub · 2026-11-25 14:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7164638367) · edited 2026-11-25 15:23 UTC I checked what happens to the guest descriptor-heap bases when a command list changes state. I ran five standalone Rust CPU cases against the clean merge preview of `cb007514` with main at `06c9f550`, which includes #929. All five passed. - Replacing a view-only binding with a sampler-only binding cleared the old view base. Replacing it again with a view-only binding cleared the sampler base. An empty binding cleared both. - `Reset` and `ClearState` both cleared the guest bases. `ClearState` preserved the allocator and recording storage. - A split copied the source bases over stale values in a reused backing list. Clearing the continuation left the primary untouched until copy-back, which then cleared the primary’s stale bases too. This covers the guest state used by ordinary translated draws and dispatches. Native wrapper execution, GPU descriptor reads, and any effect on title loading remain unverified. I used Codex GPT-6.2 Sol for the fixture and a separate GPT-6.2 Sol agent at high reasoning to verify the source and results. I reviewed and approved this comment before posting.
Author
Owner

@⁠Gevroska on GitHub · 2026-11-25 15:22 UTC · original · edited 2026-11-25 15:23 UTC

Following up on my CPU tests, I ran GTA VI on Windows with an RTX 3080 to check whether this change affected what appeared on screen during loading. I compared stock 06c9f550 with the same revision plus PR head cb007514. Each build ran once for 300 seconds with the same scripted inputs and a fresh XCL shader cache. I ran stock first. Both runs shared the NVIDIA driver cache.

Both builds reached loading. In all four captures from each run, the center of the screen stayed uniformly gray while frames were still being presented. The last interval with any presents ended about 66 seconds after loading began in both runs. Stock then recorded 50 seconds with zero presents, and the PR build recorded 52 seconds. Both exited cleanly. I saw no open-world scene in either run.

On this setup, adding #1803 alone didn’t visibly advance loading. I couldn’t verify whether the title exercised the changed descriptor-heap binding path during that interval, so the run leaves its effect on GPU descriptor reads open.

I used Codex GPT-6.2 Sol to run the comparison and a separate GPT-6.2 Sol agent at high reasoning to independently verify the build revisions, timings, and capture measurements.

I reviewed and approved this comment before posting.

**@⁠Gevroska** on GitHub · 2026-11-25 15:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1803#issuecomment-7166741913) · edited 2026-11-25 15:23 UTC Following up on my CPU tests, I ran GTA VI on Windows with an RTX 3080 to check whether this change affected what appeared on screen during loading. I compared stock `06c9f550` with the same revision plus PR head `cb007514`. Each build ran once for 300 seconds with the same scripted inputs and a fresh XCL shader cache. I ran stock first. Both runs shared the NVIDIA driver cache. Both builds reached loading. In all four captures from each run, the center of the screen stayed uniformly gray while frames were still being presented. The last interval with any presents ended about 66 seconds after loading began in both runs. Stock then recorded 50 seconds with zero presents, and the PR build recorded 52 seconds. Both exited cleanly. I saw no open-world scene in either run. On this setup, adding #1803 alone didn’t visibly advance loading. I couldn’t verify whether the title exercised the changed descriptor-heap binding path during that interval, so the run leaves its effect on GPU descriptor reads open. I used Codex GPT-6.2 Sol to run the comparison and a separate GPT-6.2 Sol agent at high reasoning to independently verify the build revisions, timings, and capture measurements. I reviewed and approved this comment before posting.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1803/head:github-bot/gh-1803'
git switch 'github-bot/gh-1803'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1803'
git switch 'github-bot/gh-1803'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1803'
git switch 'github-bot/gh-1803'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1803'
git switch 'main'
git merge --squash 'github-bot/gh-1803'
git switch 'main'
git merge --ff-only 'github-bot/gh-1803'
git switch 'main'
git merge 'github-bot/gh-1803'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.