Repository navigation
DM_GPU_CANARY=1 (opt-in): a fixed compute dispatch once a second, to tell a GPU clock fall from a heavier scene - #1709
Open
oliverames wants to merge 2 commits into
Open
oliverames wants to merge 2 commits into
oliverames wants to merge 2 commits into
Conversation
oliverames
force-pushed
the
gpu-canary
branch
from
November 7, 2026 19:48
a771bc5 to
b3d635c
Compare
Contributor
Author
|
Device read of the canary (iPhone 18 Pro class, 2P+4E cores, MKW 1.8.0, HDR off, thermal state 1 throughout), not fully tested:
Conclusion: the canary separates a GPU clock drop from the game's own pacing, which is what it was added for. It does not explain the drop, so this PR is a diagnostic only. |
… GPU time logged, to tell a GPU clock fall from a heavier scene Mario Kart World on an iPhone goes from about 9 to 30 ms of GPU time a frame, a tight plateau, 30 to 50 s into a race, with the CPU at a full clock, with HDR on or off, and with the game's interval or the display's. The game's own GPU time moves with its scene and with the GPU clock, so it cannot say which. This dispatch does not move with the scene: a step in it at the same moment says the clock fell. t_gpu_canary runs the real Metal path on the Mac (three samples in 8 s, 7.6 ms of GPU each).
oliverames
force-pushed
the
gpu-canary
branch
from
November 10, 2026 00:51
b3d635c to
5837b86
Compare
2 of 3 tasks
oliverames
pushed a commit
to oliverames/nxnative
that referenced
this pull request
Nov 10, 2026
…me on an iPhone, and the phone restarts some minutes later (Mario Kart World 1.8.0, iOS 27.3 beta); open On an iPhone 19,4 the picture stopped 2 to 3 s into a race, 184 s after launch, with the overlay at 0 fps, the process alive, no [RED] line and no GPU error. Every thread waited and none spun. The state dump has the replay thread in iokit_user_client_trap under res_commit (pool_res, with g_mu held by its caller and g_res_mu across the call) and the GPU's completion queue waiting for a mutex in post_complete, with the main fence at submitted 206262 / completed 206256. Ending the app did not end the process. The system's stack report 15 minutes later still has it with one thread, NVN queue replay, in an uninterruptible kernel wait with a read-write lock held and a kernel thread blocked on it, and the phone at 7.2 GB wired and 34 MB free. The phone then restarted itself. It happened twice in four runs of one build (main 04811a6 with PRs seedds#1709, seedds#1695, seedds#1262, seedds#1599 and seedds#1713 merged): in that race, and an hour later at the title's demo with no button pressed, 353 s after launch, with the same thread state. Both came in a scene load (1,840 allocations added to the residency set in 678 commits in the 300 frames before the second). With main's 6f50de0 and 12a44e0 added, four races did not freeze, which is too few to say it is gone. The game makes about five residency commits a frame in a race. No fix: the entry says what was ruled out, what the host could change, and what to collect from the phone (SIGALRM for the host's dump, then systemCrashLogs). The game note links it under Open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opt-in, off by default. Read on one device so far (below); the Mac test and one iPhone run are the only checks.
What and why
Mario Kart World 1.8.0 (#1383's build) on a physical iPhone goes from about 9 to 30 ms of GPU time a frame, a tight plateau, 30 to 50 s into a race: seen in six runs with HDR on and off, with the game's present interval and with
DM_PRESENT_INTERVAL=display, with and without a scheduler declaration change, while the CPU stayed at a full clock and 55 to 63% on performance cores (and the ProcessInfo thermal state did not track it). cheemu21/plumber-racer-2 reports the same plateau on a cold phone. The game's GPU time moves with its scene and with the GPU clock, so it cannot say which of the two stepped.DM_GPU_CANARY=1submits a fixed compute dispatch (about 1 G dependent FMAs, no memory traffic) on the app's own queue once a second, after five seconds, and logs its GPU time:gpu canary #n at s s: GPU x ms, submit to done y ms. It does not move with the scene, so a step in it at the moment the game's GPU time steps says the GPU clock fell, and a flat canary says the scene got heavier. It shares the GPU with the game, so read the smallest of a few samples. It costs a few milliseconds of GPU a second. Without the variable nothing is created or submitted. Switch row indocs/env_switches.tsv; reading guide indocs/development.md.Checked
t_gpu_canaryruns the real Metal path (mtl_initwith the variable set): the start line is logged, three samples arrive in 8 s, GPU time positive and bounded (7.6 ms on an M-series Mac), built withmake -C dm/gfx/tests GAME=0400C3F00006E000 t_gpu_canary. It caught a real bug while writing it (the timer source was a local and was released at once, so nothing ever fired); fixed.nvn_mtl.malso syntax-checks for the iPhoneOS SDK.dm/tools/tests/test_docs.pypasses; the new switch is indocs/env_switches.tsvwith its meaning (at the timeenv_switches.py --checkreportedDM_NVN_BC_ALIAS, which was missing from the table onmaintoo; main'sd8b2b64a1has since added that row).scripts/regress.py check --games: not run: off by default, so every game runs as before without the variable.Front ends
None: no front end has to act on this.
Docs
docs/development.mdand the switch indocs/env_switches.tsv; no game finding, so no symptom entrydmsh_chain.py --headerwas run anddm/gfx/nvn/dmsh_chain.his part of the change. Not applicable: no chain tool changed.