D3D12.X: the GPU-wait watchdog says where a chain of waits ends #1114
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1123"
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?
Imported from ivall/xcl. Originally posted by not-rex on 2026-11-24T12:07:18Z.
Diagnostics only, the plan from https://github.com/ivall/xcl/issues/505#issuecomment-7127126213. When the GPU-wait watchdog releases a wait, it now also logs, once per burst, where the chain of waits behind it ends. Part of #505.
Today's lines give each cell's recorded / submitted / completed values. Those read the same for a cycle of queues and for a chain of waits behind one queue that is busy or held by a wait outside the sync graph, because the 5 s start when the CPU issues the
Wait, not when the queue reaches it. Nothing is released, pruned or signalled differently.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs: before the watchdog releases expired waits, it takes the trackedWait/Signalcalls still in flight (calls_in_flight, read-only) and follows them from an expired wait's queue (wait_chain): a queue is held at its earliest tracked call in flight, and when that is a wait the chain goes on at the queue of theSignalthat satisfies it. Onexlog_warn!line per burst (at most one per 5 s timeout, 64 in all), written after the releases: (format example with made-up values, not from a run)end=cycle: back at a queue already on the chain, so every queue on it is held at a wait.end=signal: no tracked wait is in front of the queue. It is executing, or behind one of XCL's own tile-mapping waits, which are not in the graph (@upipibi's point 2 on #795).end=unsubmitted: no submittedSignalsatisfies the last wait.end=signal-gone: the cell counts the value as submitted, but the graph tracks noSignalfor it and the fence is below it. The graph lost track (a CPU release dropped theSignal, or it was not queued because the fence was already there, and the fence went back since). Printed with the cell'ssubmittedandcpu_signaledvalues.same_end=n/m: of the m cells released in this tick, how many have a chain that ends the same way at the same queue.earlier_releases: cells the watchdog released before this tick.write64_cycle_breaks: Write64 Signals signalled on the CPU so far (the "would close a GPU cycle" line stops after 32; its counter moved to module scope for this). Mixed title-fence breaks are not counted.crates/xcl/src/hle/d3d12x/sparse.rs:fence_status()for the end of that line: the tile-mapping queue's fence and the readback fence, as completed / last value asked for (decimal, likewait_for's own line). The state keeps a second reference to both fences outsideSTATE, because a submit can sleep for 5 s inwait_forwithSTATElocked, which is the case the line is for. The values asked for are read withtry_lock; when the state is busy they print as?, with the value the submit sleeps on (wait_for=N, two atomic stores around the sleep). The watchdog never blocks on it.list_x.rs:wait_chain_names_where_expired_waits_end(graphs built by hand, no GPU: cycle, signal, unsubmitted, signal-gone, the line's text andsame_end, one line per burst) andwait_chain_leaves_out_completed_calls(real fences, WARP is enough: calls the GPU has completed are not on a chain; skips with "no GPU").Cost: while no wait expires, one pass over the armed waits on the watchdog's existing 50 ms tick (it only runs while a wait is armed), skipped for 5 s after a line. Nothing on the title's threads.
Rebased again on
main1a0bbe3a(headc6db70c): the only conflict was the test block beside #1452's new reset test inlist_x.rs; both are kept, and the change is the same (+295/-4). The RTX 3080 suite and smoke runs below are from this head. Before that, onmain8f5fca5b(head517e4df): main made the watchdog timeout configurable (gpu_wait_watchdog_timeout(),XCL_GPU_WAIT_TIMEOUT_MS); the expiry test andwait_chain_duenow both use that function, so the chain line sees the same expired waits under an override. RTX 5070 Ti (Windows Sandbox, GPU-PV):wait_chain2 of 2; full suite 1096 passed, 8 failed, the same 8 that fail onmainthere.Tested
cargo test --workspace -- --test-threads=4at the headc6db70c(onmain1a0bbe3a): 1252 passed, 0 failed, 46 ignored; the SKIPPED lines are main's new lower/lower_dxil GPU agreement tests, the two no-wave64 tests andpso_measurement_compiles_an_exact_synthetic_record.stable-x86_64-pc-windows-msvc; tests in the default (debug) profile, smoke runs in release.cargo test --workspace -- --test-threads=4: 739 passed, 0 failed, 41 ignored (SKIPPED GPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_maskandgpu::recomp::tests::gpu_wave32_program_in_wave64_hardware, both "no wave64").main384f7f7on the same machine: 737 passed, 0 failed, 41 ignored, the same two SKIPPED.GPU wait chainline was produced.Regression run
RTX 3080,
scripts/smoke.ps1, 300 s each, menus only (fresh data),main1a0bbe3a(this PR's base) and then this PR's headc6db70c:Not tested
sparseread) are covered only by a title run.fence_status()has no unit test (it needs a sparse state and a device).vram.rs'spages.fencewait is not in the line.AI use
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-24T12:15:32Z.
Ran the new watchdog tests and the whole
list_xunit set at6a3c81a: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.
wait_chain_names_where_expired_waits_endandwait_chain_leaves_out_completed_callspass, and the rest oflist_xis unaffected here. These are unit-level tests, so the adapter is not the variable; the datapoint is the Windows 11 build 26200 / MSVC 14.44.35207 / DXC 1.9.2609.5 toolchain next to the author's run.Not tested: the retail-title path where the watchdog fires (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.
Imported from ivall/xcl. Originally posted by IvyNotFound on 2026-11-24T12:35:00Z.
Retail run of
6a3c81aon an RTX 5080: both chain lines end atq4 end=signal, right after the 12 Write64 cycle breaksTested
384f7f7).cargo test --workspace --no-fail-fast -- --test-threads=4(debug,XCL_SAMPLE_*set): 739 passed, 0 failed, 41 ignored, includingwait_chain_leaves_out_completed_callsandwait_chain_names_where_expired_waits_end;SKIPPED(no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.scripts/smoke.ps1 -Seconds 140,XCL_PRESS_A_AT=15,XCL_PSO_WAIT_MS=50,XCL_FRAME_DUMP=2, one run. Same settings as my runs onmainin https://github.com/ivall/xcl/issues/505#issuecomment-7130913073.What the run shows
Write64 Signal … would close a GPU cycle – signalled on CPU, all for value0x577, on q0–q4 (e.g.0x70417fe58 = 0x577 on q3/ty0 (waiters=[q0,q4]),0x70417fe68 = 0x577 on q4/ty2 (waiters=[q4])). There are no others in the run.0x576/0x577, and q3 waiting for q0's, q1's, q2's and q4's. Theircompletedis0x575/0x576. Only that first tick printed a chain line.sparse: the queue has not reached fence value 37665 after 5 s (at 37664).did not complete within 5000 mslines in all. The run reached its 140 s with no device removal and no crash. At 127 s: 13 044 draws with translated pipelines (4 096 skipped), 24 688 dispatches (529 skipped). The frames presented after world loading are black, as onmain.So on this machine the chain never ends in
cycle,unsubmittedorsignal-gone: both times it stops at q4 with no tracked wait in front of it. In the first burst, the sparse queue is caught up (35828/35828), and it follows the only cycle breaks in the run by 4.7 s, close to the 5 s timeout.Not tested
AI use
Imported from ivall/xcl. Originally posted by Filip722 on 2026-11-24T12:34:39Z.
I tested
6a3c81aon an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08) on Bazzite 44 and Proton Experimental11.0-20261112. The local stack was main47efa2ewith #640/#782/#793/#820, vkd3d-proton v3.1 with #257 and dxil-spirv1dc543f. I also used the private texture placement experiment described in #175 andXCL_PSO_WAIT_MS=5000to get past the earlier allocation fault.The title recorded 2,207 sampled presents and 79,676 storage executions (65 failed). At the end there were 15 consecutive two-second activity samples with zero presents before the title exited at its watchdog-associated exception site. The session emitted neither an XCL wait release nor a
GPU wait chain:line. It therefore did not exercise this PR's diagnostic trigger. The title watchdog can fire on this machine even when the tracked wait-release condition is absent.OpenAI Codex with GPT-6.2-Sol high assisted with the test and report.
I symbolized our XCL and vkd3d-proton builds from that exit. The XCL wait watchdog was asleep with zero armed GPU waits. Three title recording threads were in
pso_async::resolve_within, three workers were inside compute PSO creation, and the vkd3d submission workers were waiting for work. The same pattern appeared in the previous run. This supports looking at late pipeline compilation for this stall.Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-24T14:00:21Z.
Windows / NVIDIA retail test of
6a3c81a9da, on top ofmain47efa2e+ #684 + #1124 (all clean merges, tree13ec1af).Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4(debug) on13ec1af: 747 passed, 0 failed, 41 ignored. SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64).XCL_NETWORK=0 XCL_PSO_WAIT_MS=50 XCL_PRESS_AT=30:A): presents end at 200 s, the run ends in the title's watchdog (+0x23cf683) at 229.8 s, as without this PR.End queues: q1 7×, q2 4×, q4 3×, q0 2×.
write64_cycle_breakswent from 45 to 90 over the run.Not tested: more runs (one); AMD / Intel. The full suite of another PR ran alongside part of this run.
Run and written with Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-25T02:19:42Z.
Test report from a retail title's world load, where this diagnostic answers the question it was written for.
Setup: this PR's head
517e4dfmerged ontomain80f4819(clean merge), release. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, 64 GB RAM. A pressed every 4 s from 20 s,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_PRELOAD=0 XCL_NETWORK=0, 140 s.What it logged at the stop (presents fall to 0 at ~80 s):
0x719from q2 expire, and one q1 wait on a value q0 writes.What that shows on this machine: the chain behind the title's q0 / q1 waits ends at q2, and q2 is not waiting on anything XCL's sync graph knows about. Without a TDR, q2 is more likely behind a wait XCL does not track than executing. It is not a title
ID3D12CommandQueue::Waiton one of the pending fences: those showwait=0x0, and the log has notitle ID3D12CommandQueue::Wait on …line at all (note_title_queue_waitlogs the first eight), so this title queues no fence waits. XCL's own waits arenone, and the sparse queue fence is complete. What q2 is behind is outside what this diagnostic sees.Same shape without this PR: the same
waiter=q0|q1, prod=qSome(2)expiries, withcompleted=0x0, come at the stop in every recentmainrun here:80f4819: 76 s;80f4819+ #253: 79 s;3da2abbwithXCL_HUGE_PSO_CONCURRENCY=4: 111 s;80f4819+ #1798: 75 s.So on this card the stop is this chain, not the pipeline builds that are still running around it.
The first run of this PR instead had a device removal at 62.3 s (
0x887a0006, during a title-texture upload's copy), then the title's+0x2474606assert. Since this PR only logs, I take that as the intermittent hang I also saw once with #1798.Not tested: the whole suite; AMD.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-25T02:53:30Z.
@not-rex a follow-up I'd like to write, stacked on this PR, unless you have it planned. On this machine the chain ends at
q2 end=signal (no tracked wait in front of it …), which leaves open what q2 is doing (my report above). The next thing that would answer that:end=signal, log once what the end queue has in flight: itsExecuteCommandListscalls after its last completed fence value. Per call: the number of lists and, per list, its draws / dispatches / copies / barriers and the console-side waits / signals recorded in it, plus how long ago it was submitted.That would tell "executing a long list" apart from "held by a wait inside a list that XCL does not track" (a wait recorded by console code in a list, for instance), without changing what is released. Diagnostics only, behind the same once-per-burst rule as yours, under ~200 lines with a unit test on a fake queue history. If you'd rather fold it into this PR, or it overlaps something you have, say so and I'll test that instead.
Written with Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by not-rex on 2026-11-25T02:56:17Z.
@Anon64 thanks for the report, and yes please: I don't have that follow-up planned, so go ahead stacked on this one. What the end queue has in flight after its last completed fence is exactly the gap
end=signalleaves. One data point that may help you pick what to log: on an RTX 3080 the stall goes away withXCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512(#505, comment 7148521756), so per-list counts of dispatches that write into the coherent window would be worth having next to draws/dispatches/copies.AI use: Claude Code (Claude Opus 5.5) wrote this.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-25T03:05:04Z.
The follow-up I proposed above, run in the title. It is a local commit on top of this PR's head,
11a1df9ondiag/chain-end-submissions, not pushed: a ring of the last 4ExecuteCommandListscalls per queue (when, how many PC lists), printed in theend=signalcase. It's about +60 lines with a unit test.Same machine and settings as my report above (RTX 3060,
maincbc296a+ this PR + the commit, 150 s):So q2 got three big submissions (72 lists) at the moment the waits were issued, 5 s before the line, and nothing since. The work that should write
0x66cis in those lists and has not completed. There is no TDR (no device removal, no crash in the run), so what holds q2 is inside one of those lists, not a hung command. That narrows the search to waits recorded inside those lists that XCL does not track.If you're happy with it, I'll open it as a stacked PR (
Stacked on #1123). If you'd rather fold it in here, take the commit.Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:15:54Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by Dezmonius on 2026-11-25T10:25:50Z.
Native Windows data point for #1123 (
517e4df) on RTX 5070 / 610.88, i7-7700K, Windows 10 19045. I applied the diagnostics to the same localcbc296ab+ #1931 + #929 + DirectStorage test setup, keeping the base watchdog's wake helper. Offline Series X, direct DXIL, no frame dump. The first attempt reset D3D12 at 164.7 s before reaching the watchdog phase. With the D3D12 debug layer enabled, the repeat reached the 300 s timer (883 PresentX calls, exit 0).The repeat logged four GPU watchdog releases grouped into three wait-chain samples. All three ended
unsubmitted. The first had zero prior watchdog releases and zero cycle breaks. In that first cell the requested value had been recorded but the graph listed no submitted signal. At the next two bursts, the highest recorded value matched the wait and the tracked submitted/completed value was one step behind. The sparse work fence was caught up on all three samples. Later samples followed earlier CPU releases, so I would not use them alone to infer the original dependency graph.This narrows the symptom to the missing tracked submission in this run; it does not distinguish why the recorded work was not submitted or exclude waits outside the graph. Focused
cargo test --locked --offline -j 4 -p xcl --lib wait_chain -- --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored. No addresses, game data or raw logs included. AI-assisted (OpenAI Codex, GPT-6).Imported from ivall/xcl. Originally posted by not-rex on 2026-11-25T12:08:44Z.
Rebased onto
main1a0bbe3a(headc6db70c7). The only conflict was the test block next to #1452's new reset test inlist_x.rs; both tests are kept, and the change itself is the same (+295/-4).RTX 5070 Ti,
cargo test -p xcl --lib --locked -- list_x: 36 passed, 0 failed, includingwait_chain_names_where_expired_waits_end,wait_chain_leaves_out_completed_callsanda_reset_while_the_last_submit_runs_records_on_another_pc_list.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:41:03Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by PACDevX on 2026-11-26T13:00:34Z.
I observed a recoverable stall on an RTX 3090 (driver 621.24) in Windows Sandbox with vGPU. This was a release build of our local integration branch, 1f5f362, with DRED page-fault reporting and a 5 s GPU wait watchdog.
Three focused watchdog and tracking tests passed. This was a local build with extra logging, so the timings are not a controlled comparison against main or this PR. Reporting this here because the proposed pending-list diagnostics would help distinguish cases like this one.
Test and write-up assisted by Codex (GPT-6.2 Sol).
Imported from ivall/xcl. Originally posted by PACDevX on 2026-11-26T13:52:32Z.
Follow-up to my watchdog report. The same release run of our local XCL integration build, 1f5f362, reached a playable 3D scene in GTA VI on an RTX 3090 (driver 621.24) and Ryzen 7 7800X3D, in Windows Sandbox with vGPU. I tested movement with WASD and camera control with the mouse and confirmed that both respond in the scene.
The session was still running after more than an hour with no reported D3D12 device removal. The observed scene ran at around 1–2 FPS and still showed incorrect colors and missing geometry. This result establishes that the scene accepted player input on this setup. Rendering correctness and frame rate are the next work.
Test instrumentation and write-up assisted by Codex (GPT-6.2 Sol).
Imported from ivall/xcl. Originally posted by PACDevX on 2026-11-26T19:09:50Z.
Follow-up to my earlier RTX 3090 report. A later Release run from local commit
c8b412f1used the same RTX 3090, driver 621.24, and Windows Sandbox vGPU.0x982. The producer had recorded0x982, and the submitted and completed values were both0x981.real::dev_create_command_listin a wait inside D3D12Core, and another title thread was in native Reset. The 14-frame dump ends at the wrapper, so it leaves the CreateCommandList caller unresolved.0xc0000005. The XCL and ETW logs showed no device removal.One test-control correction:
XCL_SPARSE_FRESH_UPLOAD=0still took a fresh-allocation path whenXCL_SPARSE_PREPARE_OUTSIDE_STATE=1in this local build. The next comparison checks the effective path in the log and adds a per-submit marker immediately after refresh.AI assistance: OpenAI Codex for log correlation and drafting.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:52:29Z.
Triage (#1607) – head
c6db70c#1580 also adds a log for GPU wait timeouts in
list_x.rs(a per-queue dump of armed waits and signals); this PR follows the chain from the expired wait and names how it ends. Same problem, different approach; both rewrite the watchdog tick and will conflict. #1323 (XCL_GPU_CULPRIT) names dispatches, not waits.No problems found in the diff (diagnostics only; the chain walk reads the graph under the existing lock and
sparse::fence_statususestry_lock). The branch currently conflicts with main.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.