Repository navigation
D3D12.X: XCL_GPU_CULPRIT names the dispatches a stalled queue has not done - #1323
IvyNotFound wants to merge 1 commit into
Conversation
|
Ran the new Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
Not tested: the diagnostic against a real stalled queue (no unpacked title here), RDNA2/RDNA4 and Intel GPUs, Wine, release profile. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified. |
|
Full-suite run on NVIDIA and AMD to go with the Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
GPU run of Tested
Not tested
AI use
|
|
I exercised the dispatch marker fixture on Windows with an RX 7900 XT on a downstream XCL stack carrying 7fa2ade. The readback buffer was created and the completed list's marker-in and marker-out fixture passed. I also tested bounded slot registration locally. At capacity, existing lists keep their slot and a new list receives no slot. This keeps the slot registry consistent with the readback buffer's capacity when later diagnostics enumerate it. The focused module with that additional check passed all three tests and the release build completed. The game runs that motivated this check reported a partly executed command list with Dispatch next in DRED. I haven't attributed those hangs to a specific shader. Hardware follow-up with the markers enabled and the same saved profile: the log confirmed marker initialization. The game was still presenting in the 116.1 s sample and then terminated on the title's write to zero at +0x23cf683. No device removal or watchdog-release marker report was recorded in this run, so it did not identify a stalled dispatch. |
The console runs up to 2^32 - 1 thread groups a dimension; D3D12 takes 65 535, and past that a dispatch is undefined. On an NVIDIA RTX 5060 Ti a retail game's world loading hung the GPU (DXGI_ERROR_DEVICE_HUNG, 0x887A0006) about 100 s in, every run: the only unfinished work was an ExecuteIndirect of one loop-free compute program (found with the dispatch markers of xcl-dev#1323), and its arguments, written by an earlier dispatch, were 72 512 x 1 x 1 and 75 072 x 1 x 1 groups. A dispatch of more than 65 535 groups in X with 1 in Y now runs as 65 535 x ceil(n / 65 535) groups. The console's count goes into a new io word (IO_GROUP_LIMIT, in the trap-temp range like IO_UMA_BASE_HI; 0 when not folded), and every translated compute program takes gid.x + gid.y * 65 535 as its group in X when the word is set, its Y as 0, and returns at once in the groups at or past the count. A dispatch that cannot be folded (two dimensions past the limit) is clamped and logged. - Dispatch and console-recorded dispatches: the counts are known on the CPU (bind::fold, also in console_list). - ExecuteIndirect of one dispatch: the counts are only on the GPU. A one-thread pass (clamp.rs) reads them, writes the counts to dispatch into a slot of XCL's buffer and the console's count into the dispatch's io (folding only when the rows stay within 65 535, as bind::fold does), then the dispatch reads its arguments from the slot. bind_abi now returns what it bound so the binding can be set again after the pass. The translated compute HLSL changes (a few lines in the prelude), so cached translations and DXIL of compute programs are made again once. New tests: a folded dispatch runs each console group once and none past its count (GPU; fails without the change from group 65 535 on), the indirect pass folds / clamps / leaves counts as they are (GPU), and the folding rule (unit). runner::device() gives tests the runner's device: a test making its own device first left the Agility SDK unappliable and the GPU tests after it skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… done When the GPU-wait watchdog releases a wait (xcl-dev#505), its lines say which queues wait on which, but not what the GPU is running. With XCL_GPU_CULPRIT=1 every dispatch XCL records (title lists, console-recorded lists, ExecuteIndirect of a translated compute pipeline) is wrapped in WriteBufferImmediate markers, in before and out after, one pair of words per PC list in a readback buffer. At a release the lists whose marker in is above their marker out are logged with the dispatches between the two: console CS (fnv64 of the title's bytecode), PC pipeline and groups. On the retail title of xcl-dev#505 (RTX 5080) this named, at each stall, one list with a run of 1-D dispatches of one CS whose first never finished; not the same CS from run to run. DRED breadcrumbs were tried first: they change the driver's pipeline cache keys, so every pipeline was built again and the title never got past its start. Off by default; without the variable nothing is recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The console runs up to 2^32 - 1 thread groups a dimension; D3D12 takes 65 535, and past that a dispatch is undefined. On an NVIDIA RTX 5060 Ti a retail game's world loading hung the GPU (DXGI_ERROR_DEVICE_HUNG, 0x887A0006) about 100 s in, every run: the only unfinished work was an ExecuteIndirect of one loop-free compute program (found with the dispatch markers of xcl-dev#1323), and its arguments, written by an earlier dispatch, were 72 512 x 1 x 1 and 75 072 x 1 x 1 groups. A dispatch of more than 65 535 groups in X with 1 in Y now runs as 65 535 x ceil(n / 65 535) groups. The console's count goes into a new io word (IO_GROUP_LIMIT, in the trap-temp range like IO_UMA_BASE_HI; 0 when not folded), and every translated compute program takes gid.x + gid.y * 65 535 as its group in X when the word is set, its Y as 0, and returns at once in the groups at or past the count. A dispatch that cannot be folded (two dimensions past the limit) is clamped and logged. - Dispatch and console-recorded dispatches: the counts are known on the CPU (bind::fold, also in console_list). - ExecuteIndirect of one dispatch: the counts are only on the GPU. A one-thread pass (clamp.rs) reads them, writes the counts to dispatch into a slot of XCL's buffer and the console's count into the dispatch's io (folding only when the rows stay within 65 535, as bind::fold does), then the dispatch reads its arguments from the slot. bind_abi now returns what it bound so the binding can be set again after the pass. The translated compute HLSL changes (a few lines in the prelude), so cached translations and DXIL of compute programs are made again once. New tests: a folded dispatch runs each console group once and none past its count (GPU; fails without the change from group 65 535 on), the indirect pass folds / clamps / leaves counts as they are (GPU), and the folding rule (unit). runner::device() gives tests the runner's device: a test making its own device first left the Agility SDK unappliable and the GPU tests after it skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7fa2ade to
a79d09d
Compare
|
Thanks @crosettiremi, you were right about the slot bound: once the 16 384 slots were taken, a new list was still put in the map with a slot past the buffer, and the next watchdog report would have read it. Fixed in At AI use: Claude Code (Claude Opus 5.5) wrote the fix, the test and this reply, and ran the tests and the runs. |
The console runs up to 2^32 - 1 thread groups a dimension; D3D12 takes 65 535, and past that a dispatch is undefined. On an NVIDIA RTX 5060 Ti a retail game's world loading hung the GPU (DXGI_ERROR_DEVICE_HUNG, 0x887A0006) about 100 s in, every run: the only unfinished work was an ExecuteIndirect of one loop-free compute program (found with the dispatch markers of xcl-dev#1323), and its arguments, written by an earlier dispatch, were 72 512 x 1 x 1 and 75 072 x 1 x 1 groups. A dispatch of more than 65 535 groups in X with 1 in Y now runs as 65 535 x ceil(n / 65 535) groups. The console's count goes into a new io word (IO_GROUP_LIMIT, in the trap-temp range like IO_UMA_BASE_HI; 0 when not folded), and every translated compute program takes gid.x + gid.y * 65 535 as its group in X when the word is set, its Y as 0, and returns at once in the groups at or past the count. A dispatch that cannot be folded (two dimensions past the limit) is clamped and logged. - Dispatch and console-recorded dispatches: the counts are known on the CPU (bind::fold, also in console_list). - ExecuteIndirect of one dispatch: the counts are only on the GPU. A one-thread pass (clamp.rs) reads them, writes the counts to dispatch into a slot of XCL's buffer and the console's count into the dispatch's io (folding only when the rows stay within 65 535, as bind::fold does), then the dispatch reads its arguments from the slot. bind_abi now returns what it bound so the binding can be set again after the pass. The translated compute HLSL changes (a few lines in the prelude), so cached translations and DXIL of compute programs are made again once. New tests: a folded dispatch runs each console group once and none past its count (GPU; fails without the change from group 65 535 on), the indirect pass folds / clamps / leaves counts as they are (GPU), and the folding rule (unit). runner::device() gives tests the runner's device: a test making its own device first left the Agility SDK unappliable and the GPU tests after it skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
RTX 3080 (10 GB, driver 610.88), retail 1.0.2.1 into the world with Tested: this PR at
On this card the stall also goes away when split-wave64 compute and mesh programs are refused (#505, comment 7142113187), so Not tested: more than one run; without AI use: Claude Code (Claude Opus 5.5) ran the run on my machine through a scripted runner and wrote this report. |
Diagnostics only, off by default. Part of #505.
When the GPU-wait watchdog releases a wait, its lines (and #1123's chain line) say which queues wait on which, but not what the GPU is running at that point. @larelgit measured the GPU at 100 % during these stalls on #505, so something executes and does not end. With
XCL_GPU_CULPRIT=1, XCL marks every dispatch it records and logs, at the release, the dispatches that started and are not done, with their console compute shader.How: around each dispatch the list writes a running number into a readback buffer with
WriteBufferImmediate,MARKER_INbefore andMARKER_OUTafter, one pair of words per PC list. A list whose last number in is above its last number out has work that started and is not done. The dispatches between the two are logged with the console CS (fnv64of the title's CS bytecode, the name of its file indxil\translated), the PC pipeline and the groups. Once per burst of releases, 4 s apart, 8 times at most. DRED breadcrumbs would give the op in flight on a device removal. But with DRED on, the driver did not take its cached pipelines here: a 1.99 MB compute pipeline took 153 s to build, and the retail title never got past its start.What is in it
crates/xcl/src/hle/d3d12x/culprit.rs(new):enabled,note_compute;before_dispatch/after_dispatch(the markers);slot_forgives each PC list a slot, and none once the buffer's 16 384 slots are taken (the list is then not recorded, so no slot past the buffer is ever read);open_lists/not_done(what is in flight);on_watchdog_release(the log).a_list_with_a_marker_in_above_its_marker_out_is_open,a_list_past_the_last_slot_gets_none, and the GPU testgpu_markers_of_a_finished_list_match.bind.rs: markers aroundDispatchand around theExecuteIndirectof a translated compute pipeline.console_list.rs: markers around a console-recorded dispatch.real.rs:CreateComputePipelineStatenotes the console CS of the pipeline it returns (the old body is nowcreate_compute_pso, unchanged).list_x.rs: the watchdog callsculprit::on_watchdog_releaseafter its release lines.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4ata79d09d(rebased ontomain9e3831e) withXCL_SAMPLE_RPF,_DLLS,_TTPF,_BVH4,_BK2,_AWCset: 779 passed, 0 failed, 41 ignored;SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).gpu_markers_of_a_finished_list_matchran on the RTX 5080.scripts/smoke.ps1,XCL_PRESS_A_AT=15:main9e3831eand this heada79d09d);XCL_GPU_CULPRIT=1andXCL_PSO_WAIT_MS=50(into world loading) atc30f414(this commit before a change to how an indirect dispatch is labelled in the log). The markers were on from 7.1 s. At the first release (106.9 s), 3 of 358 lists had dispatches started and not done, e.g.#27175: cs b78fa10b425b8e54, pipeline 0x13a997ac0, groups 160x90x1. At the next release (114.3 s) the same three were still open. The run ended in the title's0xc0000409at ~124 s, as somemainruns of this title do (Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505 (comment)). No device removal.main47efa2e(posted on Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505: Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505 (comment)) named, at each stall, one list with a run of 1-D dispatches of one CS whose first never finished, e.g. CSb6043104de672057, 16x1x1, then 7 more of it; another run CS2c83ffd798d07451, 4355x1x1, then 13 more.Regression run
main:
this PR:
Not tested
WriteBufferImmediatethere)WriteBufferImmediateper dispatch)AI use
🤖 Generated with Claude Code