d3d12: page bindless compute roots through the resource index map #235

Merged
ReverendOzmund merged 1 commit from upstream-pr/235 into main 2026-11-26 22:58:22 +00:00
ReverendOzmund commented 2026-11-26 14:50:56 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by ReverendOzmund on 2026-11-26T14:50:56Z.


Fixes the skips reported in #232. With descriptor paging active, every dispatch of a compute pipeline whose root is CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED with no descriptor tables (only root constants and root descriptors) was dropped as pipeline has no paged descriptor layout: its root indexes the resource heap directly. On ProjectScarlett those come from guest callers 0x248cbc1, 0x248cd0f, 0x2951ba and 0x56bba. On NickStallman's RTX 5090, 0x248cbc1 and 0x2951ba account for most of the ~1,000 skips per world frame.

Summary

reflected_root only described compute roots with one or two leading tables, or tables followed by constants and descriptors. A table-less bindless root matched neither, so it fell through to Unsupported, got no reflected layout, and the paged path refused it.

  • reflected_root now gives a table-less, heap-indexed compute root a reflected layout: the guest's own parameters unchanged, plus the resource index map as a root SRV at t0, space32766. It's visible to all stages, where the raster form uses pixel only.
  • The translator already reads tb_heap_map when the root carries that SRV (heap_map in setup.rs), so these programs translate as tb_heap_index(i), a guest-to-host lookup, instead of using the guest index directly.
  • with_reflected_table now binds the index map for compute, as it already does for raster. Without an arena it binds the identity map, so behaviour without paging is unchanged.

bindless_compute_roots_have_no_tables_and_index_the_heap covers the root shapes this accepts and the ones it leaves to the existing paths. cargo check --target x86_64-pc-windows-msvc --tests is clean, and build.py d3d12 builds.

Verified on Lanes

  • python tuxbox.py check passed on this branch: not yet
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below

Draft. No Lanes scenario binds a table-less, heap-indexed compute root with paging active yet. I'll add one, but the in-game effect is the real test. NickStallman offered to run it on the 5090 past the story intro, and I'll run it on a 3080 Ti. The number to watch is the skip count from #223's reason text, which should drop to zero for these callers.

GPU, driver and backend: RTX 3080 Ti, 620.70.06, GE-Proton11-14 (build only so far).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KP1nQKEc17PvmrwfPtLi8Z

<!-- greyfinch-sync:brcly/TuxBox:issue:5512204084 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/235). Originally posted by [ReverendOzmund](https://github.com/ReverendOzmund) on 2026-11-26T14:50:56Z. --- Fixes the skips reported in #232. With descriptor paging active, every dispatch of a compute pipeline whose root is CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED with no descriptor tables (only root constants and root descriptors) was dropped as `pipeline has no paged descriptor layout: its root indexes the resource heap directly`. On ProjectScarlett those come from guest callers 0x248cbc1, 0x248cd0f, 0x2951ba and 0x56bba. On NickStallman's RTX 5090, 0x248cbc1 and 0x2951ba account for most of the ~1,000 skips per world frame. ## Summary `reflected_root` only described compute roots with one or two leading tables, or tables followed by constants and descriptors. A table-less bindless root matched neither, so it fell through to `Unsupported`, got no reflected layout, and the paged path refused it. - `reflected_root` now gives a table-less, heap-indexed compute root a reflected layout: the guest's own parameters unchanged, plus the resource index map as a root SRV at t0, space32766. It's visible to all stages, where the raster form uses pixel only. - The translator already reads `tb_heap_map` when the root carries that SRV (`heap_map` in `setup.rs`), so these programs translate as `tb_heap_index(i)`, a guest-to-host lookup, instead of using the guest index directly. - `with_reflected_table` now binds the index map for compute, as it already does for raster. Without an arena it binds the identity map, so behaviour without paging is unchanged. `bindless_compute_roots_have_no_tables_and_index_the_heap` covers the root shapes this accepts and the ones it leaves to the existing paths. `cargo check --target x86_64-pc-windows-msvc --tests` is clean, and `build.py d3d12` builds. ## Verified on Lanes - [ ] `python tuxbox.py check` passed on this branch: not yet - [ ] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below Draft. No Lanes scenario binds a table-less, heap-indexed compute root with paging active yet. I'll add one, but the in-game effect is the real test. NickStallman offered to run it on the 5090 past the story intro, and I'll run it on a 3080 Ti. The number to watch is the skip count from #223's reason text, which should drop to zero for these callers. GPU, driver and backend: RTX 3080 Ti, 620.70.06, GE-Proton11-14 (build only so far). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KP1nQKEc17PvmrwfPtLi8Z
NickStallman commented 2026-11-26 15:54:12 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-26T15:54:12Z.


NVIDIA in-game run with this PR: RTX 5090, driver 595.99.02, GE-Proton11-14. The build was main 3b8a220 plus d49808d, plus an env-gated experiment of mine that stayed inactive (it logged nothing).

ProjectScarlett reached Game Running, with SRL fbk_stry000_FBK_STRY000_INTRO, at frame 2,648 after about 19 minutes.

  • With this PR: 0 skipped compute dispatch: pipeline has no paged descriptor layout. The only skips were 2 draws, its root … at guest caller 0xbff06, which this PR doesn't cover.
  • Earlier run at the same point (#216's head, before #223): 19 rate-limited compute-skip lines, from callers 0x2951ba (11), 0x248cd0f (3), 0x248cdf5 (3), 0x248cbc1 (1) and 0x56bba (1). The counters reached #512.

So on NVIDIA the bindless compute skips are gone. I can't speak to picture correctness yet. The run ended at the intro with a GPU hang, NVRM: Xid 109 … CTX SWITCH TIMEOUT, and the title's watchdog fired 27 s later. That matches #232 and my earlier #216 runs, which hung without this PR, so I don't think this PR causes it.

<!-- greyfinch-sync:brcly/TuxBox:comment:7196906993 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/235#issuecomment-7196906993). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-26T15:54:12Z. --- NVIDIA in-game run with this PR: RTX 5090, driver 595.99.02, GE-Proton11-14. The build was `main` 3b8a220 plus `d49808d`, plus an env-gated experiment of mine that stayed inactive (it logged nothing). ProjectScarlett reached `Game Running`, with SRL `fbk_stry000_FBK_STRY000_INTRO`, at frame 2,648 after about 19 minutes. - **With this PR:** 0 `skipped compute dispatch: pipeline has no paged descriptor layout`. The only skips were 2 draws, `its root …` at guest caller `0xbff06`, which this PR doesn't cover. - **Earlier run at the same point** (#216's head, before #223): 19 rate-limited compute-skip lines, from callers `0x2951ba` (11), `0x248cd0f` (3), `0x248cdf5` (3), `0x248cbc1` (1) and `0x56bba` (1). The counters reached #512. So on NVIDIA the bindless compute skips are gone. I can't speak to picture correctness yet. The run ended at the intro with a GPU hang, `NVRM: Xid 109 … CTX SWITCH TIMEOUT`, and the title's watchdog fired 27 s later. That matches #232 and my earlier #216 runs, which hung without this PR, so I don't think this PR causes it.
NickStallman commented 2026-11-26 16:34:45 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-26T16:34:45Z.


Correction to my comment above. Please disregard it. The run didn't include this PR. The provider DLLs in my game folder were still the ones I'd deployed from #216's head earlier, and tuxbox.py run from another worktree doesn't redeploy them. So "0 compute skips" says nothing about this PR; it was the same runtime as my earlier #216 runs, ending at an earlier point. Sorry for the noise. I'll rerun with this PR's DLLs actually deployed and report back.

<!-- greyfinch-sync:brcly/TuxBox:comment:7197828556 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/235#issuecomment-7197828556). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-26T16:34:45Z. --- **Correction to my comment above. Please disregard it.** The run didn't include this PR. The provider DLLs in my game folder were still the ones I'd deployed from #216's head earlier, and `tuxbox.py run` from another worktree doesn't redeploy them. So "0 compute skips" says nothing about this PR; it was the same runtime as my earlier #216 runs, ending at an earlier point. Sorry for the noise. I'll rerun with this PR's DLLs actually deployed and report back.
brcly commented 2026-11-26 17:11:03 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-26T17:11:03Z.


Thanks, the approach looks right. Reading it merged onto current main (with #241), two things before it can merge. Neither is reproduced; both are from the code.

  1. In create_pipeline_x_inner, the reflected arm falls back to shader_cache::prepared when the rooted translation is refused. For a bindless root that translation has no tb_heap_map, so with paging active it would index the heap with guest indices, where today the dispatch is skipped. Could this case require the rooted translation?
  2. The new bindless arm in reflected_root leaves recovered_samplers empty, so a program with a literal sampler the root lacks no longer reaches sampler_root (#241). Setting recovered_samplers with literal_samplers(shader, 5, &signature) there, as the other compute arm does, should cover it.

It also still needs the full check on AMD and NVIDIA, a Lanes scenario, and the in-game rerun.

<!-- greyfinch-sync:brcly/TuxBox:comment:7198618330 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/235#issuecomment-7198618330). Originally posted by [brcly](https://github.com/brcly) on 2026-11-26T17:11:03Z. --- Thanks, the approach looks right. Reading it merged onto current `main` (with #241), two things before it can merge. Neither is reproduced; both are from the code. 1. In `create_pipeline_x_inner`, the reflected arm falls back to `shader_cache::prepared` when the rooted translation is refused. For a bindless root that translation has no `tb_heap_map`, so with paging active it would index the heap with guest indices, where today the dispatch is skipped. Could this case require the rooted translation? 2. The new bindless arm in `reflected_root` leaves `recovered_samplers` empty, so a program with a literal sampler the root lacks no longer reaches `sampler_root` (#241). Setting `recovered_samplers` with `literal_samplers(shader, 5, &signature)` there, as the other compute arm does, should cover it. It also still needs the full check on AMD and NVIDIA, a Lanes scenario, and the in-game rerun.
DrArroway commented 2026-11-26 17:46:06 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-26T17:46:06Z.


AMD full tuxbox.py check run on PR #235 (d49808d cleanly merged onto main 5c5677b):

  • GPU / driver / backend: AMD Radeon RX 6900 XT (1002:73bf), Mesa RADV 26.3.1, GE-Proton11-14, Windows DXC v1.9.2609, Linux DXC 1.9.2609
  • Lanes and fixtures on the GPU: 72/72 pass
  • D3D12 regression controls: 19/19 pass
  • Shader translator on the GPU: 40/40 pass
Summary
  passed   Build the shader compiler (0s)
  passed   Python tests (3s)
  passed   Shader compiler tests (0s)
  passed   DXBC tests (0s)
  passed   XG layout tests (1s)
  passed   D3D12 Windows typecheck (0s)
  passed   Build (20s)
  passed   Lanes and fixtures on the GPU (170s)
  passed   D3D12 regression controls (85s)
  passed   Shader translator on the GPU (239s)
<!-- greyfinch-sync:brcly/TuxBox:comment:7199609746 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/235#issuecomment-7199609746). Originally posted by [DrArroway](https://github.com/DrArroway) on 2026-11-26T17:46:06Z. --- AMD full `tuxbox.py check` run on PR `#235` (`d49808d` cleanly merged onto `main` `5c5677b`): - **GPU / driver / backend:** AMD Radeon RX 6900 XT (`1002:73bf`), Mesa RADV `26.3.1`, `GE-Proton11-14`, Windows DXC `v1.9.2609`, Linux DXC `1.9.2609` - **Lanes and fixtures on the GPU:** `72/72` pass - **D3D12 regression controls:** `19/19` pass - **Shader translator on the GPU:** `40/40` pass ```text Summary passed Build the shader compiler (0s) passed Python tests (3s) passed Shader compiler tests (0s) passed DXBC tests (0s) passed XG layout tests (1s) passed D3D12 Windows typecheck (0s) passed Build (20s) passed Lanes and fixtures on the GPU (170s) passed D3D12 regression controls (85s) passed Shader translator on the GPU (239s) ```
Valdi320 commented 2026-11-26 22:20:39 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Valdi320 on 2026-11-26T22:20:39Z.


Independent follow-up to the maintainer's review, without changing your PR: github.com/Valdi320/TuxBox@2f7e0f8afc. Merged d49808d onto e76ff6a, prevented prepared/rootless fallback when the reflected compute root has an index map, recovered literal samplers in the bindless arm, and allowed valid zero-parameter roots without constructing a slice from null. Added a Lanes synthetic native RDNA2 shader that writes a raw UAV at logical slot 80. The constrained heap limit is 64; the roomy run also uses an arena (Scarlett device11_queue), so neither is claimed as identity/native-heap coverage. Both RTX 4080 / GE-Proton11-14 runs passed, 1,024 words each including decoys and guards, fresh rooted xshader receipt matches the loaded digest, paged map bound, no stand-ins. Run: python tuxbox.py verify --only lanes-bindless-compute. Rebuilt providers and guest. This is a proposed review patch and focused GPU result, not a full check, literal-sampler-specific GPU proof or retail replay. Feel free to cherry-pick the follow-up commit.

<!-- greyfinch-sync:brcly/TuxBox:comment:7204589806 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/235#issuecomment-7204589806). Originally posted by [Valdi320](https://github.com/Valdi320) on 2026-11-26T22:20:39Z. --- Independent follow-up to the maintainer's review, without changing your PR: https://github.com/Valdi320/TuxBox/tree/2f7e0f8afce97facae22a5552a0075047d8f0384. Merged d49808d onto e76ff6a, prevented prepared/rootless fallback when the reflected compute root has an index map, recovered literal samplers in the bindless arm, and allowed valid zero-parameter roots without constructing a slice from null. Added a Lanes synthetic native RDNA2 shader that writes a raw UAV at logical slot 80. The constrained heap limit is 64; the roomy run also uses an arena (Scarlett device11_queue), so neither is claimed as identity/native-heap coverage. Both RTX 4080 / GE-Proton11-14 runs passed, 1,024 words each including decoys and guards, fresh rooted xshader receipt matches the loaded digest, paged map bound, no stand-ins. Run: python tuxbox.py verify --only lanes-bindless-compute. Rebuilt providers and guest. This is a proposed review patch and focused GPU result, not a full check, literal-sampler-specific GPU proof or retail replay. Feel free to cherry-pick the follow-up commit.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!235
No description provided.