mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:50:53 +01:00
[PR #1028] [MERGED] vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO) #1065
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#1065
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/1028
Author: @quartz-heron-58
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:device-fault📝 Commits (6)
da74b96vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO)35e38bavulkan: a loss the driver shows only as a counter of UINT64_MAX is recordedef0cc42Merge main (6261ca91) into device-fault3bc03baMerge main (4a50cafc) into device-faultcf4f434Merge main (82f033512) into device-fault; keep only the fence-counter loss427abf2vulkan_backend: name only the driver versions the counter loss was seen on📊 Changes
3 files changed (+146 additions, -0 deletions)
View changed files
📝
runtime/CMakeLists.txt(+16 -0)📝
runtime/src/vulkan_backend.h(+16 -0)➕
runtime/test/vk_fence_lost_by_counter_test.cpp(+114 -0)📄 Description
Claimed in the coordination issue as: RT-DEVICE-FAULT-INFO (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137960817)
Depends on: #980 (RT-DEVICE-LOST-LOG). This branch is #980's commit
5c1f77e1plus two of mine, so until #980 merges the diff here shows its commit too. It builds onset_device_lostand changes none of #980's lines apart from using its return value.What and why
#980 makes the layer say once that its Vulkan device was lost. This adds why, as far as the driver will tell, and fixes one way the loss was never noticed at all.
1. The driver's fault report. Where the device has
VK_EXT_device_fault(featuredeviceFault), the extension is enabled at device creation and, the first time the device is lost,vkGetDeviceFaultInfoEXTis queried and its report printed after #980's line: the description, each address fault (type, address, precision) and each vendor fault (description, code, data). At most 16 of each are printed, then a count of the rest. The vendor binary is not requested anddeviceFaultVendorBinarystays off. Without the extension the entry point is null and nothing is printed or changed.runtime/src/vulkan_device_fault.hbuilds the lines from a callable, so a test can stand in for the driver.2. A loss the driver shows only through a counter.
VulkanFence::completed()returned whatevervkGetSemaphoreCounterValuewrote when the call succeeded. On NVIDIA 621.24 (RTX 4080) a lost device is first visible there asVK_SUCCESSwith a counter ofUINT64_MAX;vkWaitSemaphoreson that semaphore with timeout 0 also returnsVK_SUCCESS. The value went to the title through the fence slot 12 mirror, the title took its device-removed path, and the layer's lost flag was never set. With #980 applied on its own, that run prints no "device was lost" line.completed()now treatsUINT64_MAXas a question, not proof: it callsvkDeviceWaitIdleunder the submit lock and records the loss only onVK_ERROR_DEVICE_LOST. Measured on the same driver:vkGetDeviceFaultInfoEXTreturnsVK_ERROR_UNKNOWN(-13) before a call has returnedVK_ERROR_DEVICE_LOST, and answers aftervkDeviceWaitIdlehas.Open point for review:
vkDeviceWaitIdleundersubmit_mutex()insidecompleted(). Its callers (GetCompletedValue,Signal,SetEventOnCompletionind3d12_com.cpp) do not hold that lock, and the call returns at once on a lost device, but a counter that really isUINT64_MAXon a live device would wait for the queues. No fence of the layer is signalled to that value.Where this came from
@DadaCap's
boot-prototype(9173e790) withLEONIDA_LAZY_PSO=1andLEONIDA_GPU_REGION_MB=10240, own 1.0.2.1 copy, RTX 4080, driver 621.24, Windows 11 26300: the retail run reaches the first-run menus and stops 70 to 95 s in, right after they are accepted, at the title's device-removedint3(the one #980 describes), 12 runs of 12. The Windows event log hasnvlddmkmevent 153 at the same second each time. Not memory (same with 12 GB free), not the OBS capture layer (same with it disabled), and the Khronos validation layer reports no error before it apart from oneSYNC-HAZARD-WRITE-AFTER-WRITEon two smallvkCmdCopyBufferwrites to the arena buffer.With this branch cherry-picked onto the prototype the log reads:
Three runs gave two or three faults, all
INSTRUCTION_POINTER_UNKNOWN, at addresses within 0x300 of each other (0x2000af410to0x2000af700). No read or write of an invalid address is reported, so the cause is still open; the addresses are GPU addresses from the driver, not title addresses. The driver also offers a 166,156-byte vendor binary, which this change does not collect.Tested
Native Windows 11, MSVC 14.44, Ninja, RelWithDebInfo, branch on
main1504c1af+ #980, RTX 4080 (driver 621.24), Vulkan SDK 1.4.363:vk_device_fault_test(no GPU, a stand-in driver): the lines for a report with address and vendor faults; the two-call shape with the vendor binary size set to 0; a failed count query and a failed report query; an empty report; an unterminated description; more faults than the print limit; counts written back larger than the room given; an unknown address type; andreport_device_faultwith a null entry point printing nothing. Passes.vk_fence_lost_by_counter_test(driver functions interposed on a real device, skips with 77 without one):UINT64_MAXwithvkDeviceWaitIdlereturningVK_ERROR_DEVICE_LOSTmarks the context lost, says the loss once and prints one fault report; a second read and a latermark_device_lost()say nothing more;UINT64_MAXwithvkDeviceWaitIdlereturningVK_SUCCESSrecords no loss; an ordinary value never reachesvkDeviceWaitIdle. Passes.ctest -R 'vk_device_fault|vk_fence|d3d12_fence|d3d12_cross_device_validation|vk_queue': 11 of 11 pass, #980'svk_fence_dispatcher_syncandd3d12_fence_device_lost_counteramong them.gta6rtbuilds with no new warning in the changed files. The fullctestsuite was not run.VK_EXT_device_fault.GPUs tested: NVIDIA GeForce RTX 4080, driver 621.24, Windows 11 26300 (the tests above and the retail run).
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.