fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost device #2567
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2567
Loading…
Reference in a new issue
No description provided.
Delete branch "windowsarmwrestler/Longshot:fix/adreno-tdr-lost-device"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
vkQueueSubmit2withVK_ERROR_INITIALIZATION_FAILED(-3), a result that call may not give, neverVK_ERROR_DEVICE_LOST. The renderer calleddevice_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 everyvkQueueSubmit2of the replay goes through, now takes -3 as a lostdevice: it logs why and calls
device_lost(), which writes the report and ends the game. The player gets the crash reportinstead 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_retryingpu/vk/vk_replay.cpp, then theresetmode intests/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 ontofd68f82c, whichtouches neither file) as a pack over the
shared base of
main@be663a08(dev.py base,pack,rt; the runtime's rendererv3.2.0-23-g9bcc5e4d), played throughthe 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, thenFATAL: 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, thenFATAL: the GPU stopped and Windows reset it (a TDR)and the crashreport; before it, every hang froze the window until it was closed by hand. The game-free test:
tests/test_submit_oom.pycutssubmit_or_retryout ofvk_replay.cppand runs it against a scripted queue; its new
resetmode answers a submit with -3. Onmain(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 itpasses, and with the fix's
device_lostcall taken out it fails again. Compiled with llvm-mingw's clang++ (itsg++is the sameclang: GCC itself not run here).
vk_replay.cppwhole:-fsyntax-only -Wall -Wextrawith the renderer's own flags, on thisbranch and on
main: no errors, the same 63 warnings on both; the renderer and the game built whole from this branch as the packabove.
run_all.py(every game-free check; mise could not install its pinned tools here, so the runner directly, with llvm-mingw'sclang and the Vulkan headers) on Windows ARM64, this branch @
505a2328: 729 passed, 22 failed, 107 skipped (OS-only checks);main@fd68f82con the same PC: 728 passed, 23 failed. Every check failing here fails onmaintoo: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 istest_stack_commit.test_submit_oompasses.Still to test:
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 areVK_SUCCESS, out of host or device memory andVK_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
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (run_all.pyrun directly, as Testing says: the22 that fail here fail on
maintoo, named there.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened (test_submit_oom.py: its cut now needsdevice_lostand the -3 result; every earlier mode unchanged).Assisted-by:/Co-Authored-By:trailers.🤖 Generated with Claude Code
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.@review
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:
505a2328afagainstfd68f82c1d: 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:
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.
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.WIP: fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost deviceto fix(vk): a submit Qualcomm's driver refuses after a GPU reset (-3) is a lost device@windowsarmwrestler only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.@review
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)
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:
505a2328afagainstfd68f82c1d: 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:
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.