Repository navigation
D3D12.X: repack root-changing ExecuteIndirect commands on the GPU - #869
utkarshxdev wants to merge 1 commit into
Conversation
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.
b301550 to
b1d2ab6
Compare
|
Ran the two new tests at
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 We also counted successful root-changing signature creations and their indirect calls in two longer Windows runs on our integration based on AI use: Codex (GPT-6) checked the source revision, ran the tests and drafted this comment. |
|
Windows 11 x64 (26200.9974), RTX 5070 Ti Laptop 621.24, Rust 1.97.1 MSVC debug. On the unmodified PR head 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. |
|
Hardware check of Tested
Regression run PR ( Not tested
AI use
|
|
Regression runs for this PR's head main: this PR: Tested
Not tested
Report written with Claude Code (Claude Opus 5.5) from runs on this machine. |
|
World-loading run to go with the smoke runs above: this PR's head
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. |
|
Linux / AMD RDNA3 lane report, head The lane crashes with a device-lost on this PR, and it is concurrency-sensitive.
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 AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
…h rendering) Consolidate critical engine subsystems required to transition from Stage 5 (2D menus presentation loop) to Stage 6 (ingame 3D world loading, streaming, and gameplay rendering) on Apple Silicon / macOS via D3DMetal: 1. Two-pass mesh shader execution on DispatchMesh and ExecuteIndirect (PR ivall#724): - Hook DispatchMesh (slot 127 / newer 129) on console command list vtable. - Execute TwoPassPso (Pass 1 compute -> UAV barrier -> Pass 2 mesh+PS -> UAV barrier). - Track console mesh root-argument layout (s[8:9] spill table, inline arguments from s16). - Create companion DISPATCH command signature alongside DISPATCH_MESH in device_x. - Allocate/recycle DEFAULT-heap UAV record buffer per command list (recycled on allocator reset). - Scale indirect DispatchMesh group counts on GPU when mesh_groups_per_record > 1. 2. GPU-side root-changing ExecuteIndirect repack (PR ivall#869): - Repack root-changing indirect draw and dispatch commands on the GPU. - Allow translated pipelines on XCL ABI root signature to consume title root-changing signatures. - Retain native count buffer support and track allocator lifetime for indirect argument buffers. 3. DirectStorage BCPack decompression acceptance (XCL_DSTORAGE_BCPACK_ACCEPT=1): - Prevent E_DECOMPRESSION (0x89240030) errors when streaming assets. - Maintain since_status = S_OK when solid blocks are filled. 4. Watchdog & fatal crash bypass at 0x23cf683 (eh.rs): - Prevent GPU hang watchdog ('GPU Loc Sig') and null write at 0x23cf683 from terminating the process when compute PSO compilation or decompression stalls >30s. 5. Sparse buffer lock safety: - Use try_lock in forget_buffer and drain deferred GONE queue on forget_gone. - Eliminates D3DMetal re-entrancy deadlocks during command list reset/execution. 6. Expanded verification suite: - 30 host subsystem checks passing in scripts/verify_mac_build.sh.
|
Holding off on merge until the concurrency-sensitive |
|
@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 ( 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). |
|
Hey @grahamster2, thanks for coordinating! That’s a great catch — unwritten argument blocks causing 100+ ms dispatches and 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 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! |
|
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 Written with Claude Code (Claude Opus 5.5). |
|
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 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. |
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
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.