Skip to content

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

Merged
brcly merged 1 commit into
brcly:mainfrom
Kayotic1337:fix/direct-indexed-tabled-compute
Nov 27, 2026
Merged

brcly merged 1 commit into
brcly:mainfrom
Kayotic1337:fix/direct-indexed-tabled-compute

Conversation

@Kayotic1337

Copy link
Copy Markdown
Contributor

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

…ex map

A compute root with descriptor tables and CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED
kept the guest root when its tables matched, so once descriptors were paged
every dispatch was skipped ("its root indexes the resource heap directly").
Its program can still pick resources by heap index, so it now takes the
index map like a bindless root, when the map's root SRV still fits.

Lanes: `bindless-table-compute` runs the `bindless-compute` program under
such a root in the `lanes-bindless-compute` suite. It fails without this
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NickStallman

Copy link
Copy Markdown
Contributor

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 d3d12: give direct-indexed compute roots with tables the resource index map #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.

@ReverendOzmund

Copy link
Copy Markdown
Contributor

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

@NickStallman

Copy link
Copy Markdown
Contributor

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants