Repository navigation
vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO) - #1028
Conversation
…EVICE-FAULT-INFO) Where the device has VK_EXT_device_fault, enable it and, the first time the device is lost, query vkGetDeviceFaultInfoEXT and print the description, the address faults and the vendor faults after the "device was lost" line. Nothing is printed and nothing changes without the extension. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…corded VulkanFence::completed() passed a counter of UINT64_MAX on to the title when vkGetSemaphoreCounterValue succeeded with it, so the layer never learned its device was lost. It now asks vkDeviceWaitIdle under the submit lock and records the loss on VK_ERROR_DEVICE_LOST, after which the driver answers vkGetDeviceFaultInfoEXT. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
KernelSmoker
left a comment
There was a problem hiding this comment.
Verified on exact head 35e38ba (base fce586c). Using the project-pinned Vulkan-Headers 1.4.363 and GCC 16.2, I independently built both vk_device_fault_test and vk_fence_lost_by_counter_test. The CPU report test prints vk_device_fault: ok. The counter test ran on NVIDIA GeForce RTX 3090 / driver 620.73.04, detected subgroup 32, exercised its interposed UINT64_MAX and VK_ERROR_DEVICE_LOST path plus stand-in fault report, and printed vk_fence_lost_by_counter: ok. The reported fault data is synthetic; this does not claim a real GPU fault occurred. Changed-file no-game-data and diff checks pass. This PR is stacked on still-open #980; the tested head includes that dependency, and the review is for the additional fault-report/counter handling.
|
Tested
ctest [options] on Linux):**
AI-assisted: yes |
|
AMD run (the "Not run: AMD" gap): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (Vulkan 1.4.359), Windows 11, MSVC 2022 RelWithDebInfo. Head
|
Brings in the tfe fixture fix (ProjectLeonida#892) that the Runtime workflow's GPU tests need. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Merged current main (6261ca9) into the branch as ef0cc42, no force-push. Reason: the Runtime workflow failed on Re-run on the merged head, Windows 11 build 26300, RTX 4080 (621.24), MSVC 14.44 RelWithDebInfo:
Not re-run: the retail boot, and anything on the AMD GPU. Still depends on #980. AI-assisted: yes (Claude Code) |
Brings in the RSSetScissorRects fix (ProjectLeonida#1286) that d3d12_close_parity needs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Update to the note above: #1286 fixed |
Main now has its own device-fault report (LEONIDA_DEVICE_FAULT=1, from ProjectLeonida#984) and ProjectLeonida#980's device-lost line, so this branch's vulkan_device_fault.h, its report code and vk_device_fault_test are dropped in favour of main's. What stays is the case main does not cover: a loss the driver shows only as a timeline counter of UINT64_MAX. VulkanFence::completed() then asks vkDeviceWaitIdle through observe_result, so main's report runs, and marks the device lost when that returns VK_ERROR_DEVICE_LOST. vk_fence_lost_by_counter_test is adapted to main's reporter. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
This PR is now much smaller, and its description above is out of date in the parts about the report. What happened and what is left: Why it conflicted. #980 and #984 are merged. #984 brought its own What is left (3 files, +146). The one case main does not handle: a device loss the driver shows only as a timeline counter of UINT64_MAX. On main
Tested on cf4f434, Windows 11 build 26300, RTX 4080 (621.24), MSVC 14.44 RelWithDebInfo:
Not run: the retail boot on this head, the AMD GPU, Linux, and the rest of the Python suite. I have not checked that main's report prints after this path on a real loss, only that the call is routed through If the maintainers would rather have this as a fresh PR under a new claim than under RT-DEVICE-FAULT-INFO, say so and I will do that. AI-assisted: yes (Claude Code) |
…en on A comment-only change: 621.24 was measured, 617.14 was reported by another tester. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Correction to my comment above: I named three NVIDIA driver versions (617.14, 621.14, 621.24) and "five machines" for the counter behaviour. What I can support is narrower: I measured it on 621.24 (RTX 4080), and one other tester reported it in #14 on 617.14 (RTX 5070). I have no record for 621.14, and the machine count was from memory of the earlier thread, not re-checked. The code comment said the same and is fixed in 427abf2 (comment-only; the two fence tests re-run and pass). AI-assisted: yes (Claude Code) |
|
Merged. Thanks: the rework onto
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: RT-DEVICE-FAULT-INFO (#14 (comment))
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, vulkan: say once when the device is lost (RT-DEVICE-LOST-LOG) #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