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)
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