vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO) #1028
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1028
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1028/head"
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?
@quartz-heron-58 on GitHub · 2026-11-24 17:03 UTC · original
quartz-heron-58:device-fault→main· +146 −0 · 3 files · 6 commits · merged 2026-11-25 03:19 UTCClaimed in the coordination issue as: RT-DEVICE-FAULT-INFO (#14)
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
6261ca91) into device-fault ef0cc4254f4a50cafc) into device-fault 3bc03ba69f82f033512) into device-fault; keep only the fence-counter loss cf4f434d23@KernelSmoker on GitHub · 2026-11-24 17:15 UTC · original · approved these changes
Verified on exact head
35e38baee3(basefce586c6d6). Using the project-pinned Vulkan-Headers 1.4.363 and GCC 16.2, I independently built bothvk_device_fault_testandvk_fence_lost_by_counter_test. The CPU report test printsvk_device_fault: ok. The counter test ran on NVIDIA GeForce RTX 3090 / driver 620.73.04, detected subgroup 32, exercised its interposedUINT64_MAXandVK_ERROR_DEVICE_LOSTpath plus stand-in fault report, and printedvk_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.@madhyn on GitHub · 2026-11-24 19:16 UTC · original
Tested
35e38baeeon Arch Linux + NVIDIA RTX 3060 Ti + Wine 11.22:ctest [options] on Linux):**
vk_fence_dispatcher_sync: Passed (0.48 s)vk_device_fault: Passed (0.00 s)vk_fence_lost_by_counter: Passed (0.17 s)00fc23b9aunder Wine 11.22):Confirmed
VK_EXT_device_faultfires and prints the fault report right beforequeue slot 31and the title's0x142474606int3:AI-assisted: yes
@iFeyz on GitHub · 2026-11-24 19:42 UTC · original
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
35e38baee:vk_fence_dispatcher_sync,vk_device_fault,vk_fence_lost_by_counter: 3 of 3 pass.VK_EXT_device_faultwithdeviceFault = trueanddeviceFaultVendorBinary = false(vulkaninfo), so on a real loss the report should carry address and vendor-info entries but no vendor binary. I have no real device loss on this machine to show it yet.@quartz-heron-58 on GitHub · 2026-11-24 21:12 UTC · original
Merged current main (
6261ca91) into the branch asef0cc425, no force-push. Reason: the Runtime workflow failed onmacoswithcs_imgload_tfeandcs_imgload_d16_tfe, and onlinux-gpu-toolswith 170 of 252 passed, 80 skipped (I read that as the same two; the job summary does not name them). This branch's older base still had those two failures and #892 has since fixed them on main. The merge was clean (three files auto-merged, no conflicts); the diff against main is unchanged at 7 files.Re-run on the merged head, Windows 11 build 26300, RTX 4080 (621.24), MSVC 14.44 RelWithDebInfo:
ctest -j 6: 315 of 316 pass.vk_device_fault,vk_fence_lost_by_counterandvk_fence_dispatcher_syncpass.d3d12_close_parity(RSSetScissorRects(17)), which fails on main itself since #510 and is claimed as D3D-SCISSOR-COUNT-PARITY. This branch does not touch that code.scripts/run_gpu_tests.py: 262 translated, 262 pass spirv-val; 204/253 passed, 49 skipped, 0 failed (native).Not re-run: the retail boot, and anything on the AMD GPU. Still depends on #980.
AI-assisted: yes (Claude Code)
@quartz-heron-58 on GitHub · 2026-11-24 21:37 UTC · original
Update to the note above: #1286 fixed
d3d12_close_parityon main, so I merged main again (4a50cafc) as3bc03ba6, clean and without a force-push. On that headctest -j 6passes 316 of 316 on the same machine (Windows 11, RTX 4080, 621.24), including the three tests this PR adds or changes. The GPU shader tests were not re-run on this head. AI-assisted: yes (Claude Code)@quartz-heron-58 on GitHub · 2026-11-25 02:50 UTC · original
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
runtime/src/vulkan_device_fault.h: a fault report behindLEONIDA_DEVICE_FAULT=1, with NVIDIA checkpoints and stall reports, which does more than the report this PR added. Keeping two reporters would be wrong, so I merged main (82f033512) ascf4f434d2and took main's version of all four conflicting files. This PR'svulkan_device_fault.h, its report code invulkan_backend.h, itsVK_EXT_device_faultenabling andvk_device_fault_testare gone. No force-push.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
VulkanFence::completed()marks the device lost only whenvkGetSemaphoreCounterValueitself returnsVK_ERROR_DEVICE_LOST. On NVIDIA it returnsVK_SUCCESSwith UINT64_MAX (reported in this thread and in #14 on 617.14, 621.14 and 621.24, five machines), so the title reads the fence as complete and takes its own removed-device path with nothing said. Now, when the counter reads UINT64_MAX,completed()callsvkDeviceWaitIdleunder the submit mutex throughobserve_result, and marks the device lost if that returnsVK_ERROR_DEVICE_LOST. Going throughobserve_resultmeans main's report runs at that point whenLEONIDA_DEVICE_FAULT=1; that is also the call a driver needs to have failed beforevkGetDeviceFaultInfoEXTanswers. IfvkDeviceWaitIdlesucceeds, nothing is recorded.vk_fence_lost_by_counter_testis adapted to main: it no longer expects this PR's report, and now also checks that a lost device answers without asking the driver again.Tested on
cf4f434d2, Windows 11 build 26300, RTX 4080 (621.24), MSVC 14.44 RelWithDebInfo:ctest -j 6: 401 of 401 pass, includingvk_fence_lost_by_counterandvk_fence_dispatcher_sync.vulkan_backend.hthe new test fails at its third case (idle_calls == 1), so it does exercise the change.tests/test_ctest_registration.pyandtests/test_ci_registration.py: OK.check_no_game_data.pyon the three files andgit diff --check: clean.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
observe_result.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)
@quartz-heron-58 on GitHub · 2026-11-25 02:52 UTC · original
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
427abf261(comment-only; the two fence tests re-run and pass). AI-assisted: yes (Claude Code)@aslan2142 on GitHub · 2026-11-25 03:19 UTC · original
Merged. Thanks: the rework onto
main's reporter was the right call, and what is left closes a real gap.RT-DEVICE-FAULT-INFO, valid, before this PR. Keeping it under that item is fine.VulkanFence::completed()now treats a counter ofUINT64_MAXas a question: it asksvkDeviceWaitIdleunder the submit lock and records the loss only onVK_ERROR_DEVICE_LOST, so a loss NVIDIA shows only through the counter reachesmain's lost flag (andLEONIDA_DEVICE_FAULT=1's report). Your control run shows the new test failing withmain'svulkan_backend.h.vk_fence_lost_by_counterpasses on both; nothing goes from pass to fail againstmain.UINT64_MAXon a live device would now cost avkDeviceWaitIdleon everycompleted(). Remembering that such a fence answered once (and not asking again) would remove that cost if it ever shows up.main603d8b347+427abf261: it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 3 changed files.AI-assisted (Claude Code, Claude Opus 5.5).