Repository navigation
fix(agc): stop the GPU progress watcher without destroying a condition variable - #16259
Conversation
…n variable The recorder's progress watcher stopped its thread with a std::condition_variable it then destroyed together with the watcher. On Windows with winpthread, that destruction blocks forever after the watcher thread was joined when the thread was inside vkWaitSemaphores while the stop was signalled: the process stays alive with one thread and never finishes ~Recorder. agc_driver_frame_replay_reservation_error hit it every time on an NVIDIA GPU, because the replay tool prints its expected error and then hangs at teardown until the test timeout. The watcher now wakes through an atomic token (std::atomic::wait and notify_one), which keeps no per-object synchronization primitive to destroy. Claude-Session: https://claude.ai/code/session_012SLQbhAiexxW6TtjYToW8a
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (9 IDs in 594 tests)Skipped (56)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Windows run on an RTX 5070 Ti and an integrated Radeon. The hang doesn't reproduce on Head The hang.
It also passed on Whole AGC set.
The failures are the same tests on both trees, all tracked: Reading. The watcher loads
AI-assisted: yes (Claude Code) |
|
Another Windows + NVIDIA data point: unlike the RTX 5070 Ti run above, the hang does reproduce here, and this PR fixes it.
Built AI-assisted: yes (Claude Code) |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
What
Recorder::ProgressWatcherstops its GPU wait thread with astd::condition_variableand a mutex that are destroyed together with the watcher. On Windows with winpthread, on an NVIDIA GPU,agc_driver_frame_replay_reservation_errornever finishes: the replay tool prints its expected error, then the process stays alive with one thread inside~Recorderuntil the ctest timeout. Onmainf7a91b6bc9that happened 4 times out of 4 runs.The watcher now wakes through a
std::atomic<uint32_t>token (waitandnotify_one) instead, so there is no condition variable to destroy.submittedandstopbecome atomics. The wait loop, the semaphore wait, the timeouts and the lifetime of the thread are the same. I did not find which exact winpthread path blocks, only that dropping the per-object condition variable removes the hang (below).Tested
On
mainf7a91b6bc9, Windows 11 Home 26300, WinLibs GCC 15.2.0 r7, Release, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R agc_driver -Von both builds, same machine, same GPU selected withANYPS5_GPU:main27 of 29 pass.agc_driver_frame_replay_reservation_errortimes out andagc_driver_direct_write_completionfails. With this change 28 of 29 pass and onlyagc_driver_direct_write_completionfails (it fails onmaintoo).main27 of 29, withagc_driver_direct_write_completionandagc_driver_recorderfailing. With this change the same two fail and the other 27 pass. Neither is touched by this change; I did not investigate them.was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has aVUID-line, on both GPUs and both builds.tools/check_conventions.py --base upstream/main: passes.maineither, so that run only shows nothing regressed.Overlaps: #13863 and #13920 also edit the
ProgressWatcherstruct (a second watcher for a compute lane), so one of us will need a small rebase. #7464 and #11587 touchRecorder.cppelsewhere.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)agc_driver_frame_replay_reservation_errorhanging on NVIDIA Windows)https://claude.ai/code/session_012SLQbhAiexxW6TtjYToW8a