vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO) #1028

Manually merged
github merged 6 commits from gh-pr/1028/head into gh-pr/1028/base 2026-11-26 09:34:15 +00:00
Owner

@⁠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 UTC

Claimed in the coordination issue as: RT-DEVICE-FAULT-INFO (#14)

Depends on: #980 (RT-DEVICE-LOST-LOG). This branch is #980's commit 5c1f77e1 plus two of mine, so until #980 merges the diff here shows its commit too. It builds on set_device_lost and 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 (feature deviceFault), the extension is enabled at device creation and, the first time the device is lost, vkGetDeviceFaultInfoEXT is 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 and deviceFaultVendorBinary stays off. Without the extension the entry point is null and nothing is printed or changed. runtime/src/vulkan_device_fault.h builds 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 whatever vkGetSemaphoreCounterValue wrote when the call succeeded. On NVIDIA 621.24 (RTX 4080) a lost device is first visible there as VK_SUCCESS with a counter of UINT64_MAX; vkWaitSemaphores on that semaphore with timeout 0 also returns VK_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 treats UINT64_MAX as a question, not proof: it calls vkDeviceWaitIdle under the submit lock and records the loss only on VK_ERROR_DEVICE_LOST. Measured on the same driver: vkGetDeviceFaultInfoEXT returns VK_ERROR_UNKNOWN (-13) before a call has returned VK_ERROR_DEVICE_LOST, and answers after vkDeviceWaitIdle has.

Open point for review: vkDeviceWaitIdle under submit_mutex() inside completed(). Its callers (GetCompletedValue, Signal, SetEventOnCompletion in d3d12_com.cpp) do not hold that lock, and the call returns at once on a lost device, but a counter that really is UINT64_MAX on 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) with LEONIDA_LAZY_PSO=1 and LEONIDA_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-removed int3 (the one #980 describes), 12 runs of 12. The Windows event log has nvlddmkm event 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 one SYNC-HAZARD-WRITE-AFTER-WRITE on two small vkCmdCopyBuffer writes to the arena buffer.

With this branch cherry-picked onto the prototype the log reads:

[rt] vulkan: the device was lost (a fence's counter read UINT64_MAX and vkDeviceWaitIdle then returned VK_ERROR_DEVICE_LOST); its fences now read UINT64_MAX and device calls return DXGI_ERROR_DEVICE_REMOVED
[rt] vulkan: the driver's fault report (VK_EXT_device_fault): no description
[rt] vulkan:   address fault 0: instruction pointer, cause unknown, address 0x2000af700, precision 0x10
[rt] vulkan:   address fault 1: instruction pointer, cause unknown, address 0x2000af6f0, precision 0x10

Three runs gave two or three faults, all INSTRUCTION_POINTER_UNKNOWN, at addresses within 0x300 of each other (0x2000af410 to 0x2000af700). 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 main 1504c1af + #980, RTX 4080 (driver 621.24), Vulkan SDK 1.4.363:

  • New 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; and report_device_fault with a null entry point printing nothing. Passes.
  • New vk_fence_lost_by_counter_test (driver functions interposed on a real device, skips with 77 without one): UINT64_MAX with vkDeviceWaitIdle returning VK_ERROR_DEVICE_LOST marks the context lost, says the loss once and prints one fault report; a second read and a later mark_device_lost() say nothing more; UINT64_MAX with vkDeviceWaitIdle returning VK_SUCCESS records no loss; an ordinary value never reaches vkDeviceWaitIdle. Passes.
  • ctest -R 'vk_device_fault|vk_fence|d3d12_fence|d3d12_cross_device_validation|vk_queue': 11 of 11 pass, #980's vk_fence_dispatcher_sync and d3d12_fence_device_lost_counter among them.
  • gta6rt builds with no new warning in the changed files. The full ctest suite was not run.
  • The retail lines above are from the prototype with these two commits and #980 cherry-picked; that tree is not this branch.
  • Not run: Linux, Wine, AMD, Intel, and a device without 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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator change.)

🤖 Generated with Claude Code

**@⁠quartz-heron-58** on GitHub · 2026-11-24 17:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028) `quartz-heron-58:device-fault` → `main` · +146 −0 · 3 files · 6 commits · merged 2026-11-25 03:19 UTC Claimed in the coordination issue as: RT-DEVICE-FAULT-INFO (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Depends on: #980 (RT-DEVICE-LOST-LOG). This branch is #980's commit `5c1f77e1` plus two of mine, so until #980 merges the diff here shows its commit too. It builds on `set_device_lost` and 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` (feature `deviceFault`), the extension is enabled at device creation and, the first time the device is lost, `vkGetDeviceFaultInfoEXT` is 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 and `deviceFaultVendorBinary` stays off. Without the extension the entry point is null and nothing is printed or changed. `runtime/src/vulkan_device_fault.h` builds 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 whatever `vkGetSemaphoreCounterValue` wrote when the call succeeded. On NVIDIA 621.24 (RTX 4080) a lost device is first visible there as `VK_SUCCESS` with a counter of `UINT64_MAX`; `vkWaitSemaphores` on that semaphore with timeout 0 also returns `VK_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 treats `UINT64_MAX` as a question, not proof: it calls `vkDeviceWaitIdle` under the submit lock and records the loss only on `VK_ERROR_DEVICE_LOST`. Measured on the same driver: `vkGetDeviceFaultInfoEXT` returns `VK_ERROR_UNKNOWN` (-13) before a call has returned `VK_ERROR_DEVICE_LOST`, and answers after `vkDeviceWaitIdle` has. Open point for review: `vkDeviceWaitIdle` under `submit_mutex()` inside `completed()`. Its callers (`GetCompletedValue`, `Signal`, `SetEventOnCompletion` in `d3d12_com.cpp`) do not hold that lock, and the call returns at once on a lost device, but a counter that really is `UINT64_MAX` on 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`) with `LEONIDA_LAZY_PSO=1` and `LEONIDA_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-removed `int3` (the one #980 describes), 12 runs of 12. The Windows event log has `nvlddmkm` event 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 one `SYNC-HAZARD-WRITE-AFTER-WRITE` on two small `vkCmdCopyBuffer` writes to the arena buffer. With this branch cherry-picked onto the prototype the log reads: ``` [rt] vulkan: the device was lost (a fence's counter read UINT64_MAX and vkDeviceWaitIdle then returned VK_ERROR_DEVICE_LOST); its fences now read UINT64_MAX and device calls return DXGI_ERROR_DEVICE_REMOVED [rt] vulkan: the driver's fault report (VK_EXT_device_fault): no description [rt] vulkan: address fault 0: instruction pointer, cause unknown, address 0x2000af700, precision 0x10 [rt] vulkan: address fault 1: instruction pointer, cause unknown, address 0x2000af6f0, precision 0x10 ``` Three runs gave two or three faults, all `INSTRUCTION_POINTER_UNKNOWN`, at addresses within 0x300 of each other (`0x2000af410` to `0x2000af700`). 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 `main` `1504c1af` + #980, RTX 4080 (driver 621.24), Vulkan SDK 1.4.363: - New `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; and `report_device_fault` with a null entry point printing nothing. Passes. - New `vk_fence_lost_by_counter_test` (driver functions interposed on a real device, skips with 77 without one): `UINT64_MAX` with `vkDeviceWaitIdle` returning `VK_ERROR_DEVICE_LOST` marks the context lost, says the loss once and prints one fault report; a second read and a later `mark_device_lost()` say nothing more; `UINT64_MAX` with `vkDeviceWaitIdle` returning `VK_SUCCESS` records no loss; an ordinary value never reaches `vkDeviceWaitIdle`. Passes. - `ctest -R 'vk_device_fault|vk_fence|d3d12_fence|d3d12_cross_device_validation|vk_queue'`: 11 of 11 pass, #980's `vk_fence_dispatcher_sync` and `d3d12_fence_device_lost_counter` among them. - `gta6rt` builds with no new warning in the changed files. The full `ctest` suite was not run. - The retail lines above are from the prototype with these two commits and #980 cherry-picked; that tree is not this branch. - Not run: Linux, Wine, AMD, Intel, and a device without `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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator change.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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 <[email protected]>
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 <[email protected]>
Brings in the tfe fixture fix (#892) that the Runtime workflow's GPU tests need.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings in the RSSetScissorRects fix (#1286) that d3d12_close_parity needs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Main now has its own device-fault report (LEONIDA_DEVICE_FAULT=1, from #984)
and #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 <[email protected]>
A comment-only change: 621.24 was measured, 617.14 was reported by another tester.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:34:12 +00:00
github manually merged commit 427abf2613 into gh-pr/1028/base 2026-11-26 09:34:15 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 17:15 UTC · original · approved these changes

Verified on exact head 35e38baee3 (base fce586c6d6). 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.

**@⁠KernelSmoker** on GitHub · 2026-11-24 17:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#pullrequestreview-6043983553) · **approved these changes** Verified on exact head 35e38baee361f55cdbcb0c7b9febe4b48481fdcf (base fce586c6d6f74160eccff015d9806e179188d862). 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.
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:16 UTC · original

Tested 35e38baee on Arch Linux + NVIDIA RTX 3060 Ti + Wine 11.22:

  1. **Unit/Vulkan tests (Usage

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)
  1. Retail 1.0.2.1 boot (stacked with #974 00fc23b9a under Wine 11.22):
    Confirmed VK_EXT_device_fault fires and prints the fault report right before queue slot 31 and the title's 0x142474606 int3:
    [rt] vulkan: the device was lost (vkWaitSemaphores in the fence dispatcher returned VK_ERROR_DEVICE_LOST); its fences now read UINT64_MAX and device calls return DXGI_ERROR_DEVICE_REMOVED
    [rt] vulkan: the driver's fault report (VK_EXT_device_fault): no description
    [rt] vulkan:   address fault 0: instruction pointer of a fault, address 0xdf7e44e0e0, precision 0x10
    [rt] vulkan:   address fault 1: read of an invalid address, address 0xe797d1f000, precision 0x1000
    

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7141849687) Tested `35e38baee` on Arch Linux + NVIDIA RTX 3060 Ti + Wine 11.22: 1. **Unit/Vulkan tests (Usage 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) 2. **Retail 1.0.2.1 boot (stacked with #974 `00fc23b9a` under Wine 11.22):** Confirmed `VK_EXT_device_fault` fires and prints the fault report right before `queue slot 31` and the title's `0x142474606` `int3`: ```text [rt] vulkan: the device was lost (vkWaitSemaphores in the fence dispatcher returned VK_ERROR_DEVICE_LOST); its fences now read UINT64_MAX and device calls return DXGI_ERROR_DEVICE_REMOVED [rt] vulkan: the driver's fault report (VK_EXT_device_fault): no description [rt] vulkan: address fault 0: instruction pointer of a fault, address 0xdf7e44e0e0, precision 0x10 [rt] vulkan: address fault 1: read of an invalid address, address 0xe797d1f000, precision 0x1000 ``` AI-assisted: yes
Author
Owner

@⁠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.
  • This driver exposes VK_EXT_device_fault with deviceFault = true and deviceFaultVendorBinary = 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.
**@⁠iFeyz** on GitHub · 2026-11-24 19:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7142475930) 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**. - This driver exposes `VK_EXT_device_fault` with `deviceFault = true` and `deviceFaultVendorBinary = 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.
Author
Owner

@⁠quartz-heron-58 on GitHub · 2026-11-24 21:12 UTC · original

Merged current main (6261ca91) into the branch as ef0cc425, no force-push. Reason: the Runtime workflow failed on macos with cs_imgload_tfe and cs_imgload_d16_tfe, and on linux-gpu-tools with 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_counter and vk_fence_dispatcher_sync pass.
  • The one failure is 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:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7144621643) Merged current main (6261ca91) into the branch as ef0cc425, no force-push. Reason: the Runtime workflow failed on `macos` with `cs_imgload_tfe` and `cs_imgload_d16_tfe`, and on `linux-gpu-tools` with 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_counter` and `vk_fence_dispatcher_sync` pass. - The one failure is `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)
Author
Owner

@⁠quartz-heron-58 on GitHub · 2026-11-24 21:37 UTC · original

Update to the note above: #1286 fixed d3d12_close_parity on main, so I merged main again (4a50cafc) as 3bc03ba6, clean and without a force-push. On that head ctest -j 6 passes 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-24 21:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7145184143) Update to the note above: #1286 fixed `d3d12_close_parity` on main, so I merged main again (4a50cafc) as 3bc03ba6, clean and without a force-push. On that head `ctest -j 6` passes 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)
Author
Owner

@⁠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 behind LEONIDA_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) as cf4f434d2 and took main's version of all four conflicting files. This PR's vulkan_device_fault.h, its report code in vulkan_backend.h, its VK_EXT_device_fault enabling and vk_device_fault_test are 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 when vkGetSemaphoreCounterValue itself returns VK_ERROR_DEVICE_LOST. On NVIDIA it returns VK_SUCCESS with 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() calls vkDeviceWaitIdle under the submit mutex through observe_result, and marks the device lost if that returns VK_ERROR_DEVICE_LOST. Going through observe_result means main's report runs at that point when LEONIDA_DEVICE_FAULT=1; that is also the call a driver needs to have failed before vkGetDeviceFaultInfoEXT answers. If vkDeviceWaitIdle succeeds, nothing is recorded.

vk_fence_lost_by_counter_test is 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, including vk_fence_lost_by_counter and vk_fence_dispatcher_sync.
  • Control: with main's unmodified vulkan_backend.h the new test fails at its third case (idle_calls == 1), so it does exercise the change.
  • tests/test_ctest_registration.py and tests/test_ci_registration.py: OK. check_no_game_data.py on the three files and git 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:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7151255864) 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 behind `LEONIDA_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) as cf4f434d2 and took main's version of all four conflicting files. This PR's `vulkan_device_fault.h`, its report code in `vulkan_backend.h`, its `VK_EXT_device_fault` enabling and `vk_device_fault_test` are 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 when `vkGetSemaphoreCounterValue` itself returns `VK_ERROR_DEVICE_LOST`. On NVIDIA it returns `VK_SUCCESS` with 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()` calls `vkDeviceWaitIdle` under the submit mutex through `observe_result`, and marks the device lost if that returns `VK_ERROR_DEVICE_LOST`. Going through `observe_result` means main's report runs at that point when `LEONIDA_DEVICE_FAULT=1`; that is also the call a driver needs to have failed before `vkGetDeviceFaultInfoEXT` answers. If `vkDeviceWaitIdle` succeeds, nothing is recorded. `vk_fence_lost_by_counter_test` is 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, including `vk_fence_lost_by_counter` and `vk_fence_dispatcher_sync`. - Control: with main's unmodified `vulkan_backend.h` the new test fails at its third case (`idle_calls == 1`), so it does exercise the change. - `tests/test_ctest_registration.py` and `tests/test_ci_registration.py`: OK. `check_no_game_data.py` on the three files and `git 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)
Author
Owner

@⁠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)

**@⁠quartz-heron-58** on GitHub · 2026-11-25 02:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7151303779) 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)
Author
Owner

@⁠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.

  • Claim: RT-DEVICE-FAULT-INFO, valid, before this PR. Keeping it under that item is fine.
  • What lands: VulkanFence::completed() now treats a counter of UINT64_MAX as a question: it asks vkDeviceWaitIdle under the submit lock and records the loss only on VK_ERROR_DEVICE_LOST, so a loss NVIDIA shows only through the counter reaches main's lost flag (and LEONIDA_DEVICE_FAULT=1's report). Your control run shows the new test failing with main's vulkan_backend.h.
  • Windows suite under Wine (llvmpipe and an RDNA2 iGPU, RADV): vk_fence_lost_by_counter passes on both; nothing goes from pass to fail against main.
  • Follow-up, not a blocker (your open point): a fence a title really signals to UINT64_MAX on a live device would now cost a vkDeviceWaitIdle on every completed(). Remembering that such a fence answered once (and not asking again) would remove that cost if it ever shows up.
  • Checked on main 603d8b347 + 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.py is clean on the 3 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 03:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1028#issuecomment-7151804383) Merged. Thanks: the rework onto `main`'s reporter was the right call, and what is left closes a real gap. - **Claim:** `RT-DEVICE-FAULT-INFO`, valid, before this PR. Keeping it under that item is fine. - **What lands:** `VulkanFence::completed()` now treats a counter of `UINT64_MAX` as a question: it asks `vkDeviceWaitIdle` under the submit lock and records the loss only on `VK_ERROR_DEVICE_LOST`, so a loss NVIDIA shows only through the counter reaches `main`'s lost flag (and `LEONIDA_DEVICE_FAULT=1`'s report). Your control run shows the new test failing with `main`'s `vulkan_backend.h`. - **Windows suite under Wine (llvmpipe and an RDNA2 iGPU, RADV):** `vk_fence_lost_by_counter` passes on both; nothing goes from pass to fail against `main`. - **Follow-up, not a blocker (your open point):** a fence a title really signals to `UINT64_MAX` on a live device would now cost a `vkDeviceWaitIdle` on every `completed()`. Remembering that such a fence answered once (and not asking again) would remove that cost if it ever shows up. - **Checked on `main` `603d8b347` + `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.py` is clean on the 3 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.