Repository navigation
Breath of the Wild: every segment commits on the Mac (104 → 115 fps circling outdoors at 120 fps), with cut_draws / cut_busy profile keys - #2286
Open
dontpokethebear3893 wants to merge 3 commits into
Conversation
…rcling outdoors at 120 fps. Profile keys cut_draws and cut_busy (Mac only) set the segment size and whether a cut waits for earlier work to report back The rule that holds a segment's commit until earlier work has reported back (for Ocarina of Time's submission-queue stalls) left this game at 1.8 commits a frame, with the GPU waiting for the host's translation inside each frame: the game waits on the fence of the frame it just submitted. Its profile now sets cut_busy off and cut_draws 32 (12.6 commits a frame). M5 Max, 1.9.0, encode thread on, 120 fps target, frames 3,000-9,000: fence wait p50 7.3 → 6.4 ms, GPU span 8.3 → 7.5 ms; three 10-minute runs at 114-116 fps, no GPU errors, 2-8 frames over 20 ms each. Every other game and iOS keep 64 and the rule. t_feedback's cut boundary case follows the setting and runs with the rule on and off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 3 tasks
Brings the branch up to date with main (fixes for the t_save_sync cloud device check and the clang-tidy fixture findings, among others) and resolves the conflicts with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What and why
On the Mac, Breath of the Wild in the open world is held back by the CPU, not the GPU. With a 120 fps target it ran at about 104 fps while the Metal HUD showed 5–7 ms of GPU time. The game waits on the fence of the frame it just submitted, so a frame is the GPU's span plus the host's translation of the next submission. Segmented submission (
sub_cut) is meant to let the GPU start while the host is still translating. Since the rule added for Ocarina of Time (6121fd7: a segment commits only once earlier work has reported back), this game's segments mostly wait: 1.8 commits a frame, and the GPU waits for the translation inside each frame (fence wait p50 7.3 ms).game.py, Mac only):cut_draws: the draws between segment commits, 0–4096 (default 64).cut_busy:on(the default) oroff. Withoff, every cut commits, even while earlier work is running.DM_NVN_CUTandDM_NVN_CUT_BUSYstill override both. iOS keeps 64 and the rule for every game, since neither was measured there.cut_draws 32andcut_busy off, about 12.6 commits a frame.nvn_mtl.m):cut_draws()andsub_cuttake their defaults from the profile, and log when the rule is off.t_feedback's cut boundary case now follows the setting, and the Makefile runs it with the rule on and with it off, so both paths are checked whatever game the tests are built for.Conflict with #2282 (encode thread): both edit the
check_t_feedbackline ofdm/gfx/tests/Makefile. Whichever goes in second needs the two edits combined:DM_NVN_CUT_BUSY=1 DM_NVN_ENC_THREAD=0 … ./t_feedback; DM_NVN_CUT_BUSY=0 DM_NVN_ENC_THREAD=0 … ./t_feedback.Suggestion: make the busy rule Ocarina of Time's own
The busy rule went in for every game to stop Ocarina of Time's stalls (the GPU idling 5–40 ms in front of a command buffer already committed). Their cause in the kernel is still unknown. For a game like Breath of the Wild, which waits on its newest fence, the rule costs about 10% of the frame rate. BotW also ran at about the commit rate where Ocarina of Time stalled (12.6 a frame against about 12) without showing the stalls.
This PR keeps the rule as every game's default and turns it off for BotW alone. The other way round would match how the BotW-only changes are made:
cut_busyoff by default, with Ocarina of Time's profile settingcut_busy on. That keeps the stall fix where it was measured and gives every other game the earlier behaviour. Before flipping the default, it would be worth checking:This PR does not make that change.
Checked
Breath of the Wild 1.9.0 on an Apple M5 Max (48 GB), macOS 27.2.1. The test build also had the 120 fps and dynamic frame rate changes (#2186 and #2181, since closed) and those of #2282 (encode thread), #2283 (Game Mode), #2284 (Game memory) and #2285 (Output resolution), with these settings:
Link circled outdoors from a save in the open world. All runs used
DM_NVN_CUT/DM_NVN_CUT_BUSY, and the GPU clock was about 1,615 MHz in each.2-minute runs, frames 3,000–9,000:
kIOGPUCommandBufferCallbackErrorHang) at frame 8,857. No run at 32 has had one.Three 10-minute runs at 32, every cut:
A 10-minute run of the old default for comparison doesn't count. After its third minute the GPU clock dropped to about 685 MHz and stayed there while the GPU was 98% busy, and the run fell to about 61 fps.
In-game, without overrides: the test app rebuilt with this commit logged
every 32 draws (the default or the profile's cut_draws)andevery segment commits … (the profile's cut_busy off).DM_PRESENT_VRR=1(variable refresh as in fullscreen), a 2-minute run gave 118.3 fps, 12.7 commits a frame and a fence wait p50 of 5.86 ms, with no GPU errors.DM_NVN_CUT=64 DM_NVN_CUT_BUSY=1, did the same, because frames of about 8.5 ms miss the 120 Hz tick. That isn't from this change.Tests:
make -C dm/gfx/tests check_t_feedback(rule on and off) andcheck_t_reorder_chainpass forGAME=01007EF00011E000andGAME=0400486024DEC000.make -C dm/host/tests GAME=01007EF00011E000 runpasses.dm/tools/testspasses:test_game_profile,test_docs,test_env_switches,test_lint_python,test_lint_c,test_gfx_tests_makefileandtest_launcher_settings.Not checked:
The game's other scenes, handheld mode, and the default 1600x900 output.
Whether the game's dynamic resolution reads the segment timestamps differently.
iOS, which is unchanged.
Ocarina of Time and the other games, which are unchanged.
After the rebase on
main(6a6a018):make -C dm/host/tests GAME=01007EF00011E000 run,check_t_feedbackandcheck_t_reorder_chain(dm/gfx/tests) pass.dm/tools/testspasses:test_docs,test_patches,test_game_profile,test_env_switches,test_launcher_settings,test_settings,test_nsp_mac_app,test_fps_target,test_player_env,test_lint_candtest_gfx_tests_makefile.dm/ios/teststest_launcher_storagepasses.lint_python.py --against origin/mainreports one new finding,dm/gfx/tools/dmsh_entry.py:7(F401, an unused import).mainitself reports the same one, and this change does not touch that file.Docs
dm/games/01007EF00011E000/README.md, GPU work) anddocs/reference/frame-rate.md(The GPU idles with the next command buffer already committed) have the measurements.dm/games/README.mdanddm/tools/docs_patches.py. The switches are updated indocs/env_switches.tsvanddocs/agents/04-graphics.md.python3 dm/tools/docs_symptoms.pyanddocs_patches.pywere run.🤖 Generated with Claude Code