Repository navigation
Runtime: propagate device loss found by the retire-ticket progress query (D3D-599) - #6149
abilliontokens wants to merge 1 commit into
Conversation
VulkanContext::completed_retire_ticket() queried each pending submission's timeline semaphore with vkGetSemaphoreCounterValue but treated every non-VK_SUCCESS result as "not completed yet". A VK_ERROR_DEVICE_LOST seen there was swallowed, so the context was never marked lost and the queue went on to acquire, record and submit new command buffers. Every other counter query in the layer (the queue's own progress query in VulkanQueue::completed(), VulkanFence::completed(), the wait and submit paths) already calls mark_device_lost() on VK_ERROR_DEVICE_LOST; this one was the exception. acquire() runs completed_retire_ticket() before recycle_finished()'s completed(), so whichever query runs first observes the loss. When the retire-ticket query is the first to see it, it consumes the error and the queue's own query then reads a healthy counter. That is why vk_queue_query_sync's section 5 (00832c1) failed on the RX 9070 XT / AMD 26.11.2 but passed on NVIDIA: the retire ticket is still pending there, so its query runs first. Mark the context lost here too, outside submit_mutex_ as submit() does, and report no completed ticket so nothing is retired against a lost device. Fixes D3D-599.
|
Tested
AI-assisted (Claude Code). Synthetic tests only, no game files. |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed 3a21e3aea481bb9f9d9bfe9360c5b972fb19f7bb on Windows 11, MSVC 19.44, Vulkan SDK/layer 1.4.363, RTX 5070 Ti.
cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DLEONIDA_BUILD_WINDOWS_RUNTIME=ON; built and ranvk_fence_dispatcher_sync_testandvk_queue_query_sync_test.- Both exit 0 (fence dispatcher device-loss cases ok; queue/query progress-loss case "marks context and rejects work").
git diff --checkclean. - Logic is correct: DEVICE_LOST from
vkGetSemaphoreCounterValueis recorded by reference under the lock,mark_device_lost()runs outsidesubmit_mutex_, and 0 is returned so the ticket is not mistaken for "incomplete". - Test gap: neither run exercises
completed_retire_ticketitself returning DEVICE_LOST; the existing tests cover the queue acquire/fence-dispatch paths. A one-case mock test would lock this in. - Independent of 6107 (same theme, different function); no stack.
Verdict: mergeable; test gap only. First-frame: if the earliest submissions report DEVICE_LOST, the context is now marked lost instead of polling incomplete tickets.
|
Tested
AI-assisted (Claude Mythos 5.2). |
|
Tested 3a21e3a on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: pass
AI-assisted (Claude Code). |
The kit now ships gta6rt-final.exe (base ba4b0bd + ItsNotRexed#3777 + ItsNotRexed#5867/ItsNotRexed#5808/ItsNotRexed#5851 + ItsNotRexed#6230 @ 255efe0 + ItsNotRexed#6107/ItsNotRexed#6149 + runtime layer 7bce00b + ItsNotRexed#6351 XMemTransferMemory). Prefer it, fall back to gta6rt-final-pre-xmem.exe, then to the trace-only gta6rt.exe; verify the selected binary's hash and the five strings that decide capture and the Series startup path. Add the discover-presentx-slot.ps1 helper and its launch-exeday.ps1 bin caveat.
D3D-599 —
vk_queue_query_syncprogress-counter device loss not propagated on AMDFixes board item D3D-599 (#313):
vk_queue_query_syncfailed on an RX 9070 XT (AMD 26.11.2, Windows) at main561b65a8withprogress counter device loss NOT propagated(the check00832c18added). It passed at3faac557.AI-assisted (omp orchestrator).
Root cause (our code, not the driver)
VulkanContext::completed_retire_ticket()queries each pending submission's timeline semaphore withvkGetSemaphoreCounterValuethroughRetireTickets::completed, but treated every non-VK_SUCCESSresult as "this ticket has not completed yet":A
VK_ERROR_DEVICE_LOSTseen there was swallowed — the context was never marked lost, so the queue went on to acquire, record and submit new command buffers. Every other counter query in the layer already propagates it:VulkanQueue::completed()(the queue's own progress semaphore),VulkanFence::completed(), and the wait/submit paths all callmark_device_lost()onVK_ERROR_DEVICE_LOST. This one was the exception.VulkanQueue::acquire()runscompleted_retire_ticket()beforerecycle_finished()'scompleted(), so whichever query runs first observes the loss. When the retire-ticket query is first, it consumes the error and the queue's own query then reads a healthy counter. That is why the failure is driver/timing dependent: on the AMD driver the retire ticket is still pending at that point, so its query runs first; on NVIDIA the queue's owncompleted()happens to observe it. It is not AMD-specific driver behaviour — the layer dropped the error on any driver where the ordering went this way.Fix
Mark the context lost when the retire-ticket query returns
VK_ERROR_DEVICE_LOST, and report no completed ticket so nothing is retired against a lost device.mark_device_lost()is called outsidesubmit_mutex_, matchingsubmit()'s existing pattern (notifying the fence dispatcher can run callbacks that submit). No test change:vk_queue_query_sync's section 5 (added by00832c18) is the regression test and now passes.Relation to other open PRs
fix/vk-retire-wait-lifetime-and-loss) and Runtime: forward unconsumed held waits in queue order and handle device loss in signal/marker/release_ready #6081 (fix/vk-queue-held-wait-and-signal-loss), both by emirhan-karaca, touchruntime/src/vulkan_backend.hdevice-loss handling but notcompleted_retire_ticket(): Runtime: defer progress semaphore destruction during wait_retire_ticket and propagate device loss #6107 rewriteswait_retire_ticket()'svkWaitSemaphoresloop and~VulkanQueue(), Runtime: forward unconsumed held waits in queue order and handle device loss in signal/marker/release_ready #6081 handlessignal()/marker()/release_ready(). Neither propagatesVK_ERROR_DEVICE_LOSTfrom the retire-ticket counter query, so neither fixes D3D-599. This change is independent of both (different functions, no shared lines) and needs noDepends on:.fix/vulkan-retire-idle-device-loss-20261122) does fix the samecompleted_retire_ticket()swallow (plusVulkanQueue::idle()), but it is currently CONFLICTING with main and does not claim D3D-599. If Runtime: propagate device loss from global retirement and queue idle #4526 lands first this can be closed as superseded.Tested
3a21e3aea(head ofd3d599-progress-counter, based on main561b65a8)RelWithDebInfo, Vulkan SDK 1.4.363.0Commands and results:
Also verified the unfixed code on NVIDIA passes (the bug is ordering-dependent, not NVIDIA-safe by design) and the unfixed code on AMD fails, confirming the layer — not the driver — dropped the error.
No game files, no game data.