mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #2365] vulkan: a fence counter of UINT64_MAX no Signal asked for is a loss, without vkDeviceWaitIdle (RT-FENCE-MAX-CONFIRM-NO-STALL) #2368
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2368
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2365
Author: @HasiKe
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fence-max-no-stall📝 Commits (3)
63cdc82vulkan: a fence counter of UINT64_MAX no Signal asked for is a loss, without vkDeviceWaitIdle022ef7aMerge remote-tracking branch 'origin/main' into fence-max-no-stall69b1338vulkan: announce a Signal before its Vulkan call; keep the fault report's wait with diagnostics on📊 Changes
4 files changed (+90 additions, -21 deletions)
View changed files
📝
runtime/shims/d3d12_com.cpp(+1 -0)📝
runtime/src/queue_holds.h(+23 -1)📝
runtime/src/vulkan_backend.h(+18 -10)📝
runtime/test/vk_fence_lost_by_counter_test.cpp(+48 -10)📄 Description
Item: RT-FENCE-MAX-CONFIRM-NO-STALL (claim and analysis in #1608)
What and why
VulkanFence::completed(runtime/src/vulkan_backend.h) handles the NVIDIA case where a lost device first shows as a timeline counter of UINT64_MAX. It confirmed that withvkDeviceWaitIdleunder the submit lock.In a cold world-load boot on an RTX 2070 SUPER (NVIDIA 616.56), that call blocked for 270 s:
submit-lock: held 270089 ms by thread 17780, t=200.490..470.579 s. I resolved the runtime's own submit-lock stack dump against the build's PDB:Pump::run→take_landed→VulkanFence::completed→vkDeviceWaitIdle.Pump::release_loop→Fence::Signal→VulkanQueue::release_held→QueueHolds::pump_ready→execute_now→SubmitMutex::lock, in the middle of submitting a held batch.VulkanFence::completedreader, and a compile worker.Nothing could submit for 4.5 minutes, so the title froze. The loss, and the
LEONIDA_DEVICE_FAULTreport, came 270 s after the fault, so that report describes the device after the wait.QueueHolds::submitted_value(semaphore)already knows the highest value anyone asked of the fence: its initial value (add_fence), CPU Signals (signaled) and submitted Signals. This PR uses that:vkDeviceWaitIdleand no submit lock.Behaviour change, for @quartz-heron-58 (author of
35e38baee)Case 3 of
vk_fence_lost_by_counterwas "UINT64_MAX on a device that is not lost records no loss whenvkDeviceWaitIdlesucceeds". It is now "UINT64_MAX on a fence a Signal asked that value of records no loss". Two open questions from me:vkDeviceWaitIdle"is also what a driver needs to have returned beforevkGetDeviceFaultInfoEXTanswers". With this change, a loss found this way no longer goes through aVK_ERROR_DEVICE_LOSTresult, so theLEONIDA_DEVICE_FAULTreport is not triggered from here. If you want the report kept, I can add avkDeviceWaitIdleafter the loss is marked, only with the fault diagnostics on. It then stalls only diagnostic runs, and by then the context is already lost.Tests
vk_fence_lost_by_counter, rewritten:vkDeviceWaitIdle.vkDeviceWaitIdle.Results:
mainfbf100b1bthe new test fails (exit 1). With this change it passes.xbox_presentandd3d12_set_descriptor_heaps. Both also fail on unmodifiedmainfbf100b1bon this machine.xbox_presentis the known one (#2259).vk_fence_*,d3d12_fence_*,list_value_wait_budget,xbox_list_value_fallback,wait_registration_*.The 270 s stall itself came from one boot in about five, so I have not shown in a game boot that it is gone. I'll run more cold world-load boots with this change and report there.
Environment: RTX 2070 SUPER, NVIDIA 616.56, Windows 11 Pro 26300, MSVC (VS 18) RelWithDebInfo via
scripts/build_runtime.ps1 -FetchSdl3. No game files in the change or the test.AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.