vulkan: with LEONIDA_DEVICE_FAULT_ROOTS a dispatch checkpoint names its own dispatch (RT-FAULT-CHECKPOINT-DISPATCH) #1934

Closed
kawaii-shakal wants to merge 7 commits from upstream-pr/1934 into main
kawaii-shakal commented 2026-11-25 16:10:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T16:10:37Z.


Claimed in the coordination issue as RT-FAULT-CHECKPOINT-DISPATCH: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167618613

Problem

The device-fault report lists the last 64 dispatches submitted across all queues. In the world-start losses of 1.0.2.1 on an RTX 5070 Ti, all 64 belonged to one late submission. That pushed out the dispatch that the NVIDIA checkpoint pointed at, which sat in an earlier submission: in one boot, execute #4605 had replaced the entries for the checkpoints of #4598, #4599 and #4601. The checkpoint gave the list and command but no groups, indirect arguments or root words.

Change

With LEONIDA_DEVICE_FAULT_ROOTS=1:

  • Each submission keeps its dispatches. Each of the 64 recent submissions keeps its own dispatch history (DeviceFaultDiagnostics::publish no longer clears it in this mode). Without the variable it is cleared as before, so the default costs nothing more.
  • The checkpoint names its dispatch. A dispatch checkpoint the driver reports is followed by checkpoint dispatch, with the dispatch at exactly that submission, list and command: groups or indirect arguments, and the 32 root words. When it isn't there, the line says so.
  • One print function. print_dispatch now prints both these lines and the global history lines, which look as they did.

docs/d3d12_vulkan.md 4.11 describes the mode.

Tested

  • vulkan_device_fault_roots (new, mode on):
    • a checkpoint at a submission's last dispatch, an indirect one with root word 5 = 42;
    • a later submission of 64 dispatches then pushes every entry of it out of the global history;
    • the report still finds and prints the dispatch.
  • Old clearing fails it: the same test fails (exit 10) with the old clearing put back.
  • vulkan_device_fault (mode off): unchanged, it passes and finds nothing extra.
  • Platform: Windows 11 Pro 26300, VS 2026 RelWithDebInfo; the test uses mocked device-fault and checkpoint entry points, no GPU.

Credit

Prototype and diagnosis by Codex (OpenAI), working with me on the same boots. I ported it to current main, which has gained the Aftermath hook and the stall checkpoints since, and added the CTest case.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5494855646 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1934). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-25T16:10:37Z. --- Claimed in the coordination issue as RT-FAULT-CHECKPOINT-DISPATCH: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167618613 ### Problem The device-fault report lists the last 64 dispatches submitted across all queues. In the world-start losses of 1.0.2.1 on an RTX 5070 Ti, all 64 belonged to one late submission. That pushed out the dispatch that the NVIDIA checkpoint pointed at, which sat in an earlier submission: in one boot, execute #4605 had replaced the entries for the checkpoints of #4598, #4599 and #4601. The checkpoint gave the list and command but no groups, indirect arguments or root words. ### Change With `LEONIDA_DEVICE_FAULT_ROOTS=1`: - **Each submission keeps its dispatches.** Each of the 64 recent submissions keeps its own dispatch history (`DeviceFaultDiagnostics::publish` no longer clears it in this mode). Without the variable it is cleared as before, so the default costs nothing more. - **The checkpoint names its dispatch.** A dispatch checkpoint the driver reports is followed by `checkpoint dispatch`, with the dispatch at exactly that submission, list and command: groups or indirect arguments, and the 32 root words. When it isn't there, the line says so. - **One print function.** `print_dispatch` now prints both these lines and the global history lines, which look as they did. `docs/d3d12_vulkan.md` 4.11 describes the mode. ### Tested - **`vulkan_device_fault_roots` (new, mode on):** - a checkpoint at a submission's last dispatch, an indirect one with root word 5 = 42; - a later submission of 64 dispatches then pushes every entry of it out of the global history; - the report still finds and prints the dispatch. - **Old clearing fails it:** the same test fails (exit 10) with the old clearing put back. - **`vulkan_device_fault` (mode off):** unchanged, it passes and finds nothing extra. - **Platform:** Windows 11 Pro 26300, VS 2026 RelWithDebInfo; the test uses mocked device-fault and checkpoint entry points, no GPU. ### Credit Prototype and diagnosis by Codex (OpenAI), working with me on the same boots. I ported it to current main, which has gained the Aftermath hook and the stall checkpoints since, and added the CTest case. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MoonEyes commented 2026-11-25 18:22:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-25T18:22:47Z.

Review: COMMENTED


LGTM

Setup: Windows 11 Pro 26300, MSVC 19.44.35230.0 (VS 2022), CMake 3.31.6 + Ninja, RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON, Vulkan SDK 1.4.363.0. main = b9320a118. Only vulkan_device_fault_test was built and run (ctest -R "^vulkan_device_fault": vulkan_device_fault, and the new vulkan_device_fault_roots with LEONIDA_DEVICE_FAULT_ROOTS=1). Not run: the whole ctest set, any game boot.

Head f6448b05b.

  • PR head: 2/2 Passed.
  • main: vulkan_device_fault Passed (1/1; the _roots test does not exist there).
  • PR merged into main locally (runtime/CMakeLists.txt auto-merged): 2/2 Passed.
  • Mutant A (PR test and CMake lines, runtime/src/vulkan_device_fault.h of main): does not build, error C2039: 'checkpoint_dispatches_found' is not a member of leonida::DeviceFaultDiagnostics (test line 164). This only shows the test needs the new accessor.
  • Mutant B (PR header with the one line if (!include_roots_) submission.dispatches.clear(); changed back to the unconditional submission.dispatches.clear();): vulkan_device_fault Passed, vulkan_device_fault_roots Failed; the executable returns 10 with the variable set and 0 without. This confirms the description's "fails (exit 10) with the old clearing put back".

The test uses mocked device-fault and checkpoint entry points, so the result does not depend on the GPU. The printed checkpoint dispatch line itself is not asserted, only the count of found dispatches.

AI-assisted: yes (Claude Code built and ran the tests)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6062814911 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1934#pullrequestreview-6062814911). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-25T18:22:47Z. **Review:** COMMENTED --- **LGTM** Setup: Windows 11 Pro 26300, MSVC 19.44.35230.0 (VS 2022), CMake 3.31.6 + Ninja, RelWithDebInfo, `-DLEONIDA_REQUIRE_VULKAN=ON`, Vulkan SDK 1.4.363.0. `main` = `b9320a118`. Only `vulkan_device_fault_test` was built and run (`ctest -R "^vulkan_device_fault"`: `vulkan_device_fault`, and the new `vulkan_device_fault_roots` with `LEONIDA_DEVICE_FAULT_ROOTS=1`). Not run: the whole `ctest` set, any game boot. Head `f6448b05b`. - PR head: 2/2 Passed. - `main`: `vulkan_device_fault` Passed (1/1; the `_roots` test does not exist there). - PR merged into `main` locally (`runtime/CMakeLists.txt` auto-merged): 2/2 Passed. - Mutant A (PR test and CMake lines, `runtime/src/vulkan_device_fault.h` of `main`): does not build, `error C2039: 'checkpoint_dispatches_found'` is not a member of `leonida::DeviceFaultDiagnostics` (test line 164). This only shows the test needs the new accessor. - Mutant B (PR header with the one line `if (!include_roots_) submission.dispatches.clear();` changed back to the unconditional `submission.dispatches.clear();`): `vulkan_device_fault` Passed, `vulkan_device_fault_roots` Failed; the executable returns 10 with the variable set and 0 without. This confirms the description's "fails (exit 10) with the old clearing put back". The test uses mocked device-fault and checkpoint entry points, so the result does not depend on the GPU. The printed `checkpoint dispatch` line itself is not asserted, only the count of found dispatches. AI-assisted: yes (Claude Code built and ran the tests)
djrolfes commented 2026-11-26 06:40:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-26T06:40:50Z.


Independent real-fault exercise of ac16dbe (not current headd05321a8), local f448c712a Linux/Wine11.22/RTX3070Ti/NVIDIA620.73.04: GPU loss at474.73s with ROOTS=1. Three compute checkpoint submissions recover their exact dispatch root records; another compute checkpoint says its dispatch is not in that submission history. A direct-queue draw checkpoint remains outside this dispatch-only feature. No attribution to the last shader label.

The missing compute record has a specific bounded-history explanation: that submission contains many later dispatches, so its early checkpoint is outside CheckpointSubmission::dispatch_limit=64 (vulkan_device_fault.h:175-180), even though retaining the submission fixes cross-submission eviction.

CPU-only reduction with the exact existing vulkan_device_fault_test: original mocked checkpoint at command70 passes with ROOTS=1. Changing only the reported checkpoint to command0 (already evicted by that same71-dispatch submission) gives the missing-history line and expected test exit10. Both compiled/reran natively with Clang23 C++20 ASan+UBSan; no sanitizer report. This is a diagnostic coverage limit, NOT a reproduction of the GPU fault. I am not implementing a second history scheme or treating your current bounded behavior as an undocumented promise violation.

Please consider retaining early checkpoint-selectable dispatches or explicitly documenting this within-submission limit in your existing ownership. All raw retail content stays local. AI-assisted (OpenAI GPT-6.1 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7184671999 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1934#issuecomment-7184671999). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-26T06:40:50Z. --- Independent real-fault exercise of ac16dbe (not current headd05321a8), local f448c712a Linux/Wine11.22/RTX3070Ti/NVIDIA620.73.04: GPU loss at474.73s with ROOTS=1. Three compute checkpoint submissions recover their exact dispatch root records; another compute checkpoint says its dispatch is not in that submission history. A direct-queue draw checkpoint remains outside this dispatch-only feature. No attribution to the last shader label. The missing compute record has a specific bounded-history explanation: that submission contains many later dispatches, so its early checkpoint is outside CheckpointSubmission::dispatch_limit=64 (vulkan_device_fault.h:175-180), even though retaining the submission fixes cross-submission eviction. CPU-only reduction with the exact existing vulkan_device_fault_test: original mocked checkpoint at command70 passes with ROOTS=1. Changing only the reported checkpoint to command0 (already evicted by that same71-dispatch submission) gives the missing-history line and expected test exit10. Both compiled/reran natively with Clang23 C++20 ASan+UBSan; no sanitizer report. This is a diagnostic coverage limit, NOT a reproduction of the GPU fault. I am not implementing a second history scheme or treating your current bounded behavior as an undocumented promise violation. Please consider retaining early checkpoint-selectable dispatches or explicitly documenting this within-submission limit in your existing ownership. All raw retail content stays local. AI-assisted (OpenAI GPT-6.1 Sol).
kawaii-shakal commented 2026-11-26 12:08:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-26T12:08:46Z.


@djrolfes thanks for the real-fault run. The missing line was the 64-dispatch per-submission ring, as you found.
Claude Code (AI-assisted) changed this in bf1fce7f: I went with keeping the dispatches rather than only documenting
the limit.

  • With LEONIDA_DEVICE_FAULT_ROOTS=1 a submission now keeps up to its last 1,024 dispatches
    (CheckpointSubmission::roots_dispatch_limit). Without the flag it keeps 64 as before, and the global history
    still takes only each submission's last 64. At about 250 bytes a dispatch this is at most 16 MiB over the 64 recent
    submissions, and only in this mode.
  • Past the limit, the report says how many dispatches the submission recorded and how many it kept, so the limit
    shows in the log. It is also documented in docs/d3d12_vulkan.md.
  • vulkan_device_fault_test now puts the checkpoint at command 3 of a 71-dispatch submission, the case from your
    log. With the old limit, vulkan_device_fault_roots fails (exit 7). With the change, both vulkan_device_fault
    and vulkan_device_fault_roots pass.

Tested: vulkan_device_fault, vulkan_device_fault_roots, vulkan_device_markers and vk_device_markers, on
Linux with Mesa lavapipe. Not built on Windows. If you can re-run your 474 s loss on this head, the compute checkpoint
in that 71-dispatch submission should now print its checkpoint dispatch line.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7191624252 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1934#issuecomment-7191624252). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-26T12:08:46Z. --- @djrolfes thanks for the real-fault run. The missing line was the 64-dispatch per-submission ring, as you found. Claude Code (AI-assisted) changed this in bf1fce7f: I went with keeping the dispatches rather than only documenting the limit. - With `LEONIDA_DEVICE_FAULT_ROOTS=1` a submission now keeps up to its last 1,024 dispatches (`CheckpointSubmission::roots_dispatch_limit`). Without the flag it keeps 64 as before, and the global history still takes only each submission's last 64. At about 250 bytes a dispatch this is at most 16 MiB over the 64 recent submissions, and only in this mode. - Past the limit, the report says how many dispatches the submission recorded and how many it kept, so the limit shows in the log. It is also documented in `docs/d3d12_vulkan.md`. - `vulkan_device_fault_test` now puts the checkpoint at command 3 of a 71-dispatch submission, the case from your log. With the old limit, `vulkan_device_fault_roots` fails (exit 7). With the change, both `vulkan_device_fault` and `vulkan_device_fault_roots` pass. Tested: `vulkan_device_fault`, `vulkan_device_fault_roots`, `vulkan_device_markers` and `vk_device_markers`, on Linux with Mesa lavapipe. Not built on Windows. If you can re-run your 474 s loss on this head, the compute checkpoint in that 71-dispatch submission should now print its `checkpoint dispatch` line. --- _Generated by [Claude Code](https://claude.ai/code)_
zmasi commented 2026-11-28 13:12:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T13:12:15Z.


#1934 | head bf1fce7fe1 (merged cleanly with main d48a957bb9) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vulkan_device_fault|vulkan_device_fault_roots|vulkan_device_markers|vk_device_markers|d3d12_compute)$" --output-on-failure (LEONIDA_VK_VALIDATION=1) + python -I tests/test_docs_encoding.py | red on main: vulkan_device_fault_test.cpp fails to compile against main's vulkan_device_fault.h (roots_dispatch_limit / keep / checkpoint_dispatches_found absent) | green on PR+main: 5/5 CTests pass (vulkan_device_fault mode off, vulkan_device_fault_roots mode on recovering early command-3 checkpoint dispatch after 64-dispatch eviction, vulkan_device_markers, vk_device_markers, and d3d12_compute) on RTX 3090 with 0 Khronos validation errors; test_docs_encoding.py and check_no_game_data.py 0 violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239767608 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1934#issuecomment-7239767608). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T13:12:15Z. --- #1934 | head bf1fce7fe1d74945b8f1792abb00470305037201 (merged cleanly with main d48a957bb9988afce424552a3c0c8d01ef12320f) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vulkan_device_fault|vulkan_device_fault_roots|vulkan_device_markers|vk_device_markers|d3d12_compute)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`) + `python -I tests/test_docs_encoding.py` | red on main: `vulkan_device_fault_test.cpp` fails to compile against `main`'s `vulkan_device_fault.h` (`roots_dispatch_limit` / `keep` / `checkpoint_dispatches_found` absent) | green on PR+main: 5/5 CTests pass (`vulkan_device_fault` mode off, `vulkan_device_fault_roots` mode on recovering early command-3 `checkpoint dispatch` after 64-dispatch eviction, `vulkan_device_markers`, `vk_device_markers`, and `d3d12_compute`) on RTX 3090 with `0` Khronos validation errors; `test_docs_encoding.py` and `check_no_game_data.py` `0` violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
enlight3d commented 2026-11-29 15:32:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T15:32:10Z.


Run on 8de9cc982 (PR head), merged locally with main 50d09b373. Prep notes by TheGeogeo's review session.

  • Merge: clean (git merge --no-ff pr-1934; auto-merged docs/d3d12_vulkan.md and runtime/CMakeLists.txt). The conflicts the notes expected with #2511 and #1918 did not show up against this main. Merged commit 1787de622, local only.
  • Build: cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON, then cmake --build build --target vulkan_device_fault_test gta6rt -j 6.

Green (merged build)

  • ctest -R "^vulkan_device_fault(_roots)?$" --output-on-failure -j1: 2/2 passed (vulkan_device_fault 0.06 s, vulkan_device_fault_roots 0.05 s). The test uses mocked device-fault entry points, so no GPU work is involved.

Red

  • Non-test change reverted (vulkan_device_fault.h and the doc to main, test and CMake lines kept): does not build, the test uses CheckpointSubmission::keep, roots_dispatch_limit and DeviceFaultDiagnostics::checkpoint_dispatches_found (C2039 at test lines 133 to 169). This only shows the test needs the new API.
  • Behavioural red (PR header with the single line if (!include_roots_) submission.dispatches.clear(); changed back to the unconditional submission.dispatches.clear();): builds; vulkan_device_fault (mode off) still passes, vulkan_device_fault_roots fails, and the executable exits 10 with LEONIDA_DEVICE_FAULT_ROOTS=1, matching the description ("fails (exit 10) with the old clearing put back").

Link: gta6rt.exe of the merged build: no new imports vs main (703 imports, identical lists with dumpbin /imports).

Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1. One run each.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258166292 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1934#issuecomment-7258166292). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T15:32:10Z. --- Run on `8de9cc982` (PR head), merged locally with `main` `50d09b373`. Prep notes by TheGeogeo's review session. - **Merge:** clean (`git merge --no-ff pr-1934`; auto-merged `docs/d3d12_vulkan.md` and `runtime/CMakeLists.txt`). The conflicts the notes expected with #2511 and #1918 did not show up against this `main`. Merged commit `1787de622`, local only. - **Build:** `cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`, then `cmake --build build --target vulkan_device_fault_test gta6rt -j 6`. **Green (merged build)** - `ctest -R "^vulkan_device_fault(_roots)?$" --output-on-failure -j1`: 2/2 passed (`vulkan_device_fault` 0.06 s, `vulkan_device_fault_roots` 0.05 s). The test uses mocked device-fault entry points, so no GPU work is involved. **Red** - Non-test change reverted (`vulkan_device_fault.h` and the doc to `main`, test and CMake lines kept): does not build, the test uses `CheckpointSubmission::keep`, `roots_dispatch_limit` and `DeviceFaultDiagnostics::checkpoint_dispatches_found` (C2039 at test lines 133 to 169). This only shows the test needs the new API. - Behavioural red (PR header with the single line `if (!include_roots_) submission.dispatches.clear();` changed back to the unconditional `submission.dispatches.clear();`): builds; `vulkan_device_fault` (mode off) still passes, `vulkan_device_fault_roots` fails, and the executable exits 10 with `LEONIDA_DEVICE_FAULT_ROOTS=1`, matching the description ("fails (exit 10) with the old clearing put back"). **Link:** gta6rt.exe of the merged build: no new imports vs main (703 imports, identical lists with `dumpbin /imports`). **Machine:** RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1. One run each. AI-assisted (Claude Code).
aslan2142 commented 2026-12-01 16:39:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:39:12Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317968830 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1934#issuecomment-7317968830). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:39:12Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1934
No description provided.