Skip to content

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

Draft
zmelumian972 wants to merge 1 commit into
xcl-dev:mainfrom
zmelumian972:d3d12x-sync-wait-dump
Draft

zmelumian972 wants to merge 1 commit into
xcl-dev:mainfrom
zmelumian972:d3d12x-sync-wait-dump

Conversation

@zmelumian972

@zmelumian972 zmelumian972 commented Nov 24, 2026 •

Copy link
Copy Markdown

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

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
(xcl-dev#662) that is the question: is it a cycle through the waits XCL
submitted, or is the producer stuck on something XCL does not track?

The first four timeouts of a run now log one line per queue with
outstanding work in the sync graph, 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"), for both the
Wait64BitValueX cells and the title's ID3D12Fences. Completed entries
are pruned first.

On the retail title the dump shows compute queues whose 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gut0to gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

.cells
.values()
.any(|c| c.armed_waits.iter().any(|aw| aw.armed_at.elapsed() >= GPU_WAIT_WATCHDOG_TIMEOUT));
if expiring && once(&DUMPS, 4) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

simonbronk commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants