D3D12.X: the GPU-wait watchdog says where a chain of waits ends #1123
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!1123
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@not-rex on GitHub · 2026-11-24 12:07 UTC · original
not-rex:wait-burst-diag→main· +295 −4 · 2 files · 1 commits · openDiagnostics 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
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@Aniseto on GitHub · 2026-11-24 12:15 UTC · original
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.
@IvyNotFound on GitHub · 2026-11-24 12:35 UTC · original
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
@Filip722 on GitHub · 2026-11-24 12:34 UTC · original · edited 2026-11-24 12:37 UTC
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.@tiagonleal on GitHub · 2026-11-24 14:00 UTC · original
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).
@Anon64 on GitHub · 2026-11-25 02:19 UTC · original
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.
@Anon64 on GitHub · 2026-11-25 02:53 UTC · original
@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).
@not-rex on GitHub · 2026-11-25 02:56 UTC · original
@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.
@Anon64 on GitHub · 2026-11-25 03:05 UTC · original
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.
@DavidM1911 on GitHub · 2026-11-25 08:15 UTC · original
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!
@Dezmonius on GitHub · 2026-11-25 10:25 UTC · original
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).@not-rex on GitHub · 2026-11-25 12:08 UTC · original
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.@DavidM1911 on GitHub · 2026-11-26 03:41 UTC · original
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.@PACDevX on GitHub · 2026-11-26 13:00 UTC · original
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).
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.