d3d12: give direct-indexed compute roots with tables the resource index map #294

Merged
Kayotic1337 merged 1 commit from upstream-pr/294 into main 2026-11-27 02:54:58 +00:00
Kayotic1337 commented 2026-11-27 02:41:22 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-27T02:41:22Z.


Summary

A compute root that has descriptor tables and CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED got no resource index map. #235 adds the map only for roots without tables (bindless_compute_root). When every table binding matched the guest's, reflected_root returned TableLayout::Original. With a descriptor arena active, paged_layout_gap then skipped every dispatch of such a pipeline:

skipped compute dispatch: pipeline has no paged descriptor layout: its root indexes the resource heap directly

The program can still pick resources by heap index, so it needs the map just like a bindless root. In the simple/extended compute branch of reflected_root, a root with the flag now sets the index map the same way #235 does (scalar_index = Some((0, 0)), visibility ALL). The translator already emits tb_heap_index lookups whenever the root carries the map's SRV.

The map's root SRV needs two of the root's 64 DWORDs. As in #235, a root without room keeps the guest root rather than failing to serialize (heap_indexed_tabled_root: a table costs one DWORD, a root descriptor two).

Draws are not changed: raster roots with the flag still go through the existing pixel-stage scalar-index path.

Verified on Lanes

New scenario bindless-table-compute: the bindless-compute program (raw UAV store at logical heap slot 80) under a direct-indexed root that also has a bound table of four UAVs the program does not read. It runs in lanes-bindless-compute with the roomy and the constrained (64 resident) heap.

  • Without the change: FAIL lanes-bindless-table-compute-wide / -constrained, with the skip line above in the log. The four existing bindless trials pass.

  • With the change: all six trials pass, no skipped dispatch, and the receipt finds bound paged resource descriptor index map.

  • python tuxbox.py check passed on this branch

  • Changed behaviour is covered by a Lanes scenario (bindless-table-compute)

GPU, driver and backend: AMD Radeon RX 9070 XT, Mesa 26.3.1 (RADV), GE-Proton11-14, kernel 7.3.6.

  • This changes code both vendors run. NVIDIA still needs to run it.
Summary
  passed   Build the shader compiler (8s)
  passed   Python tests (3s)
  passed   Shader compiler tests (4s)
  passed   DXBC tests (0s)
  passed   XG layout tests (1s)
  passed   D3D12 Windows typecheck (0s)
  passed   Build (18s)
  passed   Lanes and fixtures on the GPU (184s)
  passed   D3D12 regression controls (82s)
  passed   Shader translator on the GPU (280s)

All checks passed.

Unit test: tabled_compute_roots_that_index_the_heap_take_the_index_map (run with the Windows test binary under Wine: 2/2 in compute_table).

In ProjectScarlett (not evidence, for context)

This does not fix the AMD intro fault of #232 on its own. With this change plus #258 (vkd3d-proton master 71cae091), the story intro still ends in a gfx ring timeout. The amdgpu devcoredump of that hang shows the same fault as before the change: Faulty page starting at address: 0x0, status 0x601431 (SQC data read, permission fault). In that run the kernel log only showed the ring timeout, not the fault. Some compute dispatches are still skipped with the same reason, because their roots fall outside the simple/extended shapes (more tables, or tables after constants), and draws are still skipped too. Any of those may leave the data the faulting read depends on unwritten. This PR only removes the skip for the shape it covers.

Related: #232, #235, #215, #289.

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5520253606 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/294). Originally posted by [Kayotic1337](https://github.com/Kayotic1337) on 2026-11-27T02:41:22Z. --- ## Summary A compute root that has descriptor tables **and** `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` got no resource index map. #235 adds the map only for roots without tables (`bindless_compute_root`). When every table binding matched the guest's, `reflected_root` returned `TableLayout::Original`. With a descriptor arena active, `paged_layout_gap` then skipped every dispatch of such a pipeline: ``` skipped compute dispatch: pipeline has no paged descriptor layout: its root indexes the resource heap directly ``` The program can still pick resources by heap index, so it needs the map just like a bindless root. In the simple/extended compute branch of `reflected_root`, a root with the flag now sets the index map the same way #235 does (`scalar_index = Some((0, 0))`, visibility ALL). The translator already emits `tb_heap_index` lookups whenever the root carries the map's SRV. The map's root SRV needs two of the root's 64 DWORDs. As in #235, a root without room keeps the guest root rather than failing to serialize (`heap_indexed_tabled_root`: a table costs one DWORD, a root descriptor two). Draws are not changed: raster roots with the flag still go through the existing pixel-stage scalar-index path. ## Verified on Lanes New scenario `bindless-table-compute`: the `bindless-compute` program (raw UAV store at logical heap slot 80) under a direct-indexed root that also has a bound table of four UAVs the program does not read. It runs in `lanes-bindless-compute` with the roomy and the constrained (64 resident) heap. - Without the change: `FAIL lanes-bindless-table-compute-wide` / `-constrained`, with the skip line above in the log. The four existing bindless trials pass. - With the change: all six trials pass, no skipped dispatch, and the receipt finds `bound paged resource descriptor index map`. - [x] `python tuxbox.py check` passed on this branch - [x] Changed behaviour is covered by a Lanes scenario (`bindless-table-compute`) GPU, driver and backend: AMD Radeon RX 9070 XT, Mesa 26.3.1 (RADV), GE-Proton11-14, kernel 7.3.6. - [ ] This changes code both vendors run. **NVIDIA still needs to run it.** ```text Summary passed Build the shader compiler (8s) passed Python tests (3s) passed Shader compiler tests (4s) passed DXBC tests (0s) passed XG layout tests (1s) passed D3D12 Windows typecheck (0s) passed Build (18s) passed Lanes and fixtures on the GPU (184s) passed D3D12 regression controls (82s) passed Shader translator on the GPU (280s) All checks passed. ``` Unit test: `tabled_compute_roots_that_index_the_heap_take_the_index_map` (run with the Windows test binary under Wine: 2/2 in `compute_table`). ## In ProjectScarlett (not evidence, for context) This does **not** fix the AMD intro fault of #232 on its own. With this change plus #258 (vkd3d-proton master 71cae091), the story intro still ends in a gfx ring timeout. The amdgpu devcoredump of that hang shows the same fault as before the change: `Faulty page starting at address: 0x0`, status `0x601431` (SQC data read, permission fault). In that run the kernel log only showed the ring timeout, not the fault. Some compute dispatches are still skipped with the same reason, because their roots fall outside the simple/extended shapes (more tables, or tables after constants), and draws are still skipped too. Any of those may leave the data the faulting read depends on unwritten. This PR only removes the skip for the shape it covers. Related: #232, #235, #215, #289. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
NickStallman commented 2026-11-27 02:50:24 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T02:50:24Z.


This matches what I measured on the RTX 5090 in #232: the culling chain is skipped with exactly that message. One thing to check before it lands: the translator drops a compute root's root constants when the runtime appends a private root SRV.

sampler_heap::constants, and the dispatch-ID register calculation, find the compute root's constants by matching the root's exact parameter count. With the index map's SRV (or the stride table's) appended after the guest parameters, the count no longer matches. The root-constant cbuffer and its register loads are then left out, so those registers read 0.

  • On main today this already hits 127 recorded ProjectScarlett requests through the stride-table path, 123 of them CS_RaytracingResolve. In one resolve kernel the dropped constants feed an index multiply and a mode select.
  • With #294, the roots it gives the map to are mostly table, table, constants or table, constants (the *_BatchCull and BatchCullMeshlets* programs, and CS_DistanceWindowEmissivesCulling), so they would dispatch with zeroed constants. The new bindless-table-compute scenario's root has no constants, so it can't show this.

The fix is a translator change that ignores trailing space-32766 root SRVs when matching the guest root. It's on fix/xshader-root-constants-private-srv, with a test that fails at run time on main. Over 25,397 recorded requests, 127 change: each only regains its constant cbuffer. Nothing else changes and there are no regressions. Its AMD check passed; I'll open it as a PR once the NVIDIA check is done, shortly.

I'm also running this PR's full check on NVIDIA (RTX 5090) and will post the result here.

<!-- greyfinch-sync:brcly/TuxBox:comment:7208480471 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/294#issuecomment-7208480471). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T02:50:24Z. --- This matches what I measured on the RTX 5090 in #232: the culling chain is skipped with exactly that message. One thing to check before it lands: the translator drops a compute root's **root constants** when the runtime appends a private root SRV. `sampler_heap::constants`, and the dispatch-ID register calculation, find the compute root's constants by matching the root's exact parameter count. With the index map's SRV (or the stride table's) appended after the guest parameters, the count no longer matches. The root-constant cbuffer and its register loads are then left out, so those registers read 0. - **On `main` today** this already hits 127 recorded ProjectScarlett requests through the stride-table path, 123 of them `CS_RaytracingResolve`. In one resolve kernel the dropped constants feed an index multiply and a mode select. - **With #294**, the roots it gives the map to are mostly `table, table, constants` or `table, constants` (the `*_BatchCull` and `BatchCullMeshlets*` programs, and `CS_DistanceWindowEmissivesCulling`), so they would dispatch with zeroed constants. The new `bindless-table-compute` scenario's root has no constants, so it can't show this. The fix is a translator change that ignores trailing space-32766 root SRVs when matching the guest root. It's on [`fix/xshader-root-constants-private-srv`](https://github.com/NickStallman/TuxBox/tree/fix/xshader-root-constants-private-srv), with a test that fails at run time on `main`. Over 25,397 recorded requests, 127 change: each only regains its constant cbuffer. Nothing else changes and there are no regressions. Its AMD check passed; I'll open it as a PR once the NVIDIA check is done, shortly. I'm also running this PR's full check on NVIDIA (RTX 5090) and will post the result here.
ReverendOzmund commented 2026-11-27 03:12:22 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by ReverendOzmund on 2026-11-27T03:12:22Z.


Confirming on NVIDIA after the merge: tuxbox.py check passed on an RTX 3080 Ti (driver 620.70.06, GE-Proton11-14, Bazzite) against 341a9fd. That includes both bindless-table-compute scenarios and the other bindless and descriptor-reclaim ones. I didn't run the regression controls or translator checks, since I don't have Windows DXC set up. Results attached.
results.json

<!-- greyfinch-sync:brcly/TuxBox:comment:7208793203 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/294#issuecomment-7208793203). Originally posted by [ReverendOzmund](https://github.com/ReverendOzmund) on 2026-11-27T03:12:22Z. --- Confirming on NVIDIA after the merge: `tuxbox.py check` passed on an RTX 3080 Ti (driver 620.70.06, GE-Proton11-14, Bazzite) against 341a9fd. That includes both `bindless-table-compute` scenarios and the other bindless and descriptor-reclaim ones. I didn't run the regression controls or translator checks, since I don't have Windows DXC set up. Results attached. [results.json](https://github.com/user-attachments/files/35493772/results.json)
NickStallman commented 2026-11-27 03:19:57 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T03:19:57Z.


The root-constants fix is now #296: full checks passed on AMD (RADV) and NVIDIA (RTX 5090), 132 gates each. With #294 on its own, the culling programs it unblocks would dispatch with zeroed root constants; with #296 they keep them. The NVIDIA run of this PR's head is queued here and I'll post it when it's done.

<!-- greyfinch-sync:brcly/TuxBox:comment:7208899129 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/294#issuecomment-7208899129). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T03:19:57Z. --- The root-constants fix is now #296: full checks passed on AMD (RADV) and NVIDIA (RTX 5090), 132 gates each. With #294 on its own, the culling programs it unblocks would dispatch with zeroed root constants; with #296 they keep them. The NVIDIA run of this PR's head is queued here and I'll post it when it's done.
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!294
No description provided.