D3D12.X: a GPU wait timeout logs what each queue waits on #1570

Open
zmelumian972 wants to merge 1 commit from upstream-pr/1580 into main
zmelumian972 commented 2026-11-24 17:54:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by zmelumian972 on 2026-11-24T17:54:00Z.


When a bridged GPU queue.Wait does not complete within the watchdog's 5 s, the log names the wait, its producer queue and the fence values, but not why the producer is behind. On the retail title under Wine (#662) that is the open question: a cycle through the waits XCL submitted, or a producer stuck on something XCL does not track? This logs the sync graph at the first four timeouts of a run so a log answers it. Part of #662.

Each line is one queue with outstanding work, in submission order: its pending GPU signals and the waits it has not got past, each wait with the queue and submission that satisfies it (<- q1#57, or no GPU signal), for both the Wait64BitValueX cells and the title's ID3D12Fences. Completed entries are pruned first. Example from the retail title (shortened):

xcl: D3D12.X: queue waits and signals when a GPU wait timed out (#submission per queue, <- the submission that satisfies it):
  q1: #7604 signal 0x70417f9d8=0xeab, …, #7610 wait 0x70417fb10>=0xeab 4951ms <- q3#30, #7611 wait 0x70417fb20>=0xeab 4951ms <- q4#28, …
  q3: #30 signal 0x70417fb10=0xeab, #31 signal fence 0x25b2880=0xb, …
  q4: #28 signal 0x70417fb20=0xeab, #29 signal fence 0x25b2940=0xb, …

In both runs where it fired, the compute queues' oldest pending entry is a signal with no wait before it, while the direct queue waits on those signals: no cycle through the tracked waits. One of the two ran with vkd3d-proton's per-family queue limit raised from 4 to 16 (each D3D12 queue on its own VkQueue), so it is not queue sharing in vkd3d-proton either. I will post the logs on #662.

What is in it

  • One commit, crates/xcl/src/hle/d3d12x/list_x.rs (+95): sync_graph_dump, called from the sync watchdog when an armed wait has expired (at most 4 times per run), logged after the graph lock is released.
  • Unit test list_x::tests::sync_graph_dump_names_the_submission_each_wait_needs (no GPU): a two-queue cycle through a cell and a title fence, and a wait with no signal.

Tested

  • RTX 5090 (NVIDIA 620.73.04), Ryzen 7 9800X3D, CachyOS (kernel 7.3.6), Wine 11.22, vkd3d-proton v3.1 with dxil-spirv 53aac41 and a local vtable patch, DXVK 3.1.1 dxgi; rustc 1.100.0, cross-built with cargo-xwin (x86_64-pc-windows-msvc), release.
  • cargo xwin test --workspace --target x86_64-pc-windows-msvc --release --no-fail-fast -- --test-threads=4, run under Wine:
passed failed ignored
main 9e3831e 763 13 41
this PR 0fff825 764 13 41

The 13 failures are the same tests on both (Wine: the CLI e2e tests that start xcl.exe — e2e, disasm_e2e, rpf_e2e, shaders_e2e, pls_quota — and gpu_depth_buffer_created_for_unordered_access_is_placed, offline_compute_pipeline_is_reused_by_a_second_process, set_predication_buffer_state_and_kickoff). The +1 is the new test.

  • SKIPPED on this adapter: gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Retail title 1.0.2.1 (XCL_PSO_WAIT_MS=1): the dump appears at the first timeouts, as above.

Regression run

Both blocks from smoke.sh, a Linux port of scripts/smoke.ps1 that prints the same block, under Wine, with wine started inside a bwrap sandbox (no network, game folder read-only), XCL_PSO_WAIT_MS=1, 60 s of the retail title. Under Wine XCL logs no commit size, so peak commit is 0 on both.

main:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 60
exit: killed (no exit)
frames shown: 1562 (PresentX 1562)
presents per 2 s (last 3): 60 60 49
device removals: 0
crashes: 0
peak commit: 0 MB

This PR:

xcl-smoke v1
commit: 0fff825650ab7a8104ffa95ea4fd32616c5c51ef
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 60
exit: killed (no exit)
frames shown: 1275 (PresentX 1275)
presents per 2 s (last 3): 0 7 10
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

  • Windows, AMD and Intel GPUs. The change is logging only and has no platform-specific code.
  • The 60 s smoke run ends before the title reaches the timeouts, so it does not exercise the dump; that was seen in the longer runs above.

AI use

  • Claude Code with Claude Opus 5.5: wrote the code, the test and this description, and ran the builds, tests and game runs on my machine. I ran the two smoke runs myself.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5477483733 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1580). Originally posted by [zmelumian972](https://github.com/zmelumian972) on 2026-11-24T17:54:00Z. --- When a bridged GPU `queue.Wait` does not complete within the watchdog's 5 s, the log names the wait, its producer queue and the fence values, but not why the producer is behind. On the retail title under Wine (#662) that is the open question: a cycle through the waits XCL submitted, or a producer stuck on something XCL does not track? This logs the sync graph at the first four timeouts of a run so a log answers it. Part of #662. Each line is one queue with outstanding work, in submission order: its pending GPU signals and the waits it has not got past, each wait with the queue and submission that satisfies it (`<- q1#57`, or `no GPU signal`), for both the `Wait64BitValueX` cells and the title's `ID3D12Fence`s. Completed entries are pruned first. Example from the retail title (shortened): ``` xcl: D3D12.X: queue waits and signals when a GPU wait timed out (#submission per queue, <- the submission that satisfies it): q1: #7604 signal 0x70417f9d8=0xeab, …, #7610 wait 0x70417fb10>=0xeab 4951ms <- q3#30, #7611 wait 0x70417fb20>=0xeab 4951ms <- q4#28, … q3: #30 signal 0x70417fb10=0xeab, #31 signal fence 0x25b2880=0xb, … q4: #28 signal 0x70417fb20=0xeab, #29 signal fence 0x25b2940=0xb, … ``` In both runs where it fired, the compute queues' oldest pending entry is a signal with no wait before it, while the direct queue waits on those signals: no cycle through the tracked waits. One of the two ran with vkd3d-proton's per-family queue limit raised from 4 to 16 (each D3D12 queue on its own `VkQueue`), so it is not queue sharing in vkd3d-proton either. I will post the logs on #662. **What is in it** - One commit, `crates/xcl/src/hle/d3d12x/list_x.rs` (+95): `sync_graph_dump`, called from the sync watchdog when an armed wait has expired (at most 4 times per run), logged after the graph lock is released. - Unit test `list_x::tests::sync_graph_dump_names_the_submission_each_wait_needs` (no GPU): a two-queue cycle through a cell and a title fence, and a wait with no signal. **Tested** - RTX 5090 (NVIDIA 620.73.04), Ryzen 7 9800X3D, CachyOS (kernel 7.3.6), Wine 11.22, vkd3d-proton v3.1 with dxil-spirv `53aac41` and a local vtable patch, DXVK 3.1.1 `dxgi`; rustc 1.100.0, cross-built with cargo-xwin (`x86_64-pc-windows-msvc`), release. - `cargo xwin test --workspace --target x86_64-pc-windows-msvc --release --no-fail-fast -- --test-threads=4`, run under Wine: | | passed | failed | ignored | |---|---|---|---| | `main` `9e3831e` | 763 | 13 | 41 | | this PR `0fff825` | 764 | 13 | 41 | The 13 failures are the same tests on both (Wine: the CLI e2e tests that start `xcl.exe` — `e2e`, `disasm_e2e`, `rpf_e2e`, `shaders_e2e`, `pls_quota` — and `gpu_depth_buffer_created_for_unordered_access_is_placed`, `offline_compute_pipeline_is_reused_by_a_second_process`, `set_predication_buffer_state_and_kickoff`). The +1 is the new test. - `SKIPPED` on this adapter: `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - Retail title 1.0.2.1 (`XCL_PSO_WAIT_MS=1`): the dump appears at the first timeouts, as above. **Regression run** Both blocks from `smoke.sh`, a Linux port of `scripts/smoke.ps1` that prints the same block, under Wine, with `wine` started inside a bwrap sandbox (no network, game folder read-only), `XCL_PSO_WAIT_MS=1`, 60 s of the retail title. Under Wine XCL logs no commit size, so `peak commit` is 0 on both. `main`: ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 5090 title: 9cc6a39e seconds: 60 exit: killed (no exit) frames shown: 1562 (PresentX 1562) presents per 2 s (last 3): 60 60 49 device removals: 0 crashes: 0 peak commit: 0 MB ``` This PR: ``` xcl-smoke v1 commit: 0fff825650ab7a8104ffa95ea4fd32616c5c51ef gpu: NVIDIA GeForce RTX 5090 title: 9cc6a39e seconds: 60 exit: killed (no exit) frames shown: 1275 (PresentX 1275) presents per 2 s (last 3): 0 7 10 device removals: 0 crashes: 0 peak commit: 0 MB ``` **Not tested** - Windows, AMD and Intel GPUs. The change is logging only and has no platform-specific code. - The 60 s smoke run ends before the title reaches the timeouts, so it does not exercise the dump; that was seen in the longer runs above. **AI use** - Claude Code with Claude Opus 5.5: wrote the code, the test and this description, and ran the builds, tests and game runs on my machine. I ran the two smoke runs myself. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gut0to commented 2026-11-24 18:00:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:00:58Z.

Review: COMMENTED


AI-assisted review (GPT-6): I traced the timeout predicate through the completed-wait pruning and dump generation.

<!-- greyfinch-sync:ivall/xcl:review:6044652121 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1580#pullrequestreview-6044652121). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:00:58Z. **Review:** COMMENTED --- AI-assisted review (GPT-6): I traced the timeout predicate through the completed-wait pruning and dump generation.
gut0to commented 2026-11-24 18:09:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:00:58Z.

Code review location: crates/xcl/src/hle/d3d12x/list_x.rs; line 1424

@@ -1368,11 +1410,26 @@ fn wake_sync_watchdog() {
                 continue;
             }
             let _ = cv.wait_timeout(guard, Duration::from_millis(50)).unwrap();
+            let mut dump: Option<String> = None;
             let (expired, rewinds) = {
                 let mut g = SYNC_GRAPH.lock().unwrap();
                 let mut out: Vec<(u64, u64, ID3D12Fence, usize, i32, Option<usize>, Option<i32>, u64, u64, u64)> = Vec::new();
                 let mut rew: Vec<(ID3D12Fence, u64)> = Vec::new();
                 if let Some(graph) = g.as_mut() {
+                    static DUMPS: AtomicU64 = AtomicU64::new(0);
+                    let expiring = graph
+                        .cells
+                        .values()
+                        .any(|c| c.armed_waits.iter().any(|aw| aw.armed_at.elapsed() >= GPU_WAIT_WATCHDOG_TIMEOUT));
+                    if expiring && once(&DUMPS, 4) {

Could completed waits be pruned before computing expiring? A wait can cross the threshold and then complete before this scan; expiring still consumes one of the four DUMPS slots, while prune_completed_waits removes the wait before sync_graph_dump. That can emit an empty timeout dump and reduce reports available for later genuine hangs. Please base the predicate on waits that remain pending after pruning. AI-assisted review: I traced this race through the watchdog and pruning path.

<!-- greyfinch-sync:ivall/xcl:review-comment:4684341974 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1580#discussion_r4684341974). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:00:58Z. **Code review location:** `crates/xcl/src/hle/d3d12x/list_x.rs`; line 1424 ~~~~diff @@ -1368,11 +1410,26 @@ fn wake_sync_watchdog() { continue; } let _ = cv.wait_timeout(guard, Duration::from_millis(50)).unwrap(); + let mut dump: Option<String> = None; let (expired, rewinds) = { let mut g = SYNC_GRAPH.lock().unwrap(); let mut out: Vec<(u64, u64, ID3D12Fence, usize, i32, Option<usize>, Option<i32>, u64, u64, u64)> = Vec::new(); let mut rew: Vec<(ID3D12Fence, u64)> = Vec::new(); if let Some(graph) = g.as_mut() { + static DUMPS: AtomicU64 = AtomicU64::new(0); + let expiring = graph + .cells + .values() + .any(|c| c.armed_waits.iter().any(|aw| aw.armed_at.elapsed() >= GPU_WAIT_WATCHDOG_TIMEOUT)); + if expiring && once(&DUMPS, 4) { ~~~~ --- Could completed waits be pruned before computing `expiring`? A wait can cross the threshold and then complete before this scan; `expiring` still consumes one of the four `DUMPS` slots, while `prune_completed_waits` removes the wait before `sync_graph_dump`. That can emit an empty timeout dump and reduce reports available for later genuine hangs. Please base the predicate on waits that remain pending after pruning. AI-assisted review: I traced this race through the watchdog and pruning path.
simonbronk commented 2026-11-24 21:08:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by simonbronk on 2026-11-24T19:20:53Z.


Test report: 0fff825 on the retail title, RTX 5070 12 GB (Windows). The dump answers the PR's question for this run: no cycle. The producer queue has no wait of its own outstanding and still completes nothing.

Setup: RTX 5070 12 GB (driver 621.24), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, release, DXC 1.9.2609. Retail 1.0.2.1, Series X. Tree: main 9e3831e plus this PR, nothing else in the runtime. XCL_NETWORK=0 XCL_HEAP_WINDOWS=1 XCL_PSO_WAIT_MS=50 XCL_PSO_PRELOAD=0 XCL_ACTIVITY=1. Warm DXIL and driver-blob caches from an offline --precompile --only cs --pipelines pass (about 2 100 compute pipelines). One run.

Sequence:

  • The world loads from about 48 s. Presents stop at 70 s.
  • At 73.4 s the first dump:
q0: #11 wait 0x704180158>=0x628 5022ms <- q2#3175, #12 signal 0x704180160=0x628, #13 signal 0x704180168=0x628, #14 signal fence 0x3611880=0x6
q1: #11 wait 0x704180110>=0x628 4946ms <- q2#3177, #12 signal 0x704180118=0x628, #13 wait 0x704180168>=0x628 4946ms <- q0#13, #14 wait 0x7041801e8>=0x628 4946ms <- q2#3178, #15 signal 0x7041801f0=0x628, #16 signal fence 0x3611ba0=0x6
q2: #3175 signal 0x704180158=0x628, #3176 signal fence 0x36116f0=0xc55, #3177 signal 0x704180110=0x628, #3178 signal 0x7041801e8=0x628, #3179 signal fence 0x36116f0=0xc56, #3180 signal fence 0x36116f0=0xc57
  • Pending fences at the same time: 0x36116f0(done=0xc54/sig=0xc57). So q2's submission before #3175 is what does not finish.
  • After the CPU releases, the title shows one frame every 10 – 30 s. No device removal and no watchdog. Meanwhile, cold compute pipeline builds push private commit from 30 GB at 70 s to 68 GB, and the run ends at 142 s with LLVM ERROR: out of memory in the driver's compiler (exit 0xc0000409). (Edited: the first version said the run reached 200 s; it did not.)

Reading: q0 and q1 wait on q2, and q2 waits on nothing XCL tracks. That fits the reading on #505 / #1284: GPU work on q2 runs long, for example a translated loop up to LOOP_GUARD. It does not fit a wait cycle.

Separate finding, not this PR: with XCL_PSO_PRELOAD on (the default) and an used-pipelines.txt of 1 184 sets, private commit grew about 2 GB/s in the menus and the run ended at 38 s with memory allocation of 2073600 bytes failed. In the same run with XCL_PSO_PRELOAD=0, commit stays at about 15 GB in the menus. I did not look further into it.

AI use: Claude Code with Claude Opus 5.5 built the tree, ran the title, read the log and wrote this report at the request of the person running it.

<!-- greyfinch-sync:ivall/xcl:comment:7141964228 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1580#issuecomment-7141964228). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-11-24T19:20:53Z. --- **Test report: `0fff825` on the retail title, RTX 5070 12 GB (Windows).** The dump answers the PR's question for this run: **no cycle**. The producer queue has no wait of its own outstanding and still completes nothing. **Setup:** RTX 5070 12 GB (driver 621.24), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, release, DXC 1.9.2609. Retail 1.0.2.1, Series X. Tree: `main` 9e3831e plus this PR, nothing else in the runtime. `XCL_NETWORK=0 XCL_HEAP_WINDOWS=1 XCL_PSO_WAIT_MS=50 XCL_PSO_PRELOAD=0 XCL_ACTIVITY=1`. Warm DXIL and driver-blob caches from an offline `--precompile --only cs --pipelines` pass (about 2 100 compute pipelines). One run. **Sequence:** - The world loads from about 48 s. Presents stop at 70 s. - At 73.4 s the first dump: ``` q0: #11 wait 0x704180158>=0x628 5022ms <- q2#3175, #12 signal 0x704180160=0x628, #13 signal 0x704180168=0x628, #14 signal fence 0x3611880=0x6 q1: #11 wait 0x704180110>=0x628 4946ms <- q2#3177, #12 signal 0x704180118=0x628, #13 wait 0x704180168>=0x628 4946ms <- q0#13, #14 wait 0x7041801e8>=0x628 4946ms <- q2#3178, #15 signal 0x7041801f0=0x628, #16 signal fence 0x3611ba0=0x6 q2: #3175 signal 0x704180158=0x628, #3176 signal fence 0x36116f0=0xc55, #3177 signal 0x704180110=0x628, #3178 signal 0x7041801e8=0x628, #3179 signal fence 0x36116f0=0xc56, #3180 signal fence 0x36116f0=0xc57 ``` - Pending fences at the same time: `0x36116f0(done=0xc54/sig=0xc57)`. So q2's submission before #3175 is what does not finish. - After the CPU releases, the title shows one frame every 10 – 30 s. No device removal and no watchdog. Meanwhile, cold compute pipeline builds push private commit from 30 GB at 70 s to 68 GB, and the run ends at 142 s with `LLVM ERROR: out of memory` in the driver's compiler (exit 0xc0000409). *(Edited: the first version said the run reached 200 s; it did not.)* **Reading:** q0 and q1 wait on q2, and q2 waits on nothing XCL tracks. That fits the reading on #505 / #1284: GPU work on q2 runs long, for example a translated loop up to `LOOP_GUARD`. It does not fit a wait cycle. **Separate finding, not this PR:** with `XCL_PSO_PRELOAD` on (the default) and an `used-pipelines.txt` of 1 184 sets, private commit grew about 2 GB/s in the menus and the run ended at 38 s with `memory allocation of 2073600 bytes failed`. In the same run with `XCL_PSO_PRELOAD=0`, commit stays at about 15 GB in the menus. I did not look further into it. *AI use: Claude Code with Claude Opus 5.5 built the tree, ran the title, read the log and wrote this report at the request of the person running it.*
DavidM1911 commented 2026-11-24 21:09:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:51:44Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7142693128 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1580#issuecomment-7142693128). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T19:51:44Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Foniass commented 2026-12-01 06:10:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:10:54Z.


Triage (#1607) – head 0fff825

#1123 (opened earlier) adds a diagnostic for the same watchdog timeout in list_x.rs: it follows the chain of waits from each released wait and says how it ends (cycle, signal, unsubmitted, signal gone). This PR instead dumps every queue's pending waits and signals at the first four timeouts. They solve the same question differently; the maintainer should pick one.
No problems found in the diff; it is a draft and 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.

<!-- greyfinch-sync:ivall/xcl:comment:7302580208 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1580#issuecomment-7302580208). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:10:54Z. --- **Triage (#1607)** – head 0fff825 #1123 (opened earlier) adds a diagnostic for the same watchdog timeout in list_x.rs: it follows the chain of waits from each released wait and says how it ends (cycle, signal, unsubmitted, signal gone). This PR instead dumps every queue's pending waits and signals at the first four timeouts. They solve the same question differently; the maintainer should pick one. No problems found in the diff; it is a draft and 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.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1580:upstream-pr/1580'
git switch 'upstream-pr/1580'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1580'
git switch 'upstream-pr/1580'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1580'
git switch 'upstream-pr/1580'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1580'
git switch 'main'
git merge --squash 'upstream-pr/1580'
git switch 'main'
git merge --ff-only 'upstream-pr/1580'
git switch 'main'
git merge 'upstream-pr/1580'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1570
No description provided.