Windows on Arm (Adreno X1-85): the GPU times out (TDR) in routine rendering at scene changes and in play; the game then froze with no report #2566
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#2566
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What happens
On a Snapdragon X Elite (Adreno X1-85, Qualcomm's driver 31.0.178.0 /
0x8037d000, Windows 11 ARM64 build 26300, the x64game under emulation) the picture stops for good while the sound goes on: when the intro movie ends, the moment something
is selected on the title (Options, Zelda Notes), and in play, usually within a minute or two of getting control of Link.
It happens on plain
main(nightly-801,9046a8d7, the installed game's renderer) as well as with #2496's renderer.It is a GPU timeout, in work that is not new
Windows logged LiveKernelEvent 141 (VIDEO_ENGINE_TIMEOUT_DETECTED: the GPU engine timed out and was reset) at 31 of the
hangs over two days of runs, and at none of the runs that did not hang. The renderer's log, every time:
The GPU stops finishing work 2-3 s before the first failed submit (Windows' 2 s limit). "stopped queues held" is a result of
the hang (a game thread waiting for work the GPU never finishes), not its cause.
Adreno offers none of VK_NV_device_diagnostic_checkpoints, VK_AMD_buffer_marker or VK_EXT_device_fault, so a test build made
its own markers: each part of a submission (
split_part) noted with its number on the recordings' timeline and the programsit drew and dispatched with, the timeline's last value kept by the GPU hang watch (after the reset the driver reads it as
UINT64_MAX), and the parts around the first unfinished one logged at the lost device. Four hangs caught that way:Each time the same programs in the same order had run in every frame before. The GPU stops in whatever routine work it
is running, not in a particular draw.
What it is not
Each run below set one switch, and the log shows it took effect.
RX_VK_ASTC_CPU=1RX_VK_ASTC_NATIVE=0(test build)HOS_MOVIE_PACE=0RX_VK_ACQUIRE_AHEAD=0RX_VK_RECORDER=offRX_VK_NO_MESH=1RX_VK_DESC_REUSE=neverRX_VK_EVICT_MIN_UNUSED=1000000RX_VK_KEEP_IMAGES=1(test build)DRAW_INDIRECTbefore each indirect drawRX_VK_INDIRECT_BARRIER=1(test build)RX_VK_MIRROR=1Also checked from the code and logs, with no run needed: a draw sampling its own target (the renderer's check never fired),
the render target pool's memory reuse (
0 reused), handle tables as descriptor arrays (the programs involved index none),blending on the B10G11R11 target (
COLOR_ATTACHMENT_BLENDsupported). A readback of the counts the GPU wrote for eachindirect draw ruled those out: hang 4 had none. A timestamped log of every GPU-visible release (images, buffers, device memory,
retired imports) found a burst of image destroys 0.6-1.9 s before one stall, but keeping every image (above) did not help.
Two observations not yet explained: leaving out every ordinary draw (
RX_VK_NO_MESH=2) ran 35 s past the title without a hang,and so did leaving out the title's three menu-text programs (
dc310f71db89f779,702b0aacd47344dd,823bb6db3cdd3e3d,RX_VK_SKIP_FILE; any one alone still hung). One run each, so they may say only that less work hangs less often.Where that leaves it: the leading candidate is Qualcomm's driver, not proven. Nothing found in the renderer explains a GPU
timeout in routine work that ran in every frame before.
A second crash, under GPU memory pressure
Three runs ended in an access violation in
ntdll.dll(Windows' Application log,0xc0000005) with no GPU timeout, eachafter the driver ran out of room:
image over budget, retrying without WITHIN_BUDGET,image 1549x1549x1 ... not made,graphics pipeline for ... not made (-3). Two of the three were withRX_VK_MIRROR=1, which uses more GPU memory. The game'scrash handler does not catch it. A Windows crash dump (
LocalDumps) is set up on the PC to catch the next one.The freeze with no report: fixed in a pull request (linked below)
After the reset Qualcomm's driver answers every
vkQueueSubmit2withVK_ERROR_INITIALIZATION_FAILED(-3), a result that callmay not give, never
VK_ERROR_DEVICE_LOST. The renderer calleddevice_lost()on -4 only, and counted only successfulsubmits as sent, so the GPU hang watch saw nothing owed either: the game froze for good with no report. The fix takes -3 as a
lost device (pull request linked below); the hang now ends in the crash report:
For whoever picks this up
diagnostic switch for GPUs without checkpoints if that is wanted.
ntdll.dllcrash's stack from the dump; a run on Qualcomm's next driver; a Qualcomm report with themarkers' findings.
Related: #2496 (the same PC, a separate problem: Qualcomm's 1 GiB pipeline cache), #1551 (Adreno X1-85's pipeline cache).
System
Snapdragon X Elite X1E78100 (12 cores), 16 GB, Windows 11 Home ARM64 build 26300; Qualcomm Adreno X1-85, driver
31.0.178.0 (
0x8037d000), Vulkan 1.4; screen 2880x1800 at 60 Hz. Longshot nightly-801 (9046a8d7).The freeze with no report (the section above) is fixed in #2567: a submit refused with -3 after a GPU reset is taken as a lost device, so the game ends in its crash report. The GPU timeout itself stays open here.
The markers and logs behind the findings above are on a branch, for whoever picks this up on an Adreno (or any GPU without
VK_NV_device_diagnostic_checkpoints / VK_AMD_buffer_marker):
windowsarmwrestler:diag/adreno-gpu-markers,on top of #2567 (whose lost-device path its report needs), current
main. Diagnostics only, not for merging.With
RX_VK_WATCH_PROG=<program key>[,<key>...]set, at the lost device the log gets:vk: watch parts:the recordings' timeline as the GPU hang watch last read it while the GPU hung (Qualcomm's driver reads it asUINT64_MAXafter the reset), thenvk: watch part <n> FIRST UNFINISHED: part: <d> draws, <c> dispatches: ...: each part of asubmission noted with its programs, targets, and every indirect draw or dispatch (its records' address, writer and first record);
the watched programs' draws each end their part;
vk: count readback:each indirect draw's records as the GPU wrote them, copied before the draw (0xDEADBEEF: the GPU neverreached the copy);
vk: release ...: every GPU-visible release (image, buffer, device memory, a pool's import retired) from 4 s before the stall,timed from it;
vk: evicted #<id> ...: each texture evicted.Test switches on the branch, none of them the fix (#2566's table):
RX_VK_INDIRECT_COPY=1,RX_VK_KEEP_IMAGES=1(a leak, for onesession). The branch's splits change timing: with them the hang came later. Not in the switch table, and three checks that compile
cut functions (
test_gpu_hang_watch,test_image_reaper_threads,test_readback_timeout_reuse) don't compile with it.Building it on Windows on Arm with a Rust whose host is
aarch64-pc-windows-gnullvm(no Visual Studio): setCARGO_PROFILE_RELEASE_STRIP=symbols, or longshot-builder takes its own COFF symbol table for a cut-short file ("What thislongshot-builder carries could not be unpacked").
More runs, in gameplay this time (Link's house), each on #2567's branch as a pack over the shared base of
main(dev.py base,pack,rt), started through the queue, one switch each:RX_VK_LOAD_WORKERS=02755 queued, 33 loaded: the pool did nothing)RX_VK_BATCH=1other, the GPU idle)RX_VK_NO_MESH=1None of these runs logged
image over budgetbefore the hang, so memory pressure is not needed for it either.A correction to the table above: the earlier
RX_VK_NO_MESH=1run hung on the title, where there are no mesh draws, so it saidnothing about gameplay; this one does.
Why gameplay hangs in seconds and the title in minutes: per frame, the title draws 5-16 times, 0-2 dispatches, 2-5 ms of GPU
time; gameplay 687-967 draws, 92-132 dispatches, 132 passes, 41 mesh stand-in draws, 17-19 ms. With no build-up before the hang
(GPU memory and the game's GPU waits flat on the title until the hang) and the GPU stopping in different routine work each time,
the reading that fits is a small chance of the GPU getting stuck on any piece of work, which gameplay rolls far more often.
The driver is the newest found (31.0.178.0, Qualcomm's package 2026.10.1). One test left that says something new: Windows' GPU
timeout raised (
TdrDelay, diagnostic only), to tell work that is very slow (a stall that recovers) from work that never ends.An update from automated runs on the same PC (Snapdragon X Elite, Adreno X1-85, Qualcomm's driver 31.0.178.0, Windows 11 on Arm). The game was started headless through the control bridge from the repository save
kokiri-startand walked around Kokiri Forest until the GPU hung.It reproduces on its own: with main's renderer the GPU hangs 5 to 15 seconds into play, every time.
Ruled out (each still hung as fast): x64 emulation (very strict, and single-core), occlusion queries, the title's text programs, page-table loads, framebuffer compression (UBWC off through
VK_EXT_image_compression_control), null descriptors, a runaway shader loop (every translated loop capped at 64 iterations), partial descriptor pushes, and, all inside one submission, ending the render pass after every draw, a full barrier after every draw, or binding all of a draw's state again before it.What matters is how many draws and dispatches one submission holds. Splitting submissions into small parts made the hang much rarer. A cap of 4 draws or dispatches a submission on Qualcomm's driver, compared against no cap on the same build, alternating runs in Kokiri Forest:
So the cap makes it about 16x rarer, at about 4-8 % of the frame rate, but it does not fix it. That points below the game: the driver, the GPU's firmware, or how Windows schedules and preempts GPU work. Not tried yet: hardware-accelerated GPU scheduling switched, a longer
TdrDelay, a newer Qualcomm driver.A second, separate problem: at default settings the game also exits with 0xC0000005 within about a minute of play in Kokiri Forest, after
vk: image over budget, retrying without WITHIN_BUDGET. GPU memory use reaches about 5.6 GB and allocations start failing near 6.4 GB on this 16 GB PC.RX_VK_VRAM_MB=1024mostly avoids it.No pull request for the cap: it is a partial workaround with a cost.