tests: cover retire-ticket device loss #1298

Closed
Okachamie wants to merge 1 commit from upstream-pr/1298 into main
Okachamie commented 2026-11-24 21:28:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Okachamie on 2026-11-24T21:28:50Z.


Claimed in the coordination issue as: TEST-RETIRE-TICKET-DEVICE-LOSS

What and why

VulkanContext::completed_retire_ticket() can be the first Vulkan operation to discover VK_ERROR_DEVICE_LOST. The merged #408 fix marks the context lost and retires nothing in that case, but the existing regression injects the error into the queue's own progress-semaphore query instead. Which query observes the loss first depends on the driver, so the current test can pass on NVIDIA while failing on AMD.

Add a deterministic case with a fresh context and one pending submission. Inject VK_ERROR_DEVICE_LOST into the retire-ticket counter query, then require a zero completed ticket, a lost context, and exactly one intercepted error. The existing progress-query case now compares interception-count deltas so both cases can run together.

Tested

  • Rebased onto current main at 4a50cafc7af8b5a842c85a3794b286232495068d; proposed commit f1ff7d05a75c4a8526afc9838095ae21459c3bb9.
  • cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo configured successfully.
  • cmake --build runtime/build --target vk_queue_query_sync_test -j2 passed.
  • ctest --test-dir runtime/build -R '^vk_queue_query_sync$' --output-on-failure: 1/1 passed.
  • Five direct runs of runtime/build/vk_queue_query_sync_test: 5/5 passed.
  • Pre-fix control in a scratch copy, reversing only the #408 completed_retire_ticket() hunk: the new test failed at retire_context.is_device_lost().
  • python -I scripts/check_no_game_data.py runtime/test/vk_queue_query_sync_test.cpp passed.
  • git diff --check HEAD^ HEAD passed.
  • LEONIDA_VK_VALIDATION=1 skipped because VK_LAYER_KHRONOS_validation is not installed on this host.

GPUs tested: NVIDIA GeForce RTX 5090 Laptop GPU, NVIDIA 620.73.04, CachyOS 7.3.5-2-cachyos.

AI-assisted: yes

Checklist

  • Based on current main at 4a50cafc7af8b5a842c85a3794b286232495068d and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • New translator rule in docs/design.md (n/a for this test-only change).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480643281 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1298). Originally posted by [Okachamie](https://github.com/Okachamie) on 2026-11-24T21:28:50Z. --- Claimed in the coordination issue as: [TEST-RETIRE-TICKET-DEVICE-LOSS](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144846738) ### What and why `VulkanContext::completed_retire_ticket()` can be the first Vulkan operation to discover `VK_ERROR_DEVICE_LOST`. The merged #408 fix marks the context lost and retires nothing in that case, but the existing regression injects the error into the queue's own progress-semaphore query instead. Which query observes the loss first depends on the driver, so the current test can pass on NVIDIA while failing on AMD. Add a deterministic case with a fresh context and one pending submission. Inject `VK_ERROR_DEVICE_LOST` into the retire-ticket counter query, then require a zero completed ticket, a lost context, and exactly one intercepted error. The existing progress-query case now compares interception-count deltas so both cases can run together. ### Tested - Rebased onto current `main` at `4a50cafc7af8b5a842c85a3794b286232495068d`; proposed commit `f1ff7d05a75c4a8526afc9838095ae21459c3bb9`. - `cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo` configured successfully. - `cmake --build runtime/build --target vk_queue_query_sync_test -j2` passed. - `ctest --test-dir runtime/build -R '^vk_queue_query_sync$' --output-on-failure`: 1/1 passed. - Five direct runs of `runtime/build/vk_queue_query_sync_test`: 5/5 passed. - Pre-fix control in a scratch copy, reversing only the #408 `completed_retire_ticket()` hunk: the new test failed at `retire_context.is_device_lost()`. - `python -I scripts/check_no_game_data.py runtime/test/vk_queue_query_sync_test.cpp` passed. - `git diff --check HEAD^ HEAD` passed. - `LEONIDA_VK_VALIDATION=1` skipped because `VK_LAYER_KHRONOS_validation` is not installed on this host. GPUs tested: NVIDIA GeForce RTX 5090 Laptop GPU, NVIDIA 620.73.04, CachyOS 7.3.5-2-cachyos. AI-assisted: yes ### Checklist - [x] Based on current `main` at `4a50cafc7af8b5a842c85a3794b286232495068d` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [ ] New translator rule in `docs/design.md` (n/a for this test-only change).
PierreEbele commented 2026-11-25 14:55:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:55:00Z.


Reviewed f1ff7d0: compiled and ran runtime/test/vk_queue_query_sync_test.cpp against both the PR head and a current-main tree with the PR's test file, on llvmpipe (software Vulkan 1.3): all sections pass on both, including the new retire-ticket device-loss section; the relative-counter change in section 6 is needed and correct (the merged run reports 3 injected counter errors vs 2 without the new section). Two asks for the author: state the coordination-issue item ID in the PR if it is not there, and per AGENTS.md say it is AI-assisted and what it was run on (this commit message has no body at all). AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166015460 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1298#issuecomment-7166015460). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:55:00Z. --- Reviewed f1ff7d0: compiled and ran runtime/test/vk_queue_query_sync_test.cpp against both the PR head and a current-main tree with the PR's test file, on llvmpipe (software Vulkan 1.3): all sections pass on both, including the new retire-ticket device-loss section; the relative-counter change in section 6 is needed and correct (the merged run reports 3 injected counter errors vs 2 without the new section). Two asks for the author: state the coordination-issue item ID in the PR if it is not there, and per AGENTS.md say it is AI-assisted and what it was run on (this commit message has no body at all). AI-assisted review. **Recommendation:** Merge
zmasi commented 2026-11-28 21:24:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:24:56Z.


#1298 | head f1ff7d05a7 (merged cleanly with main 1bc055e6c2) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^vk_queue_query_sync$" --output-on-failure (5 runs under LEONIDA_VK_VALIDATION=1) + pre-#408 completed_retire_ticket() VK_ERROR_DEVICE_LOST regression control | red control: reverting if (result == VK_ERROR_DEVICE_LOST) lost = true; in completed_retire_ticket(), main's vk_queue_query_sync still passes on RTX 3090 (missing the bug), whereas this PR's vk_queue_query_sync fails deterministically at retire_context.is_device_lost() | green on PR+main: 5/5 CTest runs pass on RTX 3090 (retire-ticket counter device loss marks context ok + progress counter device loss marks context and rejects work) with VK_LAYER_KHRONOS_validation 1.4.363.1 active and 0 validation errors; 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:7246002395 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1298#issuecomment-7246002395). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T21:24:56Z. --- #1298 | head f1ff7d05a75c4a8526afc9838095ae21459c3bb9 (merged cleanly with main 1bc055e6c2dedaa0de23ec79d8c4007c1dff1fb3) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^vk_queue_query_sync$" --output-on-failure` (5 runs under `LEONIDA_VK_VALIDATION=1`) + pre-#408 `completed_retire_ticket()` `VK_ERROR_DEVICE_LOST` regression control | red control: reverting `if (result == VK_ERROR_DEVICE_LOST) lost = true;` in `completed_retire_ticket()`, `main`'s `vk_queue_query_sync` still passes on RTX 3090 (missing the bug), whereas this PR's `vk_queue_query_sync` fails deterministically at `retire_context.is_device_lost()` | green on PR+main: `5/5` CTest runs pass on RTX 3090 (`retire-ticket counter device loss marks context ok` + `progress counter device loss marks context and rejects work`) with `VK_LAYER_KHRONOS_validation` `1.4.363.1` active and `0` validation errors; `check_no_game_data.py` `0` violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yes
OreoFR commented 2026-11-28 21:48:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:48:29Z.


Verified by OreoFR

  • Base: main c1ecf04ed + PR head f1ff7d05a; green run in a merge package of 12 PRs, no new ctest failure vs main
  • Test: ctest -R ^vk_queue_query_sync$
  • Red on main: OK
  • Green with the PR: OK
  • Verdict: NO RED (test-only PR, covers behaviour already on main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246288131 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1298#issuecomment-7246288131). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:48:29Z. --- **Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `f1ff7d05a`; green run in a merge package of 12 PRs, no new ctest failure vs main - Test: `ctest -R ^vk_queue_query_sync$` - Red on main: OK - Green with the PR: OK - Verdict: NO RED (test-only PR, covers behaviour already on main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 16:34:48 +00:00 (Migrated from github.com)

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


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:7317840343 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1298#issuecomment-7317840343). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:34:48Z. --- 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!1298
No description provided.