Skip to content

D3D12.X: XCL_GPU_WAIT_RELEASE_MS sets when a stalled GPU wait is released - #1046

Open
papasmurph0 wants to merge 1 commit into
xcl-dev:mainfrom
papasmurph0:gpu-wait-release-ms
Open

papasmurph0 wants to merge 1 commit into
xcl-dev:mainfrom
papasmurph0:gpu-wait-release-ms

Conversation

@papasmurph0

@papasmurph0 papasmurph0 commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #505.

A Wait64BitValueX bridged to a GPU queue.Wait (#795) is released on the CPU after a fixed 5 s (GPU_WAIT_WATCHDOG_TIMEOUT) so a GPU cycle cannot hang the queue. On an NVIDIA GPU the producer is often only late, not stuck: the console list that writes the value is still being translated, held by the driver's build of a big compute pipeline. For the retail title of #505 at its world load those builds took 2 – 115 s each here. The release then lets the waiting compute queue run on memory the producer has not written yet.

XCL_GPU_WAIT_RELEASE_MS=<ms> (above 0) replaces the 5 s. Unset, nothing changes.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: gpu_wait_watchdog_timeout() / release_after(), read once like XCL_WAIT_TIMEOUT_MS next to it; the sync watchdog and its log line use it. Test: a_gpu_wait_is_released_after_xcl_gpu_wait_release_ms_or_the_default.

Tested

  • NVIDIA GeForce RTX 4080 SUPER (driver 32.0.16.1088), Ryzen 7 7800X3D, Windows 11 build 26200, rustc 1.100.0 MSVC, release.
  • cargo test --release --workspace -- --test-threads=4: 728 passed, 0 failed, 41 ignored (XCL_DXC_DIR set). SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64). The new test also passes on its own.
  • The retail title of Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505 at its world load, on a local tree (main beaa245 + open PRs, every dispatch run – no skipped dispatches – and a local change that keeps the title's own watchdog from ending the process), before and after setting the variable:
    • 5 s release: GPU queue.Wait at 0x704180158 >= 0x4e1 did not complete within 5000 ms (waiter=q0/ty2, prod=qSome(1)/tySome(0), recorded=0x4e1, submitted=0x4e1, completed=0x0) – released on CPU, then D3D12 device removed: 0x887a0006.
    • XCL_GPU_WAIT_RELEASE_MS=180000: no device removal through the same phase while the driver finished builds of 70 – 115 s.
      This is not a measurement of main + this PR alone: on main the title's own watchdog ("GPU Loc Sig") ends it in that phase first.

Regression run

main:

xcl-smoke v1
commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294
gpu: NVIDIA GeForce RTX 4080 SUPER
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1305 (PresentX 1305)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 9015 MB

this PR:

xcl-smoke v1
commit: b3351c069c0750b87b0e4af394465ad59c6c0db7
gpu: NVIDIA GeForce RTX 4080 SUPER
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1231 (PresentX 1231)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 9337 MB

Not tested

  • AMD and Intel GPUs; Wine.
  • The default (unset) is unchanged, so the regression runs above only show that nothing else changed; neither reaches the world load in 60 s.
  • A first main run of the same title ended in an early assert (0x80000003) before its first frame; the main block above is the run after it.

AI use

  • Claude Code with Claude Opus 5.5: found the release in the logs, wrote the change, the test and this description; the runs were made on my PC.

https://claude.ai/code/session_01SEW8zXNUmMq1tRUZpstWXS

…ased

A Wait64BitValueX bridged to a GPU queue.Wait is released on the CPU after
GPU_WAIT_WATCHDOG_TIMEOUT (5 s) so a GPU cycle cannot hang the queue. On an
NVIDIA GPU the producer is often only late: the console list that writes the
value is still being translated, held by the driver's build of a big compute
pipeline (2 - 115 s each for the retail title of xcl-dev#505). The release then lets
the waiting compute queue read memory the producer has not written yet.

Measured on an RTX 4080 SUPER with the retail title of xcl-dev#505 at its world load, every
dispatch run (no skipped dispatch): with the 5 s release, "GPU queue.Wait ...
did not complete within 5000 ms (... completed=0x0) - released on CPU" was
followed by device removal (0x887a0006); with XCL_GPU_WAIT_RELEASE_MS=180000
the same phase had no device removal while the builds finished (70 - 115 s).

The default stays 5 s; a value above 0 replaces it.

Assisted-by: Claude Code (Claude Opus 5.5)
@Aniseto

Aniseto commented Nov 24, 2026

Copy link
Copy Markdown

Ran the new watchdog test and the whole list_x unit set at b3351c0:

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.

XCL_ADAPTER=nvidia cargo test -p xcl --lib a_gpu_wait_is_released
1 passed; 0 failed; 0 ignored      (exit 0)

XCL_ADAPTER=nvidia cargo test -p xcl --lib list_x::tests
25 passed; 0 failed; 0 ignored     (exit 0)

The default and XCL_GPU_WAIT_RELEASE_MS paths behave as described 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: a retail title or scripts/smoke.ps1 (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.

@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti + Radeon iGPU; Rust stable MSVC, debug.

  • cargo test -p xcl --lib wait: 14 passed, 0 failed — includes the new a_gpu_wait_is_released_after_xcl_gpu_wait_release_ms_or_the_default.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

@tiagonleal

tiagonleal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Windows / NVIDIA retail test of b3351c069c, merged onto main 47efa2e + #684 + #1124 (clean here, tree f882c7c).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (32-lane waves), driver 32.0.16.1742; Ryzen 7 9800X3D, 32 GB RAM; Windows 11 Pro 26300; rustc 1.100.0 MSVC.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug) on f882c7c: 746 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).
  • Retail title 1.0.2.1, release, 300 s runs into world loading with XCL_NETWORK=0 XCL_PSO_WAIT_MS=50 XCL_PRESS_AT=30:A, the same build alternated with and without XCL_GPU_WAIT_RELEASE_MS=60000, warm DXIL / driver-blob caches (few compute builds over 5 s by now):
XCL_GPU_WAIT_RELEASE_MS presents end how the run ends dispatches (skipped) queue.Wait … released on CPU
unset (5 s) 120 s 0xc0000005 in game+0x4684e7 (read at 0xfd3fd1574), 121.3 s 53,528 (1,024) 13
60000 106 s +0x23cf683 write at 0x0, 136.5 s 20,085 (164) 0
unset (5 s) 126 s D3D12 device removed: 0x887a0006, 131.0 s 53,532 (2,048) 5
60000 114 s D3D12 device removed: 0x887a0006, 124.5 s 35,781 (662) 0
  • With 60 s nothing was released before the title's watchdog (30 s after the presents ended) or a device removal ended the run. So on this card, with the big pipelines already built, the stall did not resolve on its own in that time; a guess: the producer is stuck rather than late here.

Not tested: other values; more runs (two each, and runs of the same build vary a lot here: the same tree without this PR reached 200 s twice and 132 s once earlier); AMD / Intel.

Run and written with Claude Code (Claude Opus 5.5).

@imnicho

imnicho commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

A measurement for the same problem, with a variant that needs no setting: the watchdog does not count the time in which a bind is waiting for a pipeline (pso_async::title_held(), from #1288).

Tested

switch off (rounds 1 / 2) switch on (rounds 1 / 2)
GPU waits released by the watchdog 4 / 4, the first 9 s and 8 s after the world's set-up 0 / 0
Wait64BitValueX bridged to queue.Wait 3 / 3 3 / 3
dispatches in the 170 s after the set-up 7 950 / 8 130 8 429 / 8 134
dispatches skipped, device removals 0, 0 0, 0
  • Without the change the four releases came in every long run here today (9 of 9), at the same point: right after the set-up, when a title thread binds some dozens of compute pipelines in a row from their blobs, 0.1 to 0.3 s each, more than 5 s together. So here the producer is late because its thread is in binds, as your description says.
  • With the change none is released. What the title got done in the same time is the same within the spread between runs, so in these runs the releases did no visible harm and I cannot show a gain beyond the wait no longer being released while its producer is only held.

If you would like that in this PR, in place of the setting or beside it, I can send the diff. Otherwise I would open it as a small PR of its own once #1288 is in, since it needs title_held().

Not tested

  • With XCL_PSO_WAIT_MS (there a bind waits 50 ms at most, so this rule hardly applies), AMD, Windows 11.

AI use

  • Claude Code with Claude Fable 5.2 wrote the local change, ran the runs on the machine named and wrote this.

@papasmurph0

Copy link
Copy Markdown
Author

Thanks all for the runs.

@imnicho: your variant is the better fix. It keeps the release where it helps and stops it exactly when the producer is only held by a bind, with no setting to tune. Please open it as its own PR once #1288 is in. I'd rather not fold it in here, since it depends on title_held(). If it lands, this setting becomes a diagnostic knob at most, and I'm fine with closing this PR in its favour.

@tiagonleal: "the producer is stuck rather than late" matches what I see on an RTX 4080 SUPER with the retail title, once the big compute pipelines come from driver blobs. In the last run here (local tree, every compute PSO the title had used before loaded from disk), the stall at ~1,320 presents was a title thread inside CreateComputePipelineState, compiling one of the title's screen-probe programs in the driver. Those translate to 14–29 MB of DXIL here: one is 72 KB on the console, with 76,699 instructions and 1,377 s_getpc/s_setpc pairs. Meanwhile the GPU sat idle (2–3 %) and the process commit rose from 33 to 65 GB within ~5 minutes. The waiting compute queues' producer list can't be submitted until that compile ends, so no release timeout short of the compile time resolves it.

AI use: Claude Code (Claude Opus 5.5) ran the runs on my PC and wrote this comment; I asked for it to be posted.

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.

6 participants