Skip to content

GPU hang watchdog: a wait that sees no submission complete names the stuck pipelines (DM_NVN_GPU_WATCHDOG) - #1550

Open
Amost- wants to merge 2 commits into
seedds:mainfrom
Amost-:pr/gpu-watchdog
Open

Amost- wants to merge 2 commits into
seedds:mainfrom
Amost-:pr/gpu-watchdog

Conversation

@Amost-

@Amost- Amost- commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

A diagnostic for the freeze of issue #1223's kind, split out of #405 so it can land on its own.

When a shader never ends, no command buffer completes, no feedback handler runs, and every CPU wait for the GPU blocks for good: the host froze silently with its render thread in a wait with no timeout. Metal cannot abort GPU work, so the watchdog only tells. A wait that sees no submission complete for DM_NVN_GPU_WATCHDOG seconds (5 by default, 0 off) while submissions are in flight logs one [RED] GPU watchdog line per stuck fence, naming the pipelines of the oldest submission in flight and the two after it, from a record of the distinct vertex/fragment pairs each submission drew and the compute shaders it dispatched. The line names what to pass to DM_NVN_SKIP_FS to play on without the looping draw.

Found on Hyrule Warriors: Age of Imprisonment: the Mac froze in the first outpost mission while a special attack filled the screen, GPU at 100 % for minutes; two pixel shaders loop over a light list whose count comes from a texture. The game README section records the evidence. Host builds; C ratchet unchanged against main.

🤖 Generated with Claude Code

Amost- and others added 2 commits November 11, 2026 10:49
…stuck pipelines

Hyrule Warriors: Age of Imprisonment froze the GPU in its first outpost mission while a
special attack filled the screen; the allocator wait of the next submission had no timeout,
so the host hung in silence. Every blocking GPU wait now runs in 2 s slices, and after
DM_NVN_GPU_WATCHDOG seconds (5 by default) with work in flight a [RED] line names the frame,
counts and pipelines of the submission the GPU is stuck on, from a per-submission record of
its vertex/fragment pairs and compute shaders, and points at DM_NVN_SKIP_FS to play on.
The cause is open: the shaders' light-list loops run in the first battle at 1x and 2x with
an empty list and never hang (game README, "GPU hang in a battle").

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 7083aa2)
…n record is printed in the command-buffer error path too

When macOS aborts a command buffer that ran too long (Ocarina of Time, issue seedds#1326), the fence
completes with an error and g_done moves on, so the hang watchdog, which needs a fence that never
completes, does not fire. The feedback handlers now print the same record for a submission that
had a failure of its own: once its last command buffer has come back, once per fence, for the
first 16 fences. A failed segment leaves a mark for the last handler to print. A segment whose
handler runs after the last one prints the record itself.

The record is now kept per command buffer of the submission, a pair once in each, so a failed
segment lists every pipeline it ran. Pairs are in the order they first ran, each marked with the
render pass it began in (counted from the submission's first, whose DM_NVN_PASSDUMP number the
header gives). Victims and refused submissions are left out, through the filter cbs_feedback
already used. The record holds up to 48 pairs and only counts the rest. Its text is built by one
formatter that stays inside its buffer; the watchdog uses it too.

Main's shader lists name each game shader once per failed command buffer and rank them across
failures. This line shows, for the one failed submission, which vertex shader drew with which
fragment shader, its compute shaders and the host's builtins, in order, with the failed command
buffer marked. t_gpu_watchdog checks the record, its text, both handler orders, once per fence,
victims and the watchdog's single report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 04003F40232DE000 Hyrule Warriors: Age of Imprisonment nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant