Skip to content

D3D12.X: preserve GPU wait watchdog wakeups on nvidia-dev - #3130

Closed
Prime1997 wants to merge 1 commit into
xcl-dev:mainfrom
Prime1997:codex/nv-watchdog-wake-20261128
Closed

Prime1997 wants to merge 1 commit into
xcl-dev:mainfrom
Prime1997:codex/nv-watchdog-wake-20261128

Conversation

@Prime1997

@Prime1997 Prime1997 commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Backport #2499 by Tiago Leal (@tiagonleal), original commit 62f372122cb7c5efa8c2e78e4979e310b87dcb61, onto nvidia-dev 54225f5884a94cd23b7aab3f703a7c975070aa77. This is the NVIDIA branch port of that existing main PR. The watchdog could miss an armed wait's notification between checking its counter and sleeping, leaving the timeout monitor asleep.

What is in it

  • Take the watchdog pair's leaf mutex while notifying; preserve GPU wait, timeout and completion behavior.
  • Retain the original deterministic CPU test for notification arriving between the check and sleep. Original authorship and cherry-pick provenance are preserved.

Tested

  • Current PR head: 497b3c008eb21422d16b93df5b238550f1434508.
  • Windows 11 Pro 26200; Intel i5-10400; NVIDIA RTX 3060 Ti driver 32.0.16.1714; Rust 1.100.0; release profile.
  • Combined integration d50f6656fb50b7927a2279d4c78b24222be3da54: cargo build --locked --release -p xcl --target-dir <isolated-target> exited 0 in 228.576s, with 9 warnings. This includes the change but is not a standalone build/test of this PR head.
  • Watchdog logic tested on integration f94b44ac88a71feab670b6983f35b9837703ec00, before the later diagnostic/shader additions: cargo test --locked --release -p xcl --lib <filter> --target-dir <isolated-target> -- --exact --test-threads=1 --nocapture. Filters hle::d3d12x::list_x::tests::a_wait_armed_during_the_watchdogs_check_wakes_it and hle::d3d12x::list_x::tests::sync_watchdog_pair_is_set_before_the_thread_starts: each 1 passed, 0 failed, 0 ignored, 1,871 filtered, no SKIPPED messages. No before-fix run was performed in this batch.

Regression run
Pending paired clean-head main/PR title runs. No smoke result or confirmed world-loading recovery is claimed. Draft while required validation remains incomplete.

Not tested

  • Exact-head title regression, full GPU workspace suite, AMD/Intel and Linux/Wine.
  • Whether the missed notification occurred in the failing NVIDIA world-load session. This repairs a source-confirmed race; it does not identify or prove a fix for that session's GPU removal.

AI use
Codex (GPT-6) checked overlap, reviewed and ported the existing change, and prepared this description. The original contributor and AI provenance remain in the preserved commit.

Optional temporary Discord for coordinating contributor work, testing and comparing results: https://discord.gg/6B4TykyC4W

The watchdog thread takes its pair's lock, reads ARMED_GPU_WAITS and
sleeps on the condvar when it is 0. The arm in try_gpu_wait called
notify_one() without taking that lock, so a notify falling between the
watchdog's read of 0 and its cv.wait was lost: the watchdog slept with
the wait armed, its timeout never ran, and a wait with no producer was
never released on the CPU (no "did not complete" line). Only a later
arm woke it.

The notify now takes the pair's lock (notify_sync_watchdog). The lock
is a leaf: the watchdog takes no other lock while it holds it, so the
notifier's SYNC_GRAPH or queue locks cannot invert with it. The check
and sleep move to sync_watchdog_sleep_if_idle, with an after_check
hook the new test uses to arm and notify between the read and the
wait; it fails on main (the watchdog does not wake within 2 s) and
passes with the fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 62f3721)
@Aniseto

Aniseto commented Nov 28, 2026

Copy link
Copy Markdown

Ran the GPU-wait watchdog tests at 497b3c00 on an NVIDIA Blackwell desktop part:

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_wait_armed_during_the_watchdogs_check_wakes_it sync_watchdog_pair_is_set_before_the_thread_starts --test-threads=1
2 passed; 0 failed; 0 ignored; 0 measured; 1805 filtered out      (exit 0)

Both deterministic CPU tests pass, including the case where a wait is armed between the watchdog's counter check and its sleep. The PR has no comments yet, so this is the first datapoint in the thread and the first from an RTX 5070 Ti. The author's run was on an RTX 3060 Ti in release; mine is debug here.

Not tested: a real GPU wait in a title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@Prime1997

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate. This was the nvidia-dev port of #2499 by tiagonleal. nvidia-dev was merged into main by #3203 and this PR was retargeted to main, where #2499 is open with the same change. Checked and closed with Claude Code on Prime's behalf.

@Prime1997 Prime1997 closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants