D3D12.X: repack root-changing ExecuteIndirect commands on the GPU #869
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!869
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-869"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@utkarshxdev on GitHub · 2026-11-24 07:05 UTC · original
utkarshxdev:root-changing-execute-indirect→main· +584 −28 · 7 files · 1 commits · openTranslated 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
Regression run
main (
beaa245):this PR (
b1d2ab6):Tested
cargo test -p xcl --lib hle::d3d12x -- --test-threads=1passed (116 passed, 0 failed, 1 ignored).scripts/test.ps1passed (717 passed, 0 failed, 41 ignored).indirect::tests::root_offsets_follow_inline_registers_and_the_spilled_tableandgpu_repack_preserves_per_dispatch_values_and_the_count_buffer.git apply --check --whitespace=error-allon upstreambeaa245.Not tested
AI use
OpenAI Codex (GPT-6) implemented the patch, added the tests, and verified the changes.
@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 andscripts/test.ps1gave 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.
@eizispark on GitHub · 2026-11-24 07:35 UTC · original
Hardware check of
b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaad(verified clean merge withmain1ec4c98): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo 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=4VRAM contention flake inhle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsplus two downstream mutexPoisonErrorcascades (transitions_apply_when_their_list_is_submittedandd32s8_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)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, andhle::d3d12x::bind::tests::async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect(ok)Regression run
main(beaa245):PR (
b1d2ab6):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@Anon64 on GitHub · 2026-11-24 07:35 UTC · original
Regression runs for this PR's head
b1d2ab6and for its basemaina1672ef, on a retail title (same title, 60 s each), made withscripts/smoke.ps1(release, clean tree at each commit) and pasted unedited, for Regression run.main:
this PR:
Tested
Not tested
Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
@Anon64 on GitHub · 2026-11-24 07:39 UTC · original
World-loading run to go with the smoke runs above: this PR's head
b1d2ab6merged ontomain1ec4c98(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.main1ec4c98+0x23cf683)Wait64BitValueXtimeoutsNo 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.
@badoomtch on GitHub · 2026-11-24 07:16 UTC · original · edited 2026-11-24 07:40 UTC
Ran the two new tests at
b1d2ab604b848b3d054a66c8b3b55c2dd2c4eaadon 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.
@SlopTart on GitHub · 2026-11-24 08:09 UTC · original
Linux / AMD RDNA3 lane report, head
b1d2ab6merged onto main1ec4c98(lane merge1302047).The lane crashes with a device-lost on this PR, and it is concurrency-sensitive.
--test-threads=4(twice: lane run + isolated rerun): mid-lib-suite the log showsxcl: D3D12 device removed: 0x887a0005, thenthe 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).--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.
@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=4on RDNA3 is diagnosed and resolved.@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:
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).
@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
0x887A0006TDRs 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(againstD3D12_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!
@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 oversizedMaxCommandCount, out-of-range count-buffer offset or misaligned argument offset never fired. The one0x887A0006I'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).
@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!
@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.
@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, hostx86_64-pc-windows-msvc, unoptimized test profile. DXC and DXIL 1.9.2609.5.Commands and results
cargo test --workspace --no-runexited 0 and built the workspace test executables without running tests.XCL_ADAPTER=NONE_CPU_ONLYandRUST_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.Invoke-ArcTest.ps1 -Test, withXCL_ADAPTER=A770andRUST_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
^SKIPPEDmatches.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.
@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.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.Merge
Merge the changes and update on Forgejo.