fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost device #2567

Merged
HumanBean merged 2 commits from windowsarmwrestler/Longshot:fix/adreno-tdr-lost-device into main 2026-11-28 01:31:32 +00:00
Contributor

Summary

On Windows on Arm (Snapdragon X Elite, Adreno X1-85, Qualcomm's driver 31.0.178.0) the GPU sometimes times out and Windows
resets it (#2566). After that the game froze for good, the picture stopped and the sound went on, with no report, and the
player had to end it in Task Manager.

The cause of the freeze, as opposed to the hang itself: after the reset Qualcomm's driver answers every vkQueueSubmit2 with
VK_ERROR_INITIALIZATION_FAILED (-3), a result that call may not give, never VK_ERROR_DEVICE_LOST. The renderer called
device_lost() on -4 only. And it counts a submission as sent only when its submit succeeded, so the GPU hang watch
(gpu_hang_watch_start) found nothing owed and never fired either.

submit_or_retry (gpu/vk/vk_replay.cpp), which every vkQueueSubmit2 of the replay goes through, now takes -3 as a lost
device: it logs why and calls device_lost(), which writes the report and ends the game. The player gets the crash report
instead of a frozen window.

This does not fix the GPU timeout itself; #2566 has what is known about it. See #2566.

Read first: submit_or_retry in gpu/vk/vk_replay.cpp, then the reset mode in tests/test_submit_oom.py.

Testing

Tested: Windows 11 ARM64 build 26300, Adreno X1-85, Qualcomm 31.0.178.0, the x64 game. This branch (its two commits, then on main @ be663a08; rebased since onto fd68f82c, which
touches neither file) as a pack over the
shared base of main @ be663a08 (dev.py base, pack, rt; the runtime's renderer v3.2.0-23-g9bcc5e4d), played through
the queue: the GPU hung in play (Windows logged LiveKernelEvent 141, 13:26), and the game ended in
submit failed (-3): taken as a lost device, then FATAL: the GPU stopped and Windows reset it (a TDR) and the crash report.
Before that, the same hunk on nightly-801's base with #2496's renderer: in every hang (15 kept logs, more that rotated out), each ended
within about 5 s in submit failed (-3): taken as a lost device, then FATAL: the GPU stopped and Windows reset it (a TDR) and the crash
report; before it, every hang froze the window until it was closed by hand. The game-free test: tests/test_submit_oom.py cuts submit_or_retry out of vk_replay.cpp
and runs it against a scripted queue; its new reset mode answers a submit with -3. On main (the test commit alone) it fails:
FAIL: a submit refused with VK_ERROR_INITIALIZATION_FAILED (-3) after a GPU reset is not taken as a lost device; with the fix it
passes, and with the fix's device_lost call taken out it fails again. Compiled with llvm-mingw's clang++ (its g++ is the same
clang: GCC itself not run here). vk_replay.cpp whole: -fsyntax-only -Wall -Wextra with the renderer's own flags, on this
branch and on main: no errors, the same 63 warnings on both; the renderer and the game built whole from this branch as the pack
above.
run_all.py (every game-free check; mise could not install its pinned tools here, so the runner directly, with llvm-mingw's
clang and the Vulkan headers) on Windows ARM64, this branch @ 505a2328: 729 passed, 22 failed, 107 skipped (OS-only checks);
main @ fd68f82c on the same PC: 728 passed, 23 failed. Every check failing here fails on main too: test_auto_handheld,
test_builder_channel, test_coverage_run, test_crash_record, test_damaged_rom_files, test_dev_ab, test_dev_build,
test_dev_migrate, test_dlss_nr_forwarder, test_game_menu_mouse_buttons, test_input_movie, test_job_queue,
test_mise_build, test_nfc_model_info, test_oot_menu_mouse, test_pads_after_menu, test_parity_gates,
test_precompile_compute_guard, test_run_all_mingw, test_sampler_admission, test_sampler_stack_walk,
test_shader_module_guard (POSIX-only fixtures, compiler differences on Windows, tools this PC lacks); main's 23rd is
test_stack_commit. test_submit_oom passes.

Still to test:

  • Windows, AMD or NVIDIA or Intel: play as usual, expecting nothing different (-3 from a submit is not a result those drivers
    give; the new branch only runs on it) (@Beanstalk play 5 minutes in Hyrule Field, then quit)

Measurements

Nothing to measure: one comparison on a submit's result, on the path that already checks it for -4.

Risks

A driver that answers a submit with -3 for any other reason would now end the game where it went on before. No driver may
give -3 from vkQueueSubmit2 (the call's results are VK_SUCCESS, out of host or device memory and VK_ERROR_DEVICE_LOST),
and nothing sent after such a refusal ran, so what went on before was a frozen or broken game. Reverting the commit undoes it.
After updating a player notices nothing, unless the GPU hangs: then the crash report, not a frozen window.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (run_all.py run directly, as Testing says: the
    22 that fail here fail on main too, named there.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened (test_submit_oom.py: its cut now needs
    device_lost and the -3 result; every earlier mode unchanged).
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

🤖 Generated with Claude Code

## Summary On Windows on Arm (Snapdragon X Elite, Adreno X1-85, Qualcomm's driver 31.0.178.0) the GPU sometimes times out and Windows resets it (#2566). After that the game froze for good, the picture stopped and the sound went on, with no report, and the player had to end it in Task Manager. The cause of the freeze, as opposed to the hang itself: after the reset Qualcomm's driver answers every `vkQueueSubmit2` with `VK_ERROR_INITIALIZATION_FAILED` (-3), a result that call may not give, never `VK_ERROR_DEVICE_LOST`. The renderer called `device_lost()` on -4 only. And it counts a submission as sent only when its submit succeeded, so the GPU hang watch (`gpu_hang_watch_start`) found nothing owed and never fired either. `submit_or_retry` (`gpu/vk/vk_replay.cpp`), which every `vkQueueSubmit2` of the replay goes through, now takes -3 as a lost device: it logs why and calls `device_lost()`, which writes the report and ends the game. The player gets the crash report instead of a frozen window. This does not fix the GPU timeout itself; #2566 has what is known about it. See #2566. Read first: `submit_or_retry` in `gpu/vk/vk_replay.cpp`, then the `reset` mode in `tests/test_submit_oom.py`. ## Testing **Tested:** Windows 11 ARM64 build 26300, Adreno X1-85, Qualcomm 31.0.178.0, the x64 game. This branch (its two commits, then on `main` @ `be663a08`; rebased since onto `fd68f82c`, which touches neither file) as a pack over the shared base of `main` @ `be663a08` (`dev.py base`, `pack`, `rt`; the runtime's renderer `v3.2.0-23-g9bcc5e4d`), played through the queue: the GPU hung in play (Windows logged LiveKernelEvent 141, 13:26), and the game ended in `submit failed (-3): taken as a lost device`, then `FATAL: the GPU stopped and Windows reset it (a TDR)` and the crash report. Before that, the same hunk on nightly-801's base with #2496's renderer: in every hang (15 kept logs, more that rotated out), each ended within about 5 s in `submit failed (-3): taken as a lost device`, then `FATAL: the GPU stopped and Windows reset it (a TDR)` and the crash report; before it, every hang froze the window until it was closed by hand. The game-free test: `tests/test_submit_oom.py` cuts `submit_or_retry` out of `vk_replay.cpp` and runs it against a scripted queue; its new `reset` mode answers a submit with -3. On `main` (the test commit alone) it fails: `FAIL: a submit refused with VK_ERROR_INITIALIZATION_FAILED (-3) after a GPU reset is not taken as a lost device`; with the fix it passes, and with the fix's `device_lost` call taken out it fails again. Compiled with llvm-mingw's clang++ (its `g++` is the same clang: GCC itself not run here). `vk_replay.cpp` whole: `-fsyntax-only -Wall -Wextra` with the renderer's own flags, on this branch and on `main`: no errors, the same 63 warnings on both; the renderer and the game built whole from this branch as the pack above. `run_all.py` (every game-free check; mise could not install its pinned tools here, so the runner directly, with llvm-mingw's clang and the Vulkan headers) on Windows ARM64, this branch @ `505a2328`: 729 passed, 22 failed, 107 skipped (OS-only checks); `main` @ `fd68f82c` on the same PC: 728 passed, 23 failed. Every check failing here fails on `main` too: `test_auto_handheld`, `test_builder_channel`, `test_coverage_run`, `test_crash_record`, `test_damaged_rom_files`, `test_dev_ab`, `test_dev_build`, `test_dev_migrate`, `test_dlss_nr_forwarder`, `test_game_menu_mouse_buttons`, `test_input_movie`, `test_job_queue`, `test_mise_build`, `test_nfc_model_info`, `test_oot_menu_mouse`, `test_pads_after_menu`, `test_parity_gates`, `test_precompile_compute_guard`, `test_run_all_mingw`, `test_sampler_admission`, `test_sampler_stack_walk`, `test_shader_module_guard` (POSIX-only fixtures, compiler differences on Windows, tools this PC lacks); `main`'s 23rd is `test_stack_commit`. `test_submit_oom` passes. **Still to test:** - Windows, AMD or NVIDIA or Intel: play as usual, expecting nothing different (-3 from a submit is not a result those drivers give; the new branch only runs on it) (@Beanstalk play 5 minutes in Hyrule Field, then quit) ## Measurements Nothing to measure: one comparison on a submit's result, on the path that already checks it for -4. ## Risks A driver that answers a submit with -3 for any other reason would now end the game where it went on before. No driver may give -3 from `vkQueueSubmit2` (the call's results are `VK_SUCCESS`, out of host or device memory and `VK_ERROR_DEVICE_LOST`), and nothing sent after such a refusal ran, so what went on before was a frozen or broken game. Reverting the commit undoes it. After updating a player notices nothing, unless the GPU hangs: then the crash report, not a frozen window. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (`run_all.py` run directly, as Testing says: the 22 that fail here fail on `main` too, named there.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened (`test_submit_oom.py`: its cut now needs `device_lost` and the -3 result; every earlier mode unchanged). - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Qualcomm's Adreno driver on Windows answers every vkQueueSubmit2 with
VK_ERROR_INITIALIZATION_FAILED (-3) after Windows has reset a hung GPU, never
VK_ERROR_DEVICE_LOST. test_submit_oom's cut of submit_or_retry now has a mode where the
driver says so: it expects device_lost() once and no retry. Fails on main, which
returns the -3 and freezes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost device
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 5s
beanstalk/approval waiting for a BigBean's 👍 on the request
505a2328af
Qualcomm's Adreno driver on Windows answers every vkQueueSubmit2 after Windows has
reset a hung GPU (LiveKernelEvent 141) with VK_ERROR_INITIALIZATION_FAILED, not
VK_ERROR_DEVICE_LOST. device_lost() never ran, the failed submits were never counted
as sent, so the GPU hang watch saw nothing owed either: the game froze for good
with no report. submit_or_retry now takes that result as a lost device.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 ARM64 (build 26300), Snapdragon X Elite, Adreno X1-85, Qualcomm driver 31.0.178.0, the x64 game. This branch as a pack over the shared base of main @ be663a08 (dev.py base, pack, rt; renderer v3.2.0-23-g9bcc5e4d, the same two commits before the rebase), played through the queue into the game: the GPU hung (Windows logged LiveKernelEvent 141), and the game ended in 'submit failed (-3): taken as a lost device', then 'FATAL: the GPU stopped and Windows reset it (a TDR)' and the crash report, where main froze the window for good. The same hunk on nightly-801 with #2496's renderer: every hang since (15 kept logs) ended the same way.

Tested in game: Windows 11 ARM64 (build 26300), Snapdragon X Elite, Adreno X1-85, Qualcomm driver 31.0.178.0, the x64 game. This branch as a pack over the shared base of main @ be663a08 (dev.py base, pack, rt; renderer v3.2.0-23-g9bcc5e4d, the same two commits before the rebase), played through the queue into the game: the GPU hung (Windows logged LiveKernelEvent 141), and the game ended in 'submit failed (-3): taken as a lost device', then 'FATAL: the GPU stopped and Windows reset it (a TDR)' and the crash report, where main froze the window for good. The same hunk on nightly-801 with #2496's renderer: every hang since (15 kept logs) ended the same way.
Member
@review
BeanBot left a comment

Recommendation: Approve. The reported Qualcomm run shows that the affected reset now ends with a report instead of leaving a frozen window. CI results are still outstanding. Nothing blocking is left. Recommend approval; not approved on the forge.

A submit refused with VK_ERROR_INITIALIZATION_FAILED now follows the existing device-lost reporting and exit path. Successful submits and the existing memory-retry behavior are unchanged.

Checks: Still running: 8 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes. The author reports one reproduced reset on the branch and 15 retained logs from an earlier base where the game exited with a report; before the fix, the window froze. The game-free test is reported to fail on the base and when the new device_lost call is removed.

Other systems: The result check applies on Windows and Linux, on every GPU, and to replay, recorder, batched, present and upload submits through submit_or_retry. Successful submits and documented memory-error retries retain their existing paths; other vendors and Linux have not been reported tested on this head.

Switches: None added, changed or removed. The existing submit-retry switch retains its default.

Reviewed: 505a2328af against fd68f82c1d: Read both diffs, both commit messages, tests/test_submit_oom.py, submit_retry.h, the changed function and its submit callers, device_lost and its reporting path, repository rules, the PR template, relevant standards and architecture rules, and the supplied comments and CI status. Skimmed the remainder of the 8,373-line vk_replay.cpp and the broader architecture documentation. docs/review-checklist.md and ../Tooling/AGENTS.md were not present.; nothing run (a code review).

Checked and fine:

  • The new reset test checks that device_lost is called, and the author reports that removing the call makes it fail.
  • Both commits have AI-assistance trailers; neither changed file contains game-derived output.
  • The changed path introduces no shared mutable state, allocation, indexing or file handling.

Testing: No code or tests were run during this read-only review. CI is still running; the author reports an in-game Qualcomm reset and game-free test results.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported Qualcomm run shows that the affected reset now ends with a report instead of leaving a frozen window. CI results are still outstanding. Nothing blocking is left. Recommend approval; not approved on the forge. A submit refused with VK_ERROR_INITIALIZATION_FAILED now follows the existing device-lost reporting and exit path. Successful submits and the existing memory-retry behavior are unchanged. **Checks:** Still running: 8 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes. The author reports one reproduced reset on the branch and 15 retained logs from an earlier base where the game exited with a report; before the fix, the window froze. The game-free test is reported to fail on the base and when the new device_lost call is removed. **Other systems:** The result check applies on Windows and Linux, on every GPU, and to replay, recorder, batched, present and upload submits through submit_or_retry. Successful submits and documented memory-error retries retain their existing paths; other vendors and Linux have not been reported tested on this head. **Switches:** None added, changed or removed. The existing submit-retry switch retains its default. **Reviewed:** 505a2328afc2 against fd68f82c1d78: Read both diffs, both commit messages, tests/test_submit_oom.py, submit_retry.h, the changed function and its submit callers, device_lost and its reporting path, repository rules, the PR template, relevant standards and architecture rules, and the supplied comments and CI status. Skimmed the remainder of the 8,373-line vk_replay.cpp and the broader architecture documentation. docs/review-checklist.md and ../Tooling/AGENTS.md were not present.; nothing run (a code review). **Checked and fine:** - The new reset test checks that device_lost is called, and the author reports that removing the call makes it fail. - Both commits have AI-assistance trailers; neither changed file contains game-derived output. - The changed path introduces no shared mutable state, allocation, indexing or file handling. **Testing:** No code or tests were run during this read-only review. CI is still running; the author reports an in-game Qualcomm reset and game-free test results. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
Author
Contributor

Testing: the full game-free suite run on this branch (505a2328) and on main (fd68f82c) on the same PC, with the Vulkan headers this time: 22 fail here, all of them on main too (main fails one more, test_stack_commit), named in Testing; the mise run test box is ticked on that. The renderer and the game were built whole from this branch (the pack the in-game run used), so the note that they could not be is gone.

Testing: the full game-free suite run on this branch (505a2328) and on main (fd68f82c) on the same PC, with the Vulkan headers this time: 22 fail here, all of them on main too (main fails one more, test_stack_commit), named in Testing; the mise run test box is ticked on that. The renderer and the game were built whole from this branch (the pack the in-game run used), so the note that they could not be is gone.
windowsarmwrestler changed title from WIP: fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost device to fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost device 2026-11-25 22:54:29 +00:00
Member

@windowsarmwrestler only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@windowsarmwrestler only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The reported Qualcomm reset now produces a crash report instead of leaving the game frozen, and the author reproduced that result in game. The requested other-vendor run and CI are still pending. Nothing blocking is left. Recommend approval; not approved on the forge.

Treats an initialization failure from a replay queue submit as a lost device, ending the game with a report; the underlying GPU timeout remains unfixed. The change is small and adds a regression test.

Checks: Still running: 8 checks.

Also noticed (2; not asked for, not blocking)
  • The requested Windows run on AMD, NVIDIA or Intel remains outstanding.
  • CI checks are still running.
More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports a successful in-game reproduction on Adreno X1-85 and 15 earlier hang logs ending in a report instead of a frozen window. The game-free test reportedly fails on main and passes with the fix.

Other systems: The new error branch applies on all operating systems and GPU vendors, but only for a submit result outside the Vulkan call's specified errors. Normal play on another Windows GPU remains to be tested; Linux and other drivers have no reported run.

Switches: None.

Reviewed: 505a2328af against fd68f82c1d: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the complete diff and test file, and the changed section of gpu/vk/vk_replay.cpp. The full replay file output was truncated, so its remaining code was only skimmed. The review checklist was absent; other referenced developer rules were not fully read.; nothing run (a code review).

Checked and fine:

  • The reset test exercises the extracted submit function and checks that the failure is not retried.
  • No switches were added or changed.

Testing: No commands from the project or tests were run. The author reports an in-game Qualcomm reset, a passing regression test, and game-free suite failures also present on main.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported Qualcomm reset now produces a crash report instead of leaving the game frozen, and the author reproduced that result in game. The requested other-vendor run and CI are still pending. Nothing blocking is left. Recommend approval; not approved on the forge. Treats an initialization failure from a replay queue submit as a lost device, ending the game with a report; the underlying GPU timeout remains unfixed. The change is small and adds a regression test. **Checks:** Still running: 8 checks. <details> <summary>Also noticed (2; not asked for, not blocking)</summary> - The requested Windows run on AMD, NVIDIA or Intel remains outstanding. - CI checks are still running. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports a successful in-game reproduction on Adreno X1-85 and 15 earlier hang logs ending in a report instead of a frozen window. The game-free test reportedly fails on main and passes with the fix. **Other systems:** The new error branch applies on all operating systems and GPU vendors, but only for a submit result outside the Vulkan call's specified errors. Normal play on another Windows GPU remains to be tested; Linux and other drivers have no reported run. **Switches:** None. **Reviewed:** 505a2328afc2 against fd68f82c1d78: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the complete diff and test file, and the changed section of gpu/vk/vk_replay.cpp. The full replay file output was truncated, so its remaining code was only skimmed. The review checklist was absent; other referenced developer rules were not fully read.; nothing run (a code review). **Checked and fine:** - The reset test exercises the extracted submit function and checks that the failure is not retried. - No switches were added or changed. **Testing:** No commands from the project or tests were run. The author reports an in-game Qualcomm reset, a passing regression test, and game-free suite failures also present on main. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean approved these changes 2026-11-28 01:31:12 +00:00
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Successful in 5s
beanstalk/approval waiting for a BigBean's 👍 on the request
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2567
No description provided.