d3d12: consume descriptor tables at draws and dispatches #512

Merged
MathiewMay merged 2 commits from upstream-pr/512 into main 2026-11-29 21:07:48 +00:00
MathiewMay commented 2026-11-29 18:15:08 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by MathiewMay on 2026-11-29T18:15:08Z.


Summary

Bind descriptor tables as logical bases and allocate, pin and materialize records at the command that actually consumes them. Binding alone must not consume an unused table or its declared tail. Preserve corroborated shader footprints even when compute or raster roots already match, including compute pipeline streams; replay logical bindings after native-list splits.

Inline scene descriptors are materialized independently at their actual offset. Native ray dispatch and bundle consumers retain conservative declared-span validation. Unknown metadata stays conservative. Ordinary invalid consumers are skipped without dropping later work or queue-label writes; actual pin exhaustion still makes Close fail with E_OUTOFMEMORY. Stand-ins do not inherit the original shader's corroborated footprint.

Regression proof and validation

Results are for 81d7efab3c16cf47ff07914e66f90d4bc810fd33 on upstream fd636d09153029330260c4fccff77fb147c81fa5.

  • Five new GPU scenarios pass: rewritten compute, unchanged-root compute, compute streams, rewritten raster, and already-matching raster. Tests cover the heap tail, pipeline selection before/after table binding, pipeline changes without rebinding, and list replay. Compute cases compare the entire output/guard buffer; raster cases compare every pixel.
  • Strict matched control: all five fail when only the native D3D12 provider is replaced with pristine upstream. The three compute cases fail descriptor-tail output or guard differs; both raster cases fail texel 0,0 is 0. Guests, fixtures, compiler helpers and every other provider are identical and SHA-checked. This is not a compile/setup failure.
  • Negative controls deliberately consume an out-of-range or poisoned record, then require a later label and a smaller valid dispatch to complete without rebinding. Unused table bindings also must preserve labels.
  • python tuxbox.py check --no-gpu: all seven groups pass, using an isolated candidate Cargo target. Windows cargo check ... --tests also passes.
  • Full translator GPU suite: 65/65 groups pass.
  • Full homebrew/Lanes verification: 131/131 checks pass, including both descriptor-reclamation profiles and their unsubmitted pin-exhaustion checks.
  • D3D12 provider regression controls: 22/22 pass.
  • Native D3D12 unit tests: 409 passed, 1 failed, 8 ignored. Pristine upstream is 406 passed, 1 failed, 8 ignored. Both fail the unchanged device::placement::check_pool::tests::check_chunk_runs_xmem_access_only_on_caller_thread assertion (left: 128, right: 64). This baseline failure is not counted as a passing native suite.

Commands below use placeholders for immutable, source/helper/provider-SHA-bound local artifacts. Wrappers run sequentially in an authenticated hidden/offline display using the stopped fixture prefix; no prefix copies, cache/save replacement or retail launch:

python tuxbox.py check --no-gpu
cargo check --locked --offline --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --tests
python "$MEASURE/run_latest_verify.py" "$ARTIFACT" "$TARGET_WORK" lanes-descriptor-tail
python "$MEASURE/run_latest_verify.py" "$MATCHED_MAIN_D3D12_ARTIFACT" "$RED_WORK" lanes-descriptor-tail
python "$MEASURE/run_latest_translator.py" "$ARTIFACT" "$TRANSLATOR_WORK"
python "$MEASURE/run_latest_verify.py" "$ARTIFACT" "$VERIFY_WORK"
python "$MEASURE/run_latest_regressions.py" "$ARTIFACT" "$REGRESSION_WORK"
python "$MEASURE/run_windows_reuse.py" --unit tuxbox_d3d12 "$ARTIFACT" "$UNIT_WORK"
python "$MEASURE/run_windows_reuse.py" --unit tuxbox_d3d12 "$MAIN_ARTIFACT" "$MAIN_UNIT_WORK"

GPU/backend: AMD Radeon RX 9070 (1002:7550, RADV GFX1201), Mesa 26.2.7, GE-Proton11-14 on Linux. NVIDIA validation is still missing and required before merge. No title shaders, captures or diagnostics are included; this PR makes no retail performance or complete scene/AS-ordering claim.

Additional all-three integration on refreshed main

A separate combined run of #512, #514 and #518 on 2d6dc33838f66c0784d539567628c07158351115 (private integration 08c5a6bf) used new per-artifact compiled targets. It is not an isolated run of this PR. All 7 code groups, 16 targeted checks, 66 translator groups, 133 homebrew checks and 22 provider controls pass. Swapping only D3D12 back to that clean main gives exactly seven expected descriptor/mirror reference-readback failures, while nine other targeted controls pass.

Native results are 449 passed / 4 failed / 8 ignored, versus pristine refreshed main's 431 passed / 4 failed / 8 ignored. The exact failure sets match; neither native suite is described as passing:

  • device::placement::check_pool::tests::check_chunk_collects_all_changes_and_merges_profile — 128 vs 64.
  • device::placement::check_pool::tests::check_chunk_reuses_cached_runs_and_retries_active_mapping_state — 32 vs 0.
  • device::placement::check_pool::tests::check_chunk_runs_xmem_access_only_on_caller_thread — 128 vs 64.
  • device::placement::guest_read::tests::section_watched_texture_caches_runs_and_invalidates_on_watch_or_mapping_change — 0 vs 1.

The first combined provider-control attempt stopped after one passing case because newer main requires its constant-buffer helper to be prebuilt. Building bash tools/build_frosty_cbv_layer.sh build/frosty-cbv-layer from the frozen sources into new private build output, without replacing a prior helper or changing frozen sources, made a fresh complete 22/22 run pass. The full native scene-capable runner then verified the four-failure baseline match. NVIDIA remains untested.

<!-- greyfinch-sync:brcly/TuxBox:issue:5553640258 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/512). Originally posted by [MathiewMay](https://github.com/MathiewMay) on 2026-11-29T18:15:08Z. --- ## Summary Bind descriptor tables as logical bases and allocate, pin and materialize records at the command that actually consumes them. Binding alone must not consume an unused table or its declared tail. Preserve corroborated shader footprints even when compute or raster roots already match, including compute pipeline streams; replay logical bindings after native-list splits. Inline scene descriptors are materialized independently at their actual offset. Native ray dispatch and bundle consumers retain conservative declared-span validation. Unknown metadata stays conservative. Ordinary invalid consumers are skipped without dropping later work or queue-label writes; actual pin exhaustion still makes `Close` fail with `E_OUTOFMEMORY`. Stand-ins do not inherit the original shader's corroborated footprint. ## Regression proof and validation Results are for `81d7efab3c16cf47ff07914e66f90d4bc810fd33` on upstream `fd636d09153029330260c4fccff77fb147c81fa5`. - **Five new GPU scenarios pass**: rewritten compute, unchanged-root compute, compute streams, rewritten raster, and already-matching raster. Tests cover the heap tail, pipeline selection before/after table binding, pipeline changes without rebinding, and list replay. Compute cases compare the entire output/guard buffer; raster cases compare every pixel. - **Strict matched control: all five fail** when only the native D3D12 provider is replaced with pristine upstream. The three compute cases fail `descriptor-tail output or guard differs`; both raster cases fail `texel 0,0 is 0`. Guests, fixtures, compiler helpers and every other provider are identical and SHA-checked. This is not a compile/setup failure. - Negative controls deliberately consume an out-of-range or poisoned record, then require a later label and a smaller valid dispatch to complete without rebinding. Unused table bindings also must preserve labels. - `python tuxbox.py check --no-gpu`: **all seven groups pass**, using an isolated candidate Cargo target. Windows `cargo check ... --tests` also passes. - Full translator GPU suite: **65/65 groups pass**. - Full homebrew/Lanes verification: **131/131 checks pass**, including both descriptor-reclamation profiles and their unsubmitted pin-exhaustion checks. - D3D12 provider regression controls: **22/22 pass**. - Native D3D12 unit tests: **409 passed, 1 failed, 8 ignored**. Pristine upstream is **406 passed, 1 failed, 8 ignored**. Both fail the unchanged `device::placement::check_pool::tests::check_chunk_runs_xmem_access_only_on_caller_thread` assertion (`left: 128`, `right: 64`). This baseline failure is not counted as a passing native suite. Commands below use placeholders for immutable, source/helper/provider-SHA-bound local artifacts. Wrappers run sequentially in an authenticated hidden/offline display using the stopped fixture prefix; no prefix copies, cache/save replacement or retail launch: ```sh python tuxbox.py check --no-gpu cargo check --locked --offline --target x86_64-pc-windows-msvc -p tuxbox-d3d12 --tests python "$MEASURE/run_latest_verify.py" "$ARTIFACT" "$TARGET_WORK" lanes-descriptor-tail python "$MEASURE/run_latest_verify.py" "$MATCHED_MAIN_D3D12_ARTIFACT" "$RED_WORK" lanes-descriptor-tail python "$MEASURE/run_latest_translator.py" "$ARTIFACT" "$TRANSLATOR_WORK" python "$MEASURE/run_latest_verify.py" "$ARTIFACT" "$VERIFY_WORK" python "$MEASURE/run_latest_regressions.py" "$ARTIFACT" "$REGRESSION_WORK" python "$MEASURE/run_windows_reuse.py" --unit tuxbox_d3d12 "$ARTIFACT" "$UNIT_WORK" python "$MEASURE/run_windows_reuse.py" --unit tuxbox_d3d12 "$MAIN_ARTIFACT" "$MAIN_UNIT_WORK" ``` GPU/backend: AMD Radeon RX 9070 (`1002:7550`, RADV GFX1201), Mesa 26.2.7, GE-Proton11-14 on Linux. **NVIDIA validation is still missing and required before merge.** No title shaders, captures or diagnostics are included; this PR makes no retail performance or complete scene/AS-ordering claim. ## Additional all-three integration on refreshed main A separate **combined** run of #512, #514 and #518 on `2d6dc33838f66c0784d539567628c07158351115` (private integration `08c5a6bf`) used new per-artifact compiled targets. It is not an isolated run of this PR. All **7 code groups, 16 targeted checks, 66 translator groups, 133 homebrew checks and 22 provider controls pass**. Swapping only D3D12 back to that clean main gives **exactly seven expected descriptor/mirror reference-readback failures**, while nine other targeted controls pass. Native results are **449 passed / 4 failed / 8 ignored**, versus pristine refreshed main's **431 passed / 4 failed / 8 ignored**. The exact failure sets match; neither native suite is described as passing: - `device::placement::check_pool::tests::check_chunk_collects_all_changes_and_merges_profile` — 128 vs 64. - `device::placement::check_pool::tests::check_chunk_reuses_cached_runs_and_retries_active_mapping_state` — 32 vs 0. - `device::placement::check_pool::tests::check_chunk_runs_xmem_access_only_on_caller_thread` — 128 vs 64. - `device::placement::guest_read::tests::section_watched_texture_caches_runs_and_invalidates_on_watch_or_mapping_change` — 0 vs 1. The first combined provider-control attempt stopped after one passing case because newer main requires its constant-buffer helper to be prebuilt. Building `bash tools/build_frosty_cbv_layer.sh build/frosty-cbv-layer` from the frozen sources into new private build output, without replacing a prior helper or changing frozen sources, made a fresh complete **22/22** run pass. The full native scene-capable runner then verified the four-failure baseline match. NVIDIA remains untested.
NickStallman commented 2026-11-29 19:52:32 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T19:52:32Z.


NVIDIA run: full python tuxbox.py check passes on an RTX 5090 (10de:2b85, 620.70.10, GE-Proton11-14, Linux).

Tree Pass Fail
main 2d6dc338 (control, same card and prefix, just before) 192 0
81d7efab merged into 2d6dc338 (clean merge) 197 0

The five extra are this PR's: lanes-descriptor-tail, -original, -stream, -raster, -raster-original. No GPU errors in the kernel log. windows-dxc was 1.8.2505.1.

Not run: the native D3D12 unit tests (not part of check), the negative control with upstream's provider, and the game. I'm running #514 and #518 the same way next.

<!-- greyfinch-sync:brcly/TuxBox:comment:7261628724 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/512#issuecomment-7261628724). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-29T19:52:32Z. --- NVIDIA run: **full `python tuxbox.py check` passes** on an RTX 5090 (`10de:2b85`, 620.70.10, GE-Proton11-14, Linux). | Tree | Pass | Fail | |---|---|---| | `main` 2d6dc338 (control, same card and prefix, just before) | 192 | 0 | | 81d7efab merged into 2d6dc338 (clean merge) | 197 | 0 | The five extra are this PR's: `lanes-descriptor-tail`, `-original`, `-stream`, `-raster`, `-raster-original`. No GPU errors in the kernel log. `windows-dxc` was 1.8.2505.1. Not run: the native D3D12 unit tests (not part of `check`), the negative control with upstream's provider, and the game. I'm running #514 and #518 the same way next.
DrArroway commented 2026-11-29 21:41:15 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T21:41:15Z.


@MathiewMay Quick follow-up on the 4 device::placement::check_pool / guest_read hardware unit-test failures noted here (and on #514 / #518): they came from #495 (check_sequential clearing WRITTEN in Watch::rearm before checking watch_cacheable(), check_mips_speculative double-digesting first mip uploads, and check_chunk_reuses_cached_runs_and_retries_active_mapping_state not committing digests between calls).

Opened #550 with the fix — tuxbox-d3d12 --lib is back to 435 passed / 0 failed on both RX 6900 XT and AMD Raphael iGPU.

<!-- greyfinch-sync:brcly/TuxBox:comment:7263070785 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/512#issuecomment-7263070785). Originally posted by [DrArroway](https://github.com/DrArroway) on 2026-11-29T21:41:15Z. --- @MathiewMay Quick follow-up on the 4 `device::placement::check_pool` / `guest_read` hardware unit-test failures noted here (and on `#514` / `#518`): they came from `#495` (`check_sequential` clearing `WRITTEN` in `Watch::rearm` before checking `watch_cacheable()`, `check_mips_speculative` double-digesting first mip uploads, and `check_chunk_reuses_cached_runs_and_retries_active_mapping_state` not committing digests between calls). Opened `#550` with the fix — `tuxbox-d3d12 --lib` is back to **435 passed / 0 failed** on both RX 6900 XT and AMD Raphael iGPU.
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!512
No description provided.