Repository navigation
Runtime: bound FenceWaitDispatcher's vkWaitSemaphores to 100 ms slices - #3285
Conversation
Under GPU paravirtualization (Windows Sandbox, RTX 5060 Ti, driver 617.42) the dispatcher's infinite vkWaitSemaphores is a kernel wait that cannot be interrupted. A process that exits with a wait pending, as d3d12_queue_wait_timeout does by design, never finishes exiting, and TerminateProcess from CTest cannot end it. Bounded slices let the thread return to user mode; the loop re-arms the same wait and completions still wake it at once. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent bare-metal test of
The registered |
|
Independent bare-metal run of Direct results
The parallel stress Doffi4 did not rerun on #3197 Six concurrent So this Ampere host does not reproduce the >100 s contention hang seen on the RTX 5060 in #3197, with or without the 100 ms slices. That makes this a no-regression data point, not a confirmation of the hang fix: the uninterruptible |
|
Tested
AI-assisted. |
|
Tested 4a9c412 merged onto main f847748 (clean merge) on bare metal, RTX 4070 SUPER (NVIDIA 616.64) and Intel UHD 770 (101.7092), Windows 11 build 26300, MSVC 19.44, Vulkan SDK 1.4.363.0: no regression. This is not the paravirtualized setup the PR fixes, so it only checks that the 100 ms slices change nothing on a normal driver.
So the timeout control exits promptly on both GPUs with the slices in place. On the UHD 770 the positive AI-assisted (Claude Code). |
Claimed in #3232 (comment).
What and why
FenceWaitDispatcher::run()(runtime/src/vulkan_backend.h) waits withvkWaitSemaphores(..., UINT64_MAX). Under GPU paravirtualization (measured in Windows Sandbox, vGPU on an RTX 5060 Ti, driver 617.42) that call is a kernel wait the OS can't interrupt. A process that exits while a wait is pending never finishes exiting, andTerminateProcessfrom outside can't end it either.d3d12_queue_wait_timeoutdoes exactly this by design (_Exit(1)with a fence wait pending); in a serialctestit stayed alive more than 17 minutes past itsTIMEOUT 10.This change caps each wait at 100 ms (
kWaitSliceNs). A timeout returns to the existing loop, which already falls through onVK_TIMEOUTand re-arms the same wait. A completed fence still wakes the thread at once through the ANY wait, so this is not completion polling. The cost is at most 10 wake-ups a second, only while a wait is pending.How it was narrowed down
Windows Sandbox, RTX 5060 Ti 617.42,
main1628210, the control run alone (d3d12_queue_wait_test --timeout-control) under a watchdog that waits 20 s, thenStop-Process, then 15 s more:mainStop-Processone thread remains inWait/ExecutiveTerminateProcess(GetCurrentProcess(), 1)instead of_Exit(1)Validation (this branch, same sandbox)
d3d12_queue_wait_timeout: passed in 1.06 s (onmainit hangs). The control alone: 5/5 exit in 0.9 to 1.2 s with code 1.d3d12_queue_wait_test(positive): 5/5 pass.ctest --test-dir runtime/build --output-on-failure: 128/129. The one failure,queue_proxy(line 1302, a shared fence's value read throughOpenSharedHandle), fails the same way onmainin this sandbox.scripts/run_gpu_tests.py: 143/189 passed, 46 skipped; withLEONIDA_W64_EMULATE=1, 174/189 passed, 15 skipped. Same asmain.Relation to TEST-586 (#2963, #2970): those raise the test's
TIMEOUTto 20 s for slow device bring-up under parallel load. This fixes a process that never exits, and it changes a different file, so there is no conflict.Tested on NVIDIA GeForce RTX 5060 Ti (Blackwell, subgroup 32), driver 617.42, Windows 11 Pro 26200, inside Windows Sandbox (vGPU, no network).
AI-assisted (Claude Code): the investigation, the change and the runs were automated; I reviewed the diff and the results.
🤖 Generated with Claude Code