Repository navigation
D3D12.X: the GPU wait watchdog does not miss the wake of an armed wait - #2499
tiagonleal wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
…ev#1792 Integrates Wait64 cycle/watchdog fixes (xcl-dev#2052, xcl-dev#2499), DirectStorage AutoSubmitDisabled (xcl-dev#1599), and batched kernelx sparse page commits (xcl-dev#1792). Assisted-by: Antigravity (Gemini 4 Neon)
(cherry picked from commit 36c805b32643c8a3ed87f50bafd00b18337a8827)
|
Independent Windows/NVIDIA check of PR head
The sole failure was Not tested: a retail title, AMD or Intel GPUs, and skipped wave64 paths. No game files were used. AI use: Codex (GPT-6.2 Sol) reviewed the test scope, ran the commands and drafted this report. |
|
Independent desktop NVIDIA verification of PR #2499 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib a_wait_armed_during_the_watchdogs_check_wakes_it -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.20s × 3, 0 skipped) |
cargo test --release -p xcl --lib hle::d3d12x::list_x:: -- --test-threads=1 (3 consecutive runs) |
41 passed; 0 failed; 0 ignored; 1284 filtered out × 3 (1.34s, 1.38s, 1.35s, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 11s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):
xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14004 MB
PR #2499 (62f372122cb7c5efa8c2e78e4979e310b87dcb61):
xcl-smoke v1
commit: 62f372122cb7c5efa8c2e78e4979e310b87dcb61
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1590 (PresentX 1590)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13984 MB
Runtime log observations (xcl.log)
9221log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19528 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13984 MB committed by the process; video memory 6115 MB local, 4654 MB non-local.
Limits of coverage
- Preventing lost wakeups when a GPU wait is armed concurrently with the watchdog idle check was verified via
a_wait_armed_during_the_watchdogs_check_wakes_it(3/3) andhle::d3d12x::list_x::(41/41× 3,0skipped). - The 60 s retail smoke on
title: 29640639confirms zero runtime regression on normal GPU waits (frame-count delta vs. cached parent reflects single-run startup variance, not this PR); an induced GPU hang / watchdog dump was not triggered during the retail run.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
The GPU wait watchdog takes its pair's lock, reads
ARMED_GPU_WAITSand sleeps on the condvar when it is 0. The arm intry_gpu_waitcallednotify_one()without that lock, so a notify that fell between the watchdog's read of 0 and itscv.waitwas 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 … released on CPU" line). Only a later arm woke it. The notify now takes the pair's lock.Part of #1452
Lock order (all callers):
cv.wait/wait_timeoutand takes no other lock while it holds it (SYNC_GRAPHcomes after the guard is dropped);try_gpu_wait→wake_sync_watchdog, has droppedSYNC_GRAPHby then and takes the pair's lock last;SYNC_GRAPHor a queue lock.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs:notify_sync_watchdogtakes the lock aroundnotify_one(); the check-and-sleep moves unchanged intosync_watchdog_sleep_if_idle, which has anafter_checkhook (a no-op in the runtime, asframe::publish_origin'safter_release); new testa_wait_armed_during_the_watchdogs_check_wakes_it.Tested
after_check(it has read 0 and holds the lock), arms and notifies from the test thread, and requires the watchdog to wake within 2 s. Without the fix (the lock removed fromnotify_sync_watchdog, local commit):FAILED … assertion failed: the watchdog slept through the arm's notify, left: Err(Timeout)(1 failed, 2.02 s). With the fix: passed 10 of 10 runs alone (0.20 s each).cargo test -p xcl --lib hle::d3d12x -- --test-threads=4, 3 runs: 254 passed, 0 failed, 2 ignored each.cargo build --workspaceok;cargo test --workspace --no-fail-fast -- --test-threads=4, 2 runs: 1420 passed, 4 failed, 46 ignored each; 25SKIPPEDlines. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3, which fail the same way on the base commit 6d12f58 on this machine (cargo test -p xcl --lib gpu::dxil::fuzz_tests::fuzz_validate_and_gpu: 0 passed, 4 failed).Regression run
main (6d12f58):
this PR (62f3721):
Not tested
AI use
🤖 Generated with Claude Code