Repository navigation
Conversation
1 task done
zkkzkk
added a commit
to zkkzkk/nx-pocket
that referenced
this pull request
Nov 9, 2026
…cenes (upstream PR #1765) From seedds/nxnative#1765 by moretti, not merged upstream yet: a 4-byte cut in v458752's main (0x204abc) makes the controller's candidate interval its minimum, so a late frame shows when ready (45-58 fps) instead of the game holding 30 fps; enc_thread on. On the iPhone Duo the GPU took 22-26 ms a gameplay frame and the game sat at 30.
moretti
force-pushed
the
bananza-60fps
branch
from
November 14, 2026 06:02
89d5273 to
16707a0
Compare
Kayyluhh
added a commit
to Kayyluhh/nxnative
that referenced
this pull request
Nov 19, 2026
…keeps 60 fps in busy scenes, Metal encoding on its own thread; patches.py keeps the batch's render-scale stubs beside the cut
moretti
force-pushed
the
bananza-60fps
branch
from
November 21, 2026 07:42
16707a0 to
751d03b
Compare
The game's frame-rate controller (main+0x204a18) measures each frame from its start to the later of its submission and GPU end, and raises the present interval to 2 (30 fps) after two frames over 20 ms. On the Mac the host's translation and the GPU come one after the other in that measure (about 27 ms in the second world's dialog close-ups, 18,000-24,000 draws), so busy scenes fell to 30 fps for seconds although the Mac shows those frames at 50-60. - patches.py (v458752 main): the controller's candidate interval is the settings' minimum (main+0x204abc, csinc w9,w11,w9,ge -> mov w9,w8), so it only steps back down to 1; a late frame is shown when it is ready. The fixed-interval path (cutscenes) is not touched. - game.tsv: enc_thread on. Translation on the submit thread in the close-ups 15.6 -> 12.6 ms. A 129 s session through those close-ups: 57.9 fps on average there (55-57 at about 23,000 draws, 60 up to about 19,000), against 30 before. Open, in the game's note: whether the game's time keeps real time when frames run late, and the last 1-2 ms of translation in the heaviest views.
moretti
force-pushed
the
bananza-60fps
branch
from
November 21, 2026 07:42
751d03b to
11d60dc
Compare
2 of 3 tasks
Owner
|
Thanks @moretti for profiling Donkey Kong Bananza's busy-scene drops and verifying the frame-rate controller behavior. We are closing this PR because it conflicts with |
g8row
added a commit
to g8row/nxnative
that referenced
this pull request
Nov 26, 2026
In a busy view the host's translation of each frame is the frame's critical path: the game waits for an older frame's fence before it records the next. On Donkey Kong Bananza's checkpoint route (a save in a view of about 26,200 draws a frame) the replay thread translated for 14-18 ms a frame after main's per-draw changes, spread thinly over the draw path: no phase of DM_NVN_DRAWPROF above 5 ms, ~8,100 instructions a draw. Profiles of the leaf samples and the hot functions' disassembly found the same few patterns everywhere: answers asked again at every draw that change only at a bind, lookups that miss a single-entry cache, ARC traffic, thread-local reads and stack probes. Every change keeps what is encoded the same and has an off switch for A/B runs. - Diagnostics first: za_note_ formatted its text at every draw past its log limit (a fifth of draw_ in snprintf for one geometry shader whose slots stay 0); now it only counts there. DM_NVN_DRAWPROF=1 gives the replay thread's exclusive time by phase (@dp_<phase>_ms). - Binding scans that find nothing keep that answer with what it was made from (DM_NVN_FB_CACHE, DM_NVN_UBDT_CACHE), on the shader, and a uniform rebind asks again only the bindings that read a uniform slot (DM_NVN_UBSC_PART, DM_NVN_UBD_FAST). These sit on main's per-shader binding lists (sh_tex_list, sh_buf_list). - Argument blocks: after a mesh draw only the geometry stage is encoded again (DM_NVN_GEO_ARGS_KEEP); per-slot pool lookup memos (DM_NVN_CBMEMO, DM_NVN_CBRANGE); uniform-only patches take only the slots that changed, from a compact list (DM_NVN_CB_SLOTGEN, DM_NVN_CB_PATCH_IX); the size table handed out again (DM_NVN_CBSIZE_CACHE); blocks keep their CPU address (ab_cpu); fragment table addresses not written again (DM_NVN_FT_CACHE). - Vertex input: pool-range memos for streams, pulling layouts and index buffers (DM_NVN_VBMEMO), a dirty mask over the vertex table (DM_NVN_VBUF_DIRTY), a pulling layout cache (DM_NVN_PULL_CACHE, keyed by the attribute state, the streams with a buffer and those the shader reads, so main's absent-attribute W=1.0 rule is kept), and an off switch for main's read-streams-only rule (DM_NVN_VB_USED). - Draw state: a dirty bitmask for dynamic state (DM_NVN_DYN_DIRTY), each program's last pipeline (DM_NVN_PSO_PROG_CACHE), per-draw memos in bz_bind, border_need, vbuf_prepare, fb_prepare and udc_note_draw (DM_NVN_DRAW_MEMO); csh_dispatch_ahead no longer reads its 4,096-op scan limit as a dispatch ahead (about 300 needless stops a frame). - Geometry mesh runs: vertex table writes shadowed while a run is open (DM_NVN_GEO_SHADOW_VT) and a continuation path for draws 2..n of an unchanged run (DM_NVN_GEO_RUN_FAST). - Storage writes: a range already noted this submission returns at once, 64-page and wider ranges go to the interval list (DM_NVN_GW_WIDE), the page hash is cache-line grouped, rc_change remembers its last empty gap. A GPU write still arms main's sparse-pool shadow writeback first. - ARC, thread-locals and stack: arena / uniform / size-table buffers handed back unretained, plain-pointer program and pipeline lookups (PROG_GET, pso_get_v), the replay thread's pool table as a plain global chosen by its thread pointer (pc_tp, mtl_pc_claim), the pool generation read relaxed and fenced only when it moved (pool_gen_cur; ~90,000 LDARs a frame), recorded encoder calls written as C records (RO_R_*), and the large-frame paths of geo_draw and draw_ split into functions of their own (no ___chkstk_darwin on the common path). - The pass split limit is a profile key, pass_split_max (default 2, as before; DM_NVN_PASS_SPLIT_MAX still overrides), and pass_split_try counts why it declines (@psplit_*). Merged with main's own replay work (PR seedds#3239) rather than beside it: the 64 KB pool region table stays and the replay's last-hit entry is looked at before it; main's vertex-stream rule, binding lists, image pool bindings (IMGP), fam_is_valid, tex_fast_rid_meta, fbd_draw_note and the indirect-draw pool note are all kept on the faster paths. Measured step by step on the checkpoint route (M1 Max, scripts/bench.py, 2 runs a variant) on the branch before it was rebased onto main, with PRs seedds#1389 and seedds#1765 under it: replay CPU about 30 -> 22.5 ms a frame over the first round (za notes, binding scans, unretained buffers, mesh draws' blocks), then 8,138 -> 4,028 instructions a draw and 15.8 -> 9.4 ms of submit CPU over the later rounds, the frame at the game's 60 Hz cap (p50 16.7 ms, p99 17.6 ms). Each entry's own figure is in its reference entry. On main, this commit with the others of the branch: see the game note and the PR. Checked: the host builds; make -C dm/gfx/tests GAME=040074A01BF12000 run (MTL_DEBUG_LAYER=1 where the Makefile sets it); dm/tools/tests test_docs.py and test_env_switches.py. The reference entries are in docs/reference/frame-rate.md, one per area above, with a line each in Donkey Kong Bananza's note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nks8VtXWAu8ZQS6PeS1FPv
g8row
added a commit
to g8row/nxnative
that referenced
this pull request
Nov 26, 2026
…ts a long pass once Two profile keys and a bench route for the game, measured on the checkpoint route (a save at a checkpoint in a busy view, about 26,200 draws a frame, M1 Max, scripts/bench.py, 2 runs a variant): - draw_barriers game: with the default full barrier each of the ~120 draw passes a frame waited for all earlier GPU work, so the ~70 small post-processing passes at the frame's end ran one after another. Frame 21.28 -> 20.26 ms, the GPU after the last translation 5.2 -> 4.2 ms; the screen-recording flicker check and the 90 s screenshot unchanged (2026-11-23). - pass_split_max 1: each split of the long G-buffer pass stores and loads its attachments. With the faster translation one split starts the GPU early enough: limit 4 GPU p50 11.36 ms / frame p99 18.49 ms, 2 11.45 / 17.54, 1 11.05 / 18.11, none 11.01 / 20.54 (2026-11-24). - bench.tsv: the checkpoint route for scripts/bench.py (recorded with DM_REC; the save is the player's own, passed with --save). The branch against main on that route (M1 Max, macOS 27.0.1, the same app with only the host changed, 2 runs each): submit thread 14.2k -> 6.1k instructions and 1.155 -> 0.545 us a draw, 25.6 -> 14.3 ms of submit CPU a frame, GPU p50 18.0 -> 12.1 ms, 30.3 -> 52.4 fps. With DM_NVN_ENC_THREAD=1 (PR seedds#1765 turns it on for this game): 12.5k -> 4.3k instructions a draw, 21.4 -> 10.3 ms, GPU 19.3 -> 11.3 ms, 30.0 -> 59.8 fps at the 60 Hz cap (p99 35.1 -> 17.5 ms). On main the game's frame-rate controller holds 30 fps once frames pass 20 ms, so compare by the per-draw figures; main's scene loaded lighter (22,100 against 26,200 draws). Screenshots at 90 s match, no new [RED] lines. The game note records both keys, the route and these totals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nks8VtXWAu8ZQS6PeS1FPv
g8row
added a commit
to g8row/nxnative
that referenced
this pull request
Nov 27, 2026
In a busy view the host's translation of each frame is the frame's critical path: the game waits for an older frame's fence before it records the next. On Donkey Kong Bananza's checkpoint route (a save in a view of about 26,200 draws a frame) the replay thread translated for 14-18 ms a frame after main's per-draw changes, spread thinly over the draw path: no phase of DM_NVN_DRAWPROF above 5 ms, ~8,100 instructions a draw. Profiles of the leaf samples and the hot functions' disassembly found the same few patterns everywhere: answers asked again at every draw that change only at a bind, lookups that miss a single-entry cache, ARC traffic, thread-local reads and stack probes. Every change keeps what is encoded the same and has an off switch for A/B runs. - Diagnostics first: za_note_ formatted its text at every draw past its log limit (a fifth of draw_ in snprintf for one geometry shader whose slots stay 0); now it only counts there. DM_NVN_DRAWPROF=1 gives the replay thread's exclusive time by phase (@dp_<phase>_ms). - Binding scans that find nothing keep that answer with what it was made from (DM_NVN_FB_CACHE, DM_NVN_UBDT_CACHE), on the shader, and a uniform rebind asks again only the bindings that read a uniform slot (DM_NVN_UBSC_PART, DM_NVN_UBD_FAST). These sit on main's per-shader binding lists (sh_tex_list, sh_buf_list). - Argument blocks: after a mesh draw only the geometry stage is encoded again (DM_NVN_GEO_ARGS_KEEP); per-slot pool lookup memos (DM_NVN_CBMEMO, DM_NVN_CBRANGE); uniform-only patches take only the slots that changed, from a compact list (DM_NVN_CB_SLOTGEN, DM_NVN_CB_PATCH_IX); the size table handed out again (DM_NVN_CBSIZE_CACHE); blocks keep their CPU address (ab_cpu); fragment table addresses not written again (DM_NVN_FT_CACHE). - Vertex input: pool-range memos for streams, pulling layouts and index buffers (DM_NVN_VBMEMO), a dirty mask over the vertex table (DM_NVN_VBUF_DIRTY), a pulling layout cache (DM_NVN_PULL_CACHE, keyed by the attribute state, the streams with a buffer and those the shader reads, so main's absent-attribute W=1.0 rule is kept), and an off switch for main's read-streams-only rule (DM_NVN_VB_USED). - Draw state: a dirty bitmask for dynamic state (DM_NVN_DYN_DIRTY), each program's last pipeline (DM_NVN_PSO_PROG_CACHE), per-draw memos in bz_bind, border_need, vbuf_prepare, fb_prepare and udc_note_draw (DM_NVN_DRAW_MEMO); csh_dispatch_ahead no longer reads its 4,096-op scan limit as a dispatch ahead (about 300 needless stops a frame). - Geometry mesh runs: vertex table writes shadowed while a run is open (DM_NVN_GEO_SHADOW_VT) and a continuation path for draws 2..n of an unchanged run (DM_NVN_GEO_RUN_FAST). - Storage writes: a range already noted this submission returns at once, 64-page and wider ranges go to the interval list (DM_NVN_GW_WIDE), the page hash is cache-line grouped, rc_change remembers its last empty gap. A GPU write still arms main's sparse-pool shadow writeback first. - ARC, thread-locals and stack: arena / uniform / size-table buffers handed back unretained, plain-pointer program and pipeline lookups (PROG_GET, pso_get_v), the replay thread's pool table as a plain global chosen by its thread pointer (pc_tp, mtl_pc_claim), the pool generation read relaxed and fenced only when it moved (pool_gen_cur; ~90,000 LDARs a frame), recorded encoder calls written as C records (RO_R_*), and the large-frame paths of geo_draw and draw_ split into functions of their own (no ___chkstk_darwin on the common path). - The pass split limit is a profile key, pass_split_max (default 2, as before; DM_NVN_PASS_SPLIT_MAX still overrides), and pass_split_try counts why it declines (@psplit_*). Merged with main's own replay work (PR seedds#3239) rather than beside it: the 64 KB pool region table stays and the replay's last-hit entry is looked at before it; main's vertex-stream rule, binding lists, image pool bindings (IMGP), fam_is_valid, tex_fast_rid_meta, fbd_draw_note and the indirect-draw pool note are all kept on the faster paths. Measured step by step on the checkpoint route (M1 Max, scripts/bench.py, 2 runs a variant) on the branch before it was rebased onto main, with PRs seedds#1389 and seedds#1765 under it: replay CPU about 30 -> 22.5 ms a frame over the first round (za notes, binding scans, unretained buffers, mesh draws' blocks), then 8,138 -> 4,028 instructions a draw and 15.8 -> 9.4 ms of submit CPU over the later rounds, the frame at the game's 60 Hz cap (p50 16.7 ms, p99 17.6 ms). Each entry's own figure is in its reference entry. On main, this commit with the others of the branch: see the game note and the PR. Checked: the host builds; make -C dm/gfx/tests GAME=040074A01BF12000 run (MTL_DEBUG_LAYER=1 where the Makefile sets it); dm/tools/tests test_docs.py and test_env_switches.py. The reference entries are in docs/reference/frame-rate.md, one per area above, with a line each in Donkey Kong Bananza's note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nks8VtXWAu8ZQS6PeS1FPv
g8row
added a commit
to g8row/nxnative
that referenced
this pull request
Nov 27, 2026
…ts a long pass once Two profile keys and a bench route for the game, measured on the checkpoint route (a save at a checkpoint in a busy view, about 26,200 draws a frame, M1 Max, scripts/bench.py, 2 runs a variant): - draw_barriers game: with the default full barrier each of the ~120 draw passes a frame waited for all earlier GPU work, so the ~70 small post-processing passes at the frame's end ran one after another. Frame 21.28 -> 20.26 ms, the GPU after the last translation 5.2 -> 4.2 ms; the screen-recording flicker check and the 90 s screenshot unchanged (2026-11-23). - pass_split_max 1: each split of the long G-buffer pass stores and loads its attachments. With the faster translation one split starts the GPU early enough: limit 4 GPU p50 11.36 ms / frame p99 18.49 ms, 2 11.45 / 17.54, 1 11.05 / 18.11, none 11.01 / 20.54 (2026-11-24). - bench.tsv: the checkpoint route for scripts/bench.py (recorded with DM_REC; the save is the player's own, passed with --save). The branch against main on that route (M1 Max, macOS 27.0.1, the same app with only the host changed, 2 runs each): submit thread 14.2k -> 6.1k instructions and 1.155 -> 0.545 us a draw, 25.6 -> 14.3 ms of submit CPU a frame, GPU p50 18.0 -> 12.1 ms, 30.3 -> 52.4 fps. With DM_NVN_ENC_THREAD=1 (PR seedds#1765 turns it on for this game): 12.5k -> 4.3k instructions a draw, 21.4 -> 10.3 ms, GPU 19.3 -> 11.3 ms, 30.0 -> 59.8 fps at the 60 Hz cap (p99 35.1 -> 17.5 ms). On main the game's frame-rate controller holds 30 fps once frames pass 20 ms, so compare by the per-draw figures; main's scene loaded lighter (22,100 against 26,200 draws). Screenshots at 90 s match, no new [RED] lines. The game note records both keys, the route and these totals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nks8VtXWAu8ZQS6PeS1FPv
Kayyluhh
added a commit
to Kayyluhh/nxnative
that referenced
this pull request
Nov 27, 2026
… held at present interval 1 by a v458752 cut, and enc_thread on): closed upstream (a build-specific cut with unverified game-speed effects and a per-game encode-thread key; main targets per-draw translation instead, seedds#3344); the note keeps main's text, game-patches.md regenerated
Kayyluhh
added a commit
to Kayyluhh/nxnative
that referenced
this pull request
Nov 27, 2026
…d first; Store.slim (seedds#2470) reads main's v2 cache schema; chain 2d0bb91984e7 -> ce42b3f44d72 Reverted before this merge (each its own commit): on main in its own form or superseded: seedds#1978 (1e06abd), seedds#3195 (8c7660d, discussion seedds#3291), seedds#2140 (62bcfd2), seedds#1594 (a694f17), seedds#1847's host changes (473c90d, 1999cbd), seedds#2173 (main's discussion-fed list), ef13ece's port of seedds#2390 (5fa41f3); closed upstream with nothing on main, at the user's choice: seedds#1827, seedds#1765, seedds#1642, seedds#1847's Bananza render scale (7984715), seedds#1717, seedds#2251, seedds#2259, seedds#2226. Conflicts: the frame lag ring (seedds#2074) beside main's acquire-next receipts (1999cbd): frame_lag_wait after main's offscreen early return, frame_lag_note before main's next_ticket bookkeeping, nvn_queue_present_hold / ticket_fence beside main's nq_receipt_wait_published; the prebuild tool's timer still writes nothing (da2808f) beside main's batched archive writes (4d62497), whose removal of the 1,000-capture flushes matches fa1df04; t_pso_archive runs both tool_write_waits_for_compiles and batch_wave; seedds#2470's slim argument kept beside main's pruning step and GL shader build; tests.yml takes main's list plus t_lag; t_audio_device keeps test_route_choice (main moved wait_for_phase up); development.md takes main's compressed-cache sentence plus seedds#2470's; rendering.md keeps seedds#2388's "3D upscaler" label in main's new text; the chain header is main's (dmsh_chain.py --header gives the same value). Merge fix: Store.slim measured index entries with length(b.data), a column main's v2 schema (5fa41f3) renamed to payload; it now picks the column as prune_shaders does, and its test counts stored bytes.
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.
Summary
Donkey Kong Bananza (
040074A01BF12000, v458752) fell to 30 fps for seconds in busy scenes on the Mac, such as the second world's dialog close-ups (18,000-24,000 draws), although the Mac shows those frames at 50-60 fps.The game's fixed-refresh frame-rate controller (
main+0x204a18) measures each frame from its start to the later of its submission and its GPU end. On the Mac, the host's translation (about 15 ms) and the GPU (about 12 ms) come one after the other in that measure. That makes about 27 ms, over the controller's 20 ms limit, so after two late frames it moved to present interval 2.patches.py: the cut above. A late frame is shown when it is ready, instead of being held to 30 fps. The fixed-interval path (cutscenes at interval 3) is not touched.game.tsv:enc_thread on. Translation on the submit thread in the close-ups goes from 15.6 to 12.6 ms.docs/agents/game-patches.md(regenerated) describe both.This is complementary to #1389. That PR runs the game's own VRR controller on screens of 120 Hz and more. This cut covers the fixed-refresh controller, which every other screen uses, and #1389's controller when it drops below 40 fps.
Evidence
The host profiler (#1041), Mac M5 Pro, fullscreen, the same close-ups:
dm/tools/patch_nso.pyon v458752's main changes exactly 4 bytes, at0x204abc.test_docs.pyandtest_launcher_settings.pypass.Open, in the game's note:
Merge Danger
Door: two-way
The cut is gated to v458752's build ID, so other builds keep the game's controller unchanged.
Blast Radius: one-game
It affects Donkey Kong Bananza v458752 only, on the Mac and on iOS (the encode thread is already on for every game on iOS).