D3D12.X: repack root-changing ExecuteIndirect commands on the GPU #869

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

@⁠utkarshxdev on GitHub · 2026-11-24 07:05 UTC · original
utkarshxdev:root-changing-execute-indirect → main · +584 −28 · 7 files · 1 commits · open

Translated pipelines use XCL's ABI root signature. A title command signature that changes root arguments cannot run with that ABI directly. This patch repacks each command on the GPU so a translated draw or dispatch sees the root values written for that command.

What is in it

  • Track root constant offsets and root buffer descriptors for translated draw, indexed draw, and compute dispatch signatures.
  • Repack commands from UMA or native upload buffers at execution time. Reuse the caller's count buffer and clear affected shadow root values after the call.
  • Add layout coverage and a D3D12 regression test for per-dispatch values and the count buffer. The two-pass mesh execution work is tracked in #724.

Regression run

main (beaa245):

xcl-smoke v1
commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1660)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

this PR (b1d2ab6):

xcl-smoke v1
commit: b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1658 (PresentX 1658)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14859 MB

Tested

  • AMD Radeon RX 9070 XT (RDNA4), Windows 11: cargo test -p xcl --lib hle::d3d12x -- --test-threads=1 passed (116 passed, 0 failed, 1 ignored).
  • Windows 11 x64, RTX 5070 Ti Laptop: scripts/test.ps1 passed (717 passed, 0 failed, 41 ignored).
  • Verified indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_table and gpu_repack_preserves_per_dispatch_values_and_the_count_buffer.
  • Apple Silicon, macOS: git apply --check --whitespace=error-all on upstream beaa245.

Not tested

  • wave32-only GPUs (NVIDIA / Intel); gameplay past the menus.
  • Root-changing mesh dispatch and signatures with indirect vertex or index buffer view changes are outside this patch's scope.

AI use

OpenAI Codex (GPT-6) implemented the patch, added the tests, and verified the changes.

**@⁠utkarshxdev** on GitHub · 2026-11-24 07:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/869) `utkarshxdev:root-changing-execute-indirect` → `main` · +584 −28 · 7 files · 1 commits · open Translated pipelines use XCL's ABI root signature. A title command signature that changes root arguments cannot run with that ABI directly. This patch repacks each command on the GPU so a translated draw or dispatch sees the root values written for that command. **What is in it** - Track root constant offsets and root buffer descriptors for translated draw, indexed draw, and compute dispatch signatures. - Repack commands from UMA or native upload buffers at execution time. Reuse the caller's count buffer and clear affected shadow root values after the call. - Add layout coverage and a D3D12 regression test for per-dispatch values and the count buffer. The two-pass mesh execution work is tracked in #724. **Regression run** main (beaa245): ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1660 (PresentX 1660) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14862 MB ``` this PR (b1d2ab6): ``` xcl-smoke v1 commit: b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1658 (PresentX 1658) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14859 MB ``` **Tested** - AMD Radeon RX 9070 XT (RDNA4), Windows 11: `cargo test -p xcl --lib hle::d3d12x -- --test-threads=1` passed (116 passed, 0 failed, 1 ignored). - Windows 11 x64, RTX 5070 Ti Laptop: `scripts/test.ps1` passed (717 passed, 0 failed, 41 ignored). - Verified `indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_table` and `gpu_repack_preserves_per_dispatch_values_and_the_count_buffer`. - Apple Silicon, macOS: `git apply --check --whitespace=error-all` on upstream `beaa245`. **Not tested** - wave32-only GPUs (NVIDIA / Intel); gameplay past the menus. - Root-changing mesh dispatch and signatures with indirect vertex or index buffer view changes are outside this patch's scope. **AI use** OpenAI Codex (GPT-6) implemented the patch, added the tests, and verified the changes.
Translated pipelines use XCL's ABI root signature and cannot consume a title's root-changing command signature directly. Repack standard draw and dispatch commands on the GPU so each command sees its own root values and the native call retains the count buffer.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:35:11 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-24 07:26 UTC · original

Windows 11 x64 (26200.9974), RTX 5070 Ti Laptop 621.24, Rust 1.97.1 MSVC debug. On the unmodified PR head b1d2ab6, a fresh build directory and scripts/test.ps1 gave 717 passed, 0 failed, 41 ignored. Both new tests passed. Two unrelated GPU tests counted as passed reported SKIPPED (no wave64). An earlier suite run hit the #718 cubemap assertion and its two poisoned-lock failures.

I also varied just the count and expected readback in a separate copy of the compute fixture. With three commands and MaxCommandCount=3, counts 0, 1, 3, and 4 produced [0,0,0,0], [11,0,0,0], [11,16,57,0], and [11,16,57,0] respectively, with no skips. This checks the empty and capped cases for compute. Draw, indexed draw, and retail execution were outside my run.

OpenAI Codex (GPT-6.2 Astra) assisted with verification.

**@⁠ettehn** on GitHub · 2026-11-24 07:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7124989727) Windows 11 x64 (26200.9974), RTX 5070 Ti Laptop 621.24, Rust 1.97.1 MSVC debug. On the unmodified PR head `b1d2ab6`, a fresh build directory and `scripts/test.ps1` gave **717 passed, 0 failed, 41 ignored**. Both new tests passed. Two unrelated GPU tests counted as passed reported SKIPPED (no wave64). An earlier suite run hit the #718 cubemap assertion and its two poisoned-lock failures. I also varied just the count and expected readback in a separate copy of the compute fixture. With three commands and MaxCommandCount=3, counts 0, 1, 3, and 4 produced [0,0,0,0], [11,0,0,0], [11,16,57,0], and [11,16,57,0] respectively, with no skips. This checks the empty and capped cases for compute. Draw, indexed draw, and retail execution were outside my run. OpenAI Codex (GPT-6.2 Astra) assisted with verification.
Author
Owner

@⁠eizispark on GitHub · 2026-11-24 07:35 UTC · original

Hardware check of b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad (verified clean merge with main 1ec4c98): pass.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 714 passed, 3 failed, 41 ignored (GPU tests skipped on this adapter: none); the 3 failures were the known concurrent --test-threads=4 VRAM contention flake in hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels plus two downstream mutex PoisonError cascades (transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory)
  • cargo test -p xcl --lib hle::d3d12x -- --test-threads=1: 116 passed, 0 failed, 1 ignored (GPU tests skipped on this adapter: none)
  • Verified hle::d3d12x::indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_table, hle::d3d12x::indirect::tests::gpu_repack_preserves_per_dispatch_values_and_the_count_buffer, and hle::d3d12x::bind::tests::async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect (ok)

Regression run
main (beaa245):

xcl-smoke v1
commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1660)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

PR (b1d2ab6):

xcl-smoke v1
commit: b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1658 (PresentX 1658)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14859 MB

Not tested

  • wave32-only GPUs (NVIDIA / Intel); gameplay past the menus

AI use

  • Antigravity (Gemini 4 Carbon) ran the build, test suite, and scripts/smoke.ps1 harness on this machine and formatted this report.
**@⁠eizispark** on GitHub · 2026-11-24 07:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7125158364) Hardware check of `b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad` (verified clean merge with `main` `1ec4c98`): **pass**. **Tested** - Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, release + test profile - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `714 passed, 3 failed, 41 ignored` (GPU tests skipped on this adapter: `none`); the 3 failures were the known concurrent `--test-threads=4` VRAM contention flake in `hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels` plus two downstream mutex `PoisonError` cascades (`transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory`) - `cargo test -p xcl --lib hle::d3d12x -- --test-threads=1`: `116 passed, 0 failed, 1 ignored` (GPU tests skipped on this adapter: `none`) - Verified `hle::d3d12x::indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_table`, `hle::d3d12x::indirect::tests::gpu_repack_preserves_per_dispatch_values_and_the_count_buffer`, and `hle::d3d12x::bind::tests::async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect` (`ok`) **Regression run** `main` (`beaa245`): ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1660 (PresentX 1660) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14862 MB ``` PR (`b1d2ab6`): ``` xcl-smoke v1 commit: b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1658 (PresentX 1658) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14859 MB ``` **Not tested** - wave32-only GPUs (NVIDIA / Intel); gameplay past the menus **AI use** - Antigravity (Gemini 4 Carbon) ran the build, test suite, and `scripts/smoke.ps1` harness on this machine and formatted this report.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 07:35 UTC · original

Regression runs for this PR's head b1d2ab6 and for its base main a1672ef, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: a1672ef21c396d8edc9c4b0e3747f671bd40f528
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1641 (PresentX 1641)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17660 MB

this PR:

xcl-smoke v1
commit: b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1645 (PresentX 1645)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17565 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0

Not tested

  • the unit and e2e tests on this machine
  • world loading, where root-changing ExecuteIndirect calls are most likely: a 60 s run stays in the menus, so this is a regression check only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 07:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7125164494) Regression runs for this PR's head `b1d2ab6` and for its base `main` `a1672ef`, on a retail title (same title, 60 s each), made with `scripts/smoke.ps1` (release, clean tree at each commit) and pasted unedited, for **Regression run**. main: ``` xcl-smoke v1 commit: a1672ef21c396d8edc9c4b0e3747f671bd40f528 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1641 (PresentX 1641) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17660 MB ``` this PR: ``` xcl-smoke v1 commit: b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1645 (PresentX 1645) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17565 MB ``` **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0 **Not tested** - the unit and e2e tests on this machine - world loading, where root-changing ExecuteIndirect calls are most likely: a 60 s run stays in the menus, so this is a regression check only Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 07:39 UTC · original

World-loading run to go with the smoke runs above: this PR's head b1d2ab6 merged onto main 1ec4c98 (clean merge), release, XCL_NETWORK=0, A pressed every 4 s from 20 s (XCL_PRESS_A_AT), warm caches, same RTX 3060 12 GB. One run each.

main 1ec4c98 + this PR
world loading from ~55 s ~55 s
frames stop ~80 s ~80 s
title's watchdog (+0x23cf683) 104 s 104 s
Wait64BitValueX timeouts 0 0
device removals 0 0

No regression through world loading, and no change in where this title stops on this machine: it still ends at the watchdog behind slow compute pipeline builds (#156, #754). The log has no line about indirect commands, so I cannot tell from it whether the title took the repack path.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 07:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7125221525) World-loading run to go with the smoke runs above: this PR's head `b1d2ab6` merged onto `main` `1ec4c98` (clean merge), release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s (`XCL_PRESS_A_AT`), warm caches, same RTX 3060 12 GB. One run each. | | `main` `1ec4c98` | + this PR | |---|---|---| | world loading from | ~55 s | ~55 s | | frames stop | ~80 s | ~80 s | | title's watchdog (`+0x23cf683`) | 104 s | 104 s | | `Wait64BitValueX` timeouts | 0 | 0 | | device removals | 0 | 0 | No regression through world loading, and no change in where this title stops on this machine: it still ends at the watchdog behind slow compute pipeline builds (#156, #754). The log has no line about indirect commands, so I cannot tell from it whether the title took the repack path. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠badoomtch on GitHub · 2026-11-24 07:16 UTC · original · edited 2026-11-24 07:40 UTC

Ran the two new tests at b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad on native Windows 11 build 26300, Core Ultra 7 265, Rust 1.96.0 MSVC (debug), DXC 1.8.2502.11. The machine has an RTX 5080 (610.88) and Intel integrated graphics. The upstream fixture uses the default D3D12 device and does not print its adapter name.

cargo test --frozen -p xcl --lib hle::d3d12x::indirect::tests:: -- --nocapture --test-threads=1 — 2 passed, 0 failed, 0 ignored, with no GPU or DXC skip.

The GPU fixture verified the per-dispatch values and count buffer together. It supplied three commands, set the count to two, uploaded the arguments after recording, waited for the fence and read back [11, 16, 0, 0]. The layout test for inline and spilled arguments also passed. Retail loading and the draw and indexed-draw paths remain unverified here.

We also counted successful root-changing signature creations and their indirect calls in two longer Windows runs on our integration based on 1ec4c98cd, without this PR. Both reached the fade after the loading artwork and then the title watchdog. Across the sampled windows, the draw, indexed-draw and dispatch counts were all zero in both runs. This covers the path our title took on this machine. Your repack may still be needed on other paths or by other titles.

AI use: Codex (GPT-6) checked the source revision, ran the tests and drafted this comment.

**@⁠badoomtch** on GitHub · 2026-11-24 07:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7124814159) · edited 2026-11-24 07:40 UTC Ran the two new tests at `b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad` on native Windows 11 build 26300, Core Ultra 7 265, Rust 1.96.0 MSVC (debug), DXC 1.8.2502.11. The machine has an RTX 5080 (610.88) and Intel integrated graphics. The upstream fixture uses the default D3D12 device and does not print its adapter name. `cargo test --frozen -p xcl --lib hle::d3d12x::indirect::tests:: -- --nocapture --test-threads=1` — **2 passed, 0 failed, 0 ignored**, with no GPU or DXC skip. The GPU fixture verified the per-dispatch values and count buffer together. It supplied three commands, set the count to two, uploaded the arguments after recording, waited for the fence and read back `[11, 16, 0, 0]`. The layout test for inline and spilled arguments also passed. Retail loading and the draw and indexed-draw paths remain unverified here. We also counted successful root-changing signature creations and their indirect calls in two longer Windows runs on our integration based on `1ec4c98cd`, without this PR. Both reached the fade after the loading artwork and then the title watchdog. Across the sampled windows, the draw, indexed-draw and dispatch counts were all zero in both runs. This covers the path our title took on this machine. Your repack may still be needed on other paths or by other titles. AI use: Codex (GPT-6) checked the source revision, ran the tests and drafted this comment.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 08:09 UTC · original

Linux / AMD RDNA3 lane report, head b1d2ab6 merged onto main 1ec4c98 (lane merge 1302047).

The lane crashes with a device-lost on this PR, and it is concurrency-sensitive.

  • Full suite at --test-threads=4 (twice: lane run + isolated rerun): mid-lib-suite the log shows xcl: D3D12 device removed: 0x887a0005, then the D3D12 device was removed (0x887a0005) - the title is stopped, and the test binary exits abnormally; e2e/gpu_compute_e2e/pls_quota/predication targets then all fail to run (lane totals collapse to 38/3/20).
  • Same lib suite at --test-threads=1: clean, 672 passed / 4 failed / 21 ignored (the 4 are the known GPU-f64 + xma2 Wine-lane set from my #42 rows), 27 s, no device-lost.

So on RDNA3 + Proton Experimental, your ExecuteIndirect GPU-side repack loses the device under concurrent test load (0x887a0005 = DXGI_ERROR_DEVICE_REMOVED family; no hang notice captured in the log). Deterministic at threads=4 (2/2), absent at threads=1 (1/1).

Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 08:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7125803404) Linux / AMD RDNA3 lane report, head `b1d2ab6` merged onto main `1ec4c98` (lane merge `1302047`). **The lane crashes with a device-lost on this PR, and it is concurrency-sensitive.** - Full suite at `--test-threads=4` (twice: lane run + isolated rerun): mid-lib-suite the log shows `xcl: D3D12 device removed: 0x887a0005`, then `the D3D12 device was removed (0x887a0005) - the title is stopped`, and the test binary exits abnormally; e2e/gpu_compute_e2e/pls_quota/predication targets then all fail to run (lane totals collapse to 38/3/20). - Same lib suite at `--test-threads=1`: **clean**, 672 passed / 4 failed / 21 ignored (the 4 are the known GPU-f64 + xma2 Wine-lane set from my #42 rows), 27 s, no device-lost. So on RDNA3 + Proton Experimental, your ExecuteIndirect GPU-side repack loses the device under concurrent test load (0x887a0005 = DXGI_ERROR_DEVICE_REMOVED family; no hang notice captured in the log). Deterministic at threads=4 (2/2), absent at threads=1 (1/1). Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-24 10:41 UTC · original

Holding off on merge until the concurrency-sensitive DEVICE_REMOVED (0x887a0005) reported under --test-threads=4 on RDNA3 is diagnosed and resolved.

**@⁠raylitebull** on GitHub · 2026-11-24 10:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7129105517) Holding off on merge until the concurrency-sensitive `DEVICE_REMOVED (0x887a0005)` reported under `--test-threads=4` on RDNA3 is diagnosed and resolved.
Author
Owner

@⁠grahamster2 on GitHub · 2026-11-24 13:55 UTC · original

@⁠utkarshxdev question before I write something that would collide with this: I'd like to add validation of ExecuteIndirect arguments, i.e. clamp the thread-group counts and the record count against the device limits and the argument buffer's size, and honour the count buffer when it's smaller than MaxCommandCount. The reason is a device hang (0x887A0006) on an RTX 3080 that fits argument blocks the title never wrote, and another project reports the same: unwritten blocks making single dispatches run for 100+ ms until a TDR.

Your repack pass already copies every record through a compute shader before ExecuteIndirect, so the clamp would naturally live there, a few lines in the shader plus the limits passed in. Would you rather I:

  1. send it as a small follow-up stacked on this PR, hooking into your pass, or
  2. do a standalone pass that only touches non-root-changing signatures (the ones yours leaves alone), keeping the two independent?

Either works for me. I'd rather not land a second copy-through pass that conflicts with yours.

Written with Claude Code (Claude Opus 5.5).

**@⁠grahamster2** on GitHub · 2026-11-24 13:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7133542647) @⁠utkarshxdev question before I write something that would collide with this: I'd like to add validation of ExecuteIndirect arguments, i.e. clamp the thread-group counts and the record count against the device limits and the argument buffer's size, and honour the count buffer when it's smaller than MaxCommandCount. The reason is a device hang (`0x887A0006`) on an RTX 3080 that fits argument blocks the title never wrote, and another project reports the same: unwritten blocks making single dispatches run for 100+ ms until a TDR. Your repack pass already copies every record through a compute shader before ExecuteIndirect, so the clamp would naturally live there, a few lines in the shader plus the limits passed in. Would you rather I: 1. send it as a small follow-up stacked on this PR, hooking into your pass, or 2. do a standalone pass that only touches non-root-changing signatures (the ones yours leaves alone), keeping the two independent? Either works for me. I'd rather not land a second copy-through pass that conflicts with yours. _Written with Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠utkarshxdev on GitHub · 2026-11-24 15:55 UTC · original

Hey @⁠grahamster2, thanks for coordinating! That’s a great catch — unwritten argument blocks causing 100+ ms dispatches and 0x887A0006 TDRs is definitely a critical issue on retail titles.

I'd definitely prefer Option 1 (sending it as a follow-up stacked on this PR / hooking into the repack compute shader).

Running two separate copy-through passes on indirect argument buffers would introduce redundant GPU bandwidth and dispatch overhead. Clamping ThreadCountX/Y/Z (against D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION = 65535) and bounding the record count against the buffer size / count buffer fits naturally into the existing repack compute pass with almost zero extra cost.

For signatures that don't change root arguments, we can either route them through the same lightweight clamp kernel or keep your standalone path for non-repacked ones so both cases are covered cleanly.

Feel free to stack your branch on top of this PR or submit the follow-up against this branch once it lands. Happy to review and test it alongside you!

**@⁠utkarshxdev** on GitHub · 2026-11-24 15:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7136834908) Hey @⁠grahamster2, thanks for coordinating! That’s a great catch — unwritten argument blocks causing 100+ ms dispatches and `0x887A0006` TDRs is definitely a critical issue on retail titles. I'd definitely prefer **Option 1 (sending it as a follow-up stacked on this PR / hooking into the repack compute shader)**. Running two separate copy-through passes on indirect argument buffers would introduce redundant GPU bandwidth and dispatch overhead. Clamping `ThreadCountX/Y/Z` (against `D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION = 65535`) and bounding the record count against the buffer size / count buffer fits naturally into the existing repack compute pass with almost zero extra cost. For signatures that don't change root arguments, we can either route them through the same lightweight clamp kernel or keep your standalone path for non-repacked ones so both cases are covered cleanly. Feel free to stack your branch on top of this PR or submit the follow-up against this branch once it lands. Happy to review and test it alongside you!
Author
Owner

@⁠grahamster2 on GitHub · 2026-11-24 15:56 UTC · original

Thanks, option 1 it is: I'll stack the per-record clamp on this PR's repack pass, and keep a small CPU-side bounds check for the signatures you don't repack.

To be upfront about its weight: since asking, I measured on the RTX 3080 and the retail title never hit it. Across 5 world runs (with XCL_PSO_WAIT_MS=50) there were 0 device hangs, and a bounds check that logs any oversized MaxCommandCount, out-of-range count-buffer offset or misaligned argument offset never fired. The one 0x887A0006 I'd seen before happened earlier in the run and doesn't reproduce. So this is a defensive guard rather than a fix for something live here, and I'll send it at low priority once this PR lands, not ahead of it.

Written with Claude Code (Claude Opus 5.5).

**@⁠grahamster2** on GitHub · 2026-11-24 15:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7136859277) Thanks, option 1 it is: I'll stack the per-record clamp on this PR's repack pass, and keep a small CPU-side bounds check for the signatures you don't repack. To be upfront about its weight: since asking, I measured on the RTX 3080 and the retail title never hit it. Across 5 world runs (with `XCL_PSO_WAIT_MS=50`) there were 0 device hangs, and a bounds check that logs any oversized `MaxCommandCount`, out-of-range count-buffer offset or misaligned argument offset never fired. The one `0x887A0006` I'd seen before happened earlier in the run and doesn't reproduce. So this is a defensive guard rather than a fix for something live here, and I'll send it at low priority once this PR lands, not ahead of it. _Written with Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠utkarshxdev on GitHub · 2026-11-24 15:58 UTC · original

Appreciate the detailed measurements and the update, @⁠grahamster2!

Really glad to hear it ran cleanly across 5 world runs on the 3080 with zero hangs. Keeping it as a defensive follow-up after this PR lands makes total sense and avoids delaying the merge.

Looking forward to reviewing your follow-up once this is in!

**@⁠utkarshxdev** on GitHub · 2026-11-24 15:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7136927514) Appreciate the detailed measurements and the update, @⁠grahamster2! Really glad to hear it ran cleanly across 5 world runs on the 3080 with zero hangs. Keeping it as a defensive follow-up after this PR lands makes total sense and avoids delaying the merge. Looking forward to reviewing your follow-up once this is in!
Author
Owner

@⁠grahamster2 on GitHub · 2026-11-24 21:00 UTC · original

@⁠utkarshxdev heads up: #1795 (mastrr9) just opened "clamp ExecuteIndirect argument records and total work on the GPU", which overlaps the clamp we said I'd stack on this PR. I'll hold mine; worth checking whether #1795 should build on your repack pass rather than add a second one.

**@⁠grahamster2** on GitHub · 2026-11-24 21:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7144361770) @⁠utkarshxdev heads up: #1795 (mastrr9) just opened "clamp ExecuteIndirect argument records and total work on the GPU", which overlaps the clamp we said I'd stack on this PR. I'll hold mine; worth checking whether #1795 should build on your repack pass rather than add a second one.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:18 UTC · original

Empirical test report (b1d2ab60)

Hardware / environment

Commit b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad. Intel Arc A770, driver 32.0.101.9175. Windows 11 Enterprise Evaluation x64, build 26200. AMD Ryzen 7 3800X. Rust and Cargo 1.100.0, host x86_64-pc-windows-msvc, unoptimized test profile. DXC and DXIL 1.9.2609.5.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test executables without running tests.
  • CPU, outside the Arc lock, with XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1: xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_table --test-threads=1. Exit 0. 1 passed, 0 failed, 0 ignored, 0 skipped.
  • GPU, inside Invoke-ArcTest.ps1 -Test, with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1: xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::indirect::tests::gpu_repack_preserves_per_dispatch_values_and_the_count_buffer --test-threads=1. Wrapper and test exit 0. 1 passed, 0 failed, 0 ignored, 0 skipped.

Both runs used the precompiled library test executable. Combined totals were 2 passed, 0 failed, 0 ignored, and zero case-sensitive ^SKIPPED matches.

Observed behavior

The CPU test validated inline and spilled root patch offsets and rejection of unsupported layouts. The GPU test uses the default D3D12 adapter, verified as the Arc A770 via DXGI. The readback assertion passed with expected values [11, 16, 0, 0]. Arguments were written after command recording and the count buffer limited execution to two of three commands.

Not tested

Full GPU workspace suite and game smoke runs.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr869-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7154657234) ### Empirical test report (b1d2ab60) **Hardware / environment** Commit `b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad`. Intel Arc A770, driver 32.0.101.9175. Windows 11 Enterprise Evaluation x64, build 26200. AMD Ryzen 7 3800X. Rust and Cargo 1.100.0, host `x86_64-pc-windows-msvc`, unoptimized test profile. DXC and DXIL 1.9.2609.5. **Commands and results** - `cargo test --workspace --no-run` exited 0 and built the workspace test executables without running tests. - CPU, outside the Arc lock, with `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`: `xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_table --test-threads=1`. Exit 0. 1 passed, 0 failed, 0 ignored, 0 skipped. - GPU, inside `Invoke-ArcTest.ps1 -Test`, with `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`: `xcl-77aca8ccb20e299f.exe --exact hle::d3d12x::indirect::tests::gpu_repack_preserves_per_dispatch_values_and_the_count_buffer --test-threads=1`. Wrapper and test exit 0. 1 passed, 0 failed, 0 ignored, 0 skipped. Both runs used the precompiled library test executable. Combined totals were 2 passed, 0 failed, 0 ignored, and zero case-sensitive `^SKIPPED ` matches. **Observed behavior** The CPU test validated inline and spilled root patch offsets and rejection of unsupported layouts. The GPU test uses the default D3D12 adapter, verified as the Arc A770 via DXGI. The readback assertion passed with expected values `[11, 16, 0, 0]`. Arguments were written after command recording and the count buffer limited execution to two of three commands. **Not tested** Full GPU workspace suite and game smoke runs. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr869-focused.log and published.
Author
Owner

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

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 10:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/869#issuecomment-7159141531) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/xcl/src/hle/d3d12x/bind.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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