Repository navigation
Conversation
…cene at one of its dynamic-resolution steps The game renders at its NDSR upscaler's output (2304x1296 docked, 1920x1080 handheld) divided by an upscale rate its dynamic resolution picks from a table of steps (1.0, 1.375, 1.5, 2.0) between NdsrUpscaleMinRate and NdsrUpscaleMaxRate. On an M4 MacBook Air it held 1152x648 docked, which a 2560x1440 screen showed blurred. Stubs in the profile's patches.py replace the two bounds where the two dynamic-resolution steps read them (main+0x38dd04, +0x38dd98, +0x38e104, +0x38e194) and the rate the update applies (main+0x38de2c) with the loader's 1 / scale (state +0x14, rounded to 1/40 so that 0.6667 and 0.7273 reach the 1.5 and 1.375 steps). The game sizes its targets per step: a rate between the steps snaps down, and writing one into the table drew the step's own size, so only the steps are offered. Handheld 1920x1080 is 0.999. Checked: handheld 1920x1080, 1397x786 and docked 1676x943, 1536x864, 2304x1296 render at those sizes (DM_NVN_GPUPROF); tool tests test_patches, test_docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n so far NVN signals the sync nvnWindowAcquireTexture hands out when the image is released by the display. The host fenced it with the latest fence, so a game that waits on it every frame (Donkey Kong Bananza, main+0x204298) waited for the frame it had just submitted: the CPU and the GPU took turns, about 9 ms of a 17 ms frame in that wait. The window now keeps the fence each image's present followed (win_t.pfence) and the acquire sync takes the acquired image's; the ticket wait before it still has that present taken. DM_NVN_ACQ_FENCE=last gives the old fence. Measured on Donkey Kong Bananza handheld 1080p (M4 MacBook Air): the acquire wait went to none; the game's own wait for its frame's fence (main+0x204280) remains, so its frame time stayed 17.0 ms. Letting that wait return a frame early gave 60 fps but drew wrong pictures (the game rewrites data the GPU still reads), so it is not done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… patches, a larger store-witness set, long passes split while the GPU idles, cached mesh lookups and a GPU clock keeper Donkey Kong Bananza's later layers ran at 20 fps on an M4 MacBook Air: about 27,000 draws a frame, 21 ms of translation and a GPU macOS kept at a low clock. - encode_args_: a stage whose only change since its last block is uniform bindings (g_args_dirty 2) gets a copy of that block with those slots made again (12,000 draws a pass, 47 fragment bindings, one uniform slot changing); ubd_conflict_sh keeps its last answer of no conflict and looks again only at the slots that changed. - The store-witness set has 65,536 slots: 16,384 overflowed at Bananza's 13,700 noted pages, which counted as a write anywhere and ended the pass before each HUD draw (5,700 per 300 frames, now none; attachments 750 -> 457 MB a frame). The pool cache is allocated per thread on first use and tries its last hit first. - Long passes are split when the GPU has nothing else to run (DM_NVN_PASS_SPLIT 1536 draws, DM_NVN_PASS_SPLIT_FIRST 384 with nothing in flight, DM_NVN_PASS_SPLIT_IDLE), geometry mesh draws included: the map's depth prepass held the GPU idle 3.4 ms a frame. - geo_mesh_pso_for returns the last built pipeline for the same key and geo_mesh_take keeps the last function's run twin: a boxed key and a dictionary lookup a draw took 12 % of the submit thread on the map. - The GPU clock keeper (Mac): a thread spins one threadgroup on its own queue for a duty set by the frames' GPU time (up above 14 ms, down below 11.5), so macOS raises the clock a frame-paced GPU needs; the same pass took 23 ms paced at 30 fps and 12.6 ms back to back. DM_GPU_KEEP=0 turns it off, 1 holds full duty (which heated a fanless Air until its CPU slowed). - nvn_queue.inc: a queue snapshot's command bytes grow by doubling instead of 4 KiB steps. Measured (M4 MacBook Air, 16 GB, macOS 27): later layers handheld 20 -> 60 fps (two back-to-back 10-minute runs), docked about 54; the zoomed-out map docked 30 fps (33.3 ms) -> about 18 ms. Not measured: other games; regress.py was not run (only this game is local). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… map, and frame-rate entries for the GPU clock keeper, the acquire sync, long-pass splits, uniform-only argument patches, the store-witness set and mesh lookups Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4147ce8 to
64625c2
Compare
…_key_fill zeroes the whole key first, padding included, as for the other pso_key comparisons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sh library: its second geometry pair (vertex a504d5de36060114, the same culling kernel 5d537f7630ec3671) is in geo_mesh.tsv The Canyon Layer's map draws its terrain with a vertex shader the first pair does not have, so those draws took the geometry compute path: each chunk of 64 draws ended the pass for its dispatch, about 40 compute encoders of 0.2 ms each, 7 ms of GPU a frame, and the map held 30 fps docked. Built as a mesh library they run in the pass: compute 7 -> 0.02 ms, 143 -> 76 passes a frame, GPU span 27 -> 15-21 ms (M4 MacBook Air, docked, 2304x1296). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
win_t keeps both the present fences (pfence) and main's active swap chain count (nactive); nq_bytes keeps the doubling growth with main's realloc NOLINT; game-patches.md and symptoms.md regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eline: newFunctionWithName may return nil (clang-tidy nullability) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game note keeps this branch's render scale, frame time and map lines and takes main's iOS line with its community report in place of "iOS untested". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…string, so the clang-tidy ratchet's NullablePassedToNonnull count for the file is back at its baseline Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t's link line names (pad_switch2_apple.m uses it under TARGET_OS_OSX): the iOS link failed with "framework 'IOBluetooth' not found" Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # dm/ios/tools/gen_build.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ratchet asks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream's argument-block patch (adaff73: g_args_ubo, args_cbuf_only, cbuf_slot, with the uniform size table) replaces this branch's (g_args_dirty 2, args_dirty_ubo, ab_patchable), which did not write the size table again. The branch keeps ubd_conflict_sh's cached answer; its frame-rate.md entry now covers that alone and points at upstream's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A data point for commit 3's "long passes split while the GPU is idle" and for commit 2, from Ocarina of Time ( A fork carries the same split as How it was measured: a route recorded from play and replayed read for read with a fixed game step, Kokiri Forest, the first 10 s (about 3,300 draws and 119 passes a frame, dynamic resolution off), frames not held, so the scene is GPU-bound. Medians per frame, one run per row; five runs of the first row span 23.70 to 24.04 ms.
So the split is worth at most about 0.3 ms here (1.3 %), close to the run-to-run spread. What it saves in idle time it nearly pays back in attachment loads and stores. Splitting before the GPU has run dry doubles the cuts (8 a frame against 4) and gains nothing. Where the idle time sits in this game (Metal System Trace at the same spot, 434 frames): the GPU is idle 3.4 ms of a 23.6 ms frame, and for 2.4 ms of that the next command buffer was handed over during the gap. It is the start of each frame: the GPU waits about 0.6 ms for the frame's first command buffer and runs dry two to four more times in the first 5 ms. Later command buffers are queued 3 to 10 ms ahead. For commit 2: |
508fa05 was committed after a stash cleared the merge state: it is not a merge and lacks part of upstream's changes. This commit has the full merge of 7c384e7 into 1867483 with its fixes: - nvn_geometry.inc: upstream's geo_mesh_entry with this branch's run-twin cache generation (g_geo_mesh_runfn_gen) - ruff: dmsh_entry.py's unused dmsh_fetch import removed; dmsh_chain.h rewritten (chain 648f214d66ac) - clang-tidy: t_mip_extent.m frees its linear copy of the recording; nvn_mtl.m's NullDereference count back at main's 9 - tool tests: test_dmsh_pool_arrays passes with main's fix; docs/env_switches.tsv lists DM_NVN_VCONV_KEEP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested this PR merged onto current main on an M5 Pro MacBook Pro (Donkey Kong Bananza v458752, Sublayer 900's 3D map, panning over the lava, 9,000-15,000 draws a frame). With the whole PR the map holds 59-60 fps, but the terrain blinks with artifacts while panning. With Sublayer 900's map also needed a mesh library for another geometry pair, |
…e page set: Mario Kart World's replay thread 1.4 ms a frame faster at a four-player race's start gw_commit puts the pages a submission's shaders wrote (sbw_note: writable storage buffers, texture to buffer copies) into the tables of running GPU writes. The pages are kept in a set of slots tagged with the submission (g_sbwp, g_pend_gen), and the commit found its own by looking at every slot: 16,384 on main, 65,536 since the set grew for Donkey Kong Bananza (PR seedds#1847, in this tree). A game that submits a frame in many pieces pays that for each piece: Mario Kart World commits 23 times a frame with two players and 42 times with four, nearly every one with a page or two in the set. In a sample of its replay thread with four players the walk was the whole self time of mtl_sub_commit, 618 of 12,754 samples, all of them in the loop over the slots: 1.6 ms of the 25 ms the thread has a frame. sbw_slot now notes each slot it takes in the order taken (g_sbw_ls, 16 bits a slot), and the commit walks those. The set of slots is the same one: a slot is of this submission exactly when sbw_slot took it since pend_reset, which is when g_nsbw counted it. The order of the walk changes from slot order to the order taken; gw_put's result for a table slot does not depend on the order of the pages put with one fence (the page if all are the same page and what was there is done, else the mark for two live pages). Measured (Mario Kart World 1.8.0, a 16 GB M2 Pro, 150cc, the encode thread on, the build before against this one, one run each unless two are given). Four players, a race's first 20 s (11,000 draws a frame): the replay's instructions a draw 22,665 / 22,961 -> 21,490, its CPU time a frame 25.23 / 25.48 -> 23.95 ms, on the clock 26.83 / 27.23 -> 25.79 ms; from the 20th second on 21.96 -> 21.06 ms. Two players: 12.03 -> 11.20 ms in the first 20 s with 9 -> 3 late frames, 9.92 -> 9.32 ms after. One player: 6.98 -> 6.38 ms a frame. Tests: t_sbw (check_t_sbw, 41 checks, 8 new): 5,000 pages written by shaders and one that holds only a report; the set counts them, the list names each slot once, the commit looks at 5,001 slots, every written page is a live GPU write after it and the report's page is not, the next submission's commit looks at its own page alone, and none is live once the fences are done. With the walk over the whole set 2 fail, without the list 3. The reference entry (A commit looked at every slot of the page set its submission's shaders wrote) and the game's note are new; symptom index regenerated. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
…e page set: Mario Kart World's replay thread 1.4 ms a frame faster at a four-player race's start gw_commit puts the pages a submission's shaders wrote (sbw_note: writable storage buffers, texture to buffer copies) into the tables of running GPU writes. The pages are kept in a set of slots tagged with the submission (g_sbwp, g_pend_gen), and the commit found its own by looking at every slot: 16,384 on main, 65,536 since the set grew for Donkey Kong Bananza (PR seedds#1847, in this tree). A game that submits a frame in many pieces pays that for each piece: Mario Kart World commits 23 times a frame with two players and 42 times with four, nearly every one with a page or two in the set. In a sample of its replay thread with four players the walk was the whole self time of mtl_sub_commit, 618 of 12,754 samples, all of them in the loop over the slots: 1.6 ms of the 25 ms the thread has a frame. sbw_slot now notes each slot it takes in the order taken (g_sbw_ls, 16 bits a slot), and the commit walks those. The set of slots is the same one: a slot is of this submission exactly when sbw_slot took it since pend_reset, which is when g_nsbw counted it. The order of the walk changes from slot order to the order taken; gw_put's result for a table slot does not depend on the order of the pages put with one fence (the page if all are the same page and what was there is done, else the mark for two live pages). Measured (Mario Kart World 1.8.0, a 16 GB M2 Pro, 150cc, the encode thread on, the build before against this one, one run each unless two are given). Four players, a race's first 20 s (11,000 draws a frame): the replay's instructions a draw 22,665 / 22,961 -> 21,490, its CPU time a frame 25.23 / 25.48 -> 23.95 ms, on the clock 26.83 / 27.23 -> 25.79 ms; from the 20th second on 21.96 -> 21.06 ms. Two players: 12.03 -> 11.20 ms in the first 20 s with 9 -> 3 late frames, 9.92 -> 9.32 ms after. One player: 6.98 -> 6.38 ms a frame. Tests: t_sbw (check_t_sbw, 41 checks, 8 new): 5,000 pages written by shaders and one that holds only a report; the set counts them, the list names each slot once, the commit looks at 5,001 slots, every written page is a live GPU write after it and the report's page is not, the next submission's commit looks at its own page alone, and none is live once the fences are done. With the walk over the whole set 2 fail, without the list 3. The reference entry (A commit looked at every slot of the page set its submission's shaders wrote) and the game's note are new; symptom index regenerated. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
…e page set: Mario Kart World's replay thread 1.4 ms a frame faster at a four-player race's start gw_commit puts the pages a submission's shaders wrote (sbw_note: writable storage buffers, texture to buffer copies) into the tables of running GPU writes. The pages are kept in a set of slots tagged with the submission (g_sbwp, g_pend_gen), and the commit found its own by looking at every slot: 16,384 on main, 65,536 since the set grew for Donkey Kong Bananza (PR seedds#1847, in this tree). A game that submits a frame in many pieces pays that for each piece: Mario Kart World commits 23 times a frame with two players and 42 times with four, nearly every one with a page or two in the set. In a sample of its replay thread with four players the walk was the whole self time of mtl_sub_commit, 618 of 12,754 samples, all of them in the loop over the slots: 1.6 ms of the 25 ms the thread has a frame. sbw_slot now notes each slot it takes in the order taken (g_sbw_ls, 16 bits a slot), and the commit walks those. The set of slots is the same one: a slot is of this submission exactly when sbw_slot took it since pend_reset, which is when g_nsbw counted it. The order of the walk changes from slot order to the order taken; gw_put's result for a table slot does not depend on the order of the pages put with one fence (the page if all are the same page and what was there is done, else the mark for two live pages). Measured (Mario Kart World 1.8.0, a 16 GB M2 Pro, 150cc, the encode thread on, the build before against this one, one run each unless two are given). Four players, a race's first 20 s (11,000 draws a frame): the replay's instructions a draw 22,665 / 22,961 -> 21,490, its CPU time a frame 25.23 / 25.48 -> 23.95 ms, on the clock 26.83 / 27.23 -> 25.79 ms; from the 20th second on 21.96 -> 21.06 ms. Two players: 12.03 -> 11.20 ms in the first 20 s with 9 -> 3 late frames, 9.92 -> 9.32 ms after. One player: 6.98 -> 6.38 ms a frame. Tests: t_sbw (check_t_sbw, 41 checks, 8 new): 5,000 pages written by shaders and one that holds only a report; the set counts them, the list names each slot once, the commit looks at 5,001 slots, every written page is a live GPU write after it and the report's page is not, the next submission's commit looks at its own page alone, and none is live once the fences are done. With the walk over the whole set 2 fail, without the list 3. The reference entry (A commit looked at every slot of the page set its submission's shaders wrote) and the game's note are new; symptom index regenerated. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcmewFJDrDUooyBk9ygMAv
…es its scene at one of its dynamic-resolution steps, and the Canyon Layer map's terrain gets a mesh library Cherry-picked from seedds#1847: c6f5f9a (the render scale stubs in its patches.py, gated to v458752's main; the loader's 1 / scale at state +0x14, which only those stubs read) and 7431dd9 (the second geometry pair, a504d5de36060114, in geo_mesh.tsv, written in main's form beside the pairs no recording has reached), with the game note's render scale and frame time paragraphs from 64625c2. Left out: the host-wide changes (the GPU clock keeper, the acquire sync, long-pass splits, the translation caches), which reach every game and are waiting for a regression run, and the chain header change.
… its parts not on main): a larger store-witness set, cached uniform-conflict and vertex-stream checks, cached mesh lookups, doubling queue buffers and the GPU clock keeper (cherry picked from commit ac10683) Main has the rest in its own form: the pool lookup's last hit, uniform-only argument patches (args_cbuf_only) and long-pass splits (seedds#1468, pass_split_try); those hunks keep main's code and seedds#1847's split is left out.
…release, a GPU clock keeper on the Mac, and translation caches for heavy NVN frames From regress/pr1847-host: seedds#1847's cbce3d5, its ac10683 without what main has in its own form (the pool lookup's last hit, uniform-only argument patches, long-pass splits from seedds#1468), 03d2598 and ca08664. Its docs come with it: the DM_GPU_KEEP, DM_GPU_KEEP_MS and DM_NVN_ACQ_FENCE rows and five frame-rate.md entries (the uniform-conflict one rewritten for main's patching), linked from Donkey Kong Bananza's note. Played on the Mac on two games by the batch owner; regress.py not run.
Resolutions: - seedds#1847's queue-buffer doubling is on main in its own form (2a67900): main's nq_bytes stays. Its uniform-conflict cache now runs main's new buffer-texture check (ubd_conflict_textures) on every call, since bound textures are not part of the cached state; its GPU clock keeper starts from main's mtl_init_once. - seedds#1822's microphone input keeps its sources and frameworks beside main's new audio output (CoreAudio, t_audio_live, t_friends in the test list). - seedds#1717's sound delay line follows main's per-route device channels (a->dev_ch, sized for a->ch); its sync test and main's rate test both run in t_audio. - seedds#2710's level count uses main's sink channel count; t_audren_snd stubs main's system-event bindings and audio route. - Ocarina of Time: main's movie-player patches beside seedds#2259's frame-ratio entry; seedds#2173's 85 mesh pipeline rows and main's 10,415 compute rows both kept in pso_manifest.tsv. - CI list: main's, plus t_lag (seedds#2074). Switch table regenerated; symptom index and game-patches.md regenerated; chain header is main's 7a2020f13431.
… inside seedds#1971 (9143b6f), so the frame step takes main's form (its GPU-idle and unpaced-probe code with main's stalls and fine link) and keeps seedds#2259's measured frame time and seedds#1942's own t_fstep cases; the batch's store-witness set (seedds#1847) gives way to main's growable one (a67583a); the display link's latency keeps seedds#1717's no-2-on-a-30-Hz-link beside main's fine-mode latency; the acquire sync keeps the batch's image fence with main's focus / settle marks; Donkey Kong Bananza's geo_mesh.tsv goes as on main (the split's geo_pairs.tsv names its rows, the batch's Canyon Layer a504d5de36060114 among them); main's Ocarina smoke route replaces an untracked local one; game notes, the games table (Mario Kart World's v917504 kept), settings (Rotation beside Sound output), the CI list (t_lag kept), shader_lib's dedup with main's .part cleanup, the packer's RomFS tweaks read from main's romfs; game-patches.md and the symptom index regenerated; chain 26e1a5f38264 -> f19baf01187e
… and seedds#3156 reverted first (on main in its own form / superseded by seedds#3174); chain 6cc6fc49af97 -> 3fe2e3787fdf Conflicts, both sides kept: - hle_nvn.c: main's deferred acquire wait (c17a549, acq_wait bound to the sync) takes the batch's acquire fence (seedds#1847's 81c6189: the image's own last present, pfence, snapshotted with the ticket under acq_mu; DM_NVN_ACQ_FENCE=last the old one) as aw->gpu_fence, and DM_NVN_FRAME_LAG's wait at the acquire's start; the present notes the lag ring before publishing its ticket, and @lag_ms stays beside main's atomic @wait_ms / @pq_wait_ms. nvn_obj.h win_t has pfence and pending_acq. - nvn_mtl.m: the pool cache keeps seedds#1847's last-hit entry in front of main's 64 KB region table (a359f9e); ubd_conflict_scan's partial look walks main's buffer binding list (e49e481). - shader_lib.py: seedds#2140's shared payloads with main's on_progress (seedds#2684). - hle_fs.c: the profile's RomFS files beside main's releasable mounts (seedds#3217). - game.py (main's mem_map_limit default), pack_app.py (--tweaks and --mesh-pairs), env_switches.tsv, frame-rate.md, services.md, Ocarina's note: both entries. - dm/host/tests/Makefile: t_crash_diag (new on main) links memstat.m, which seedds#2261's GPU share line makes use IOKit: -framework IOKit. Chain header is main's (dmsh_chain.py --header agrees); symptom index, game-patches.md and env_switches.tsv order regenerated.
…in's whole Metal 4 mesh pipelines (8ecae8c) drop mesh_pairs, so the packer keeps the batch's --tweaks without --mesh-pairs and Ocarina's note keeps the batch's 248 M rows without the mesh-bases measurement; geo_mesh_entry takes main's fn_load (5491ae3) beside seedds#1847's g_geo_mesh_runfn_gen; symptom index regenerated; chain d1d792adc17b -> f91c9c0a78e3
On Horizon, an acquired swapchain image is returned once the compositor has replaced it with the next present, so the GPU has completed that successor frame. Previously, the host waited only on the image's own previous present plus a racy mtl_last_fence() snapshot taken at acquire time, allowing two-image games that pace per-frame constants on the acquire sync alone (Xenoblade DE Switch 2, Xenoblade Chronicles 3 #3296) to overwrite live constants when nq_worker trailed, and causing three-image swapchains to over-wait on frame N-1 once replayed. Track each slot's successor present receipt directly in win_t.next_ticket[4] (via last_pres), atomically hand both receipts to nvnWindowAcquireTexture, wait on the successor's replay publication and GPU fence (without blocking on its display/snapshot release), snapshot both receipts in nvnQueueWaitSync / nvnCommandBufferWaitSync, and drop the racy mtl_last_fence() fallback under default DM_NVN_ACQ_NEXT=1 (superseding PR #1847's own-present fence). DM_NVN_ACQ_NEXT=0 restores the legacy acquire wait for A/B isolation. Co-authored-by: Will Varner <37232968+willv678@users.noreply.github.com>
|
Quick heads-up for rebasing this PR: the acquire-sync change has landed on |
Avoid per-draw NSValue boxing + dictionary lookup on g_geo_mesh_runfn in geo_mesh_take (invalidated via g_geo_mesh_runfn_gen) and per-draw g_pso_mesh_lock + hash lookup in geo_mesh_pso_for when pso_key matches the last built pipeline. Co-authored-by: VladimirRIS-23-2 <38818762+vivashka@users.noreply.github.com>
|
Thank you @vivashka for the profiling and Donkey Kong Bananza measurements here. I've landed the mesh pipeline and run-twin single-entry cache from this PR on
I'm closing this PR rather than merging the remaining two parts as written:
Checked: |
seedds#1847) macOS sets the GPU's clock from how busy it was. A game that waits for an older frame's fence before it records the next leaves the GPU idle while the host translates, so each frame's GPU work started at a lower clock: on Donkey Kong Bananza's checkpoint route the same frame took 16.3 ms of GPU, against 13.6 ms when an experiment kept the GPU busy between frames. This ports PR seedds#1847's GPU clock keeper as it is (gpu_keep_main in nvn_mtl.m, Mac only): a thread keeps one threadgroup spinning on its own queue part of the time, its duty raised every half second while a frame's GPU time is above 14 ms and lowered below 11.5 ms, and stopped when nothing is presented for a quarter second. DM_GPU_KEEP=auto is the default, 1 full duty, 0 off; DM_GPU_KEEP_MS=<hi>,<lo> moves the thresholds. Measured on the checkpoint route (about 26,400 draws a frame, M1 Max, 2 runs each, before the branch was rebased onto main): GPU p50 16.3 -> 12.4 ms, frame p50 25.8 -> 24.6 ms (38.0 -> 40.7 fps). Full duty had one run of the two at 45 ms frames with 37 ms of GPU, so auto stays the default. Not measured: other Macs, and the power cost on this one. The reference entry is in docs/reference/frame-rate.md ("The GPU clock fell between frames"), the switches in docs/env_switches.tsv. Co-authored-by: vivashka <38818762+vivashka@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nks8VtXWAu8ZQS6PeS1FPv
seedds#1847) macOS sets the GPU's clock from how busy it was. A game that waits for an older frame's fence before it records the next leaves the GPU idle while the host translates, so each frame's GPU work started at a lower clock: on Donkey Kong Bananza's checkpoint route the same frame took 16.3 ms of GPU, against 13.6 ms when an experiment kept the GPU busy between frames. This ports PR seedds#1847's GPU clock keeper as it is (gpu_keep_main in nvn_mtl.m, Mac only): a thread keeps one threadgroup spinning on its own queue part of the time, its duty raised every half second while a frame's GPU time is above 14 ms and lowered below 11.5 ms, and stopped when nothing is presented for a quarter second. DM_GPU_KEEP=auto is the default, 1 full duty, 0 off; DM_GPU_KEEP_MS=<hi>,<lo> moves the thresholds. Measured on the checkpoint route (about 26,400 draws a frame, M1 Max, 2 runs each, before the branch was rebased onto main): GPU p50 16.3 -> 12.4 ms, frame p50 25.8 -> 24.6 ms (38.0 -> 40.7 fps). Full duty had one run of the two at 45 ms frames with 37 ms of GPU, so auto stays the default. Not measured: other Macs, and the power cost on this one. The reference entry is in docs/reference/frame-rate.md ("The GPU clock fell between frames"), the switches in docs/env_switches.tsv. Co-authored-by: vivashka <38818762+vivashka@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nks8VtXWAu8ZQS6PeS1FPv
… translation caches): closed; on main in its own form as 473c90d (mesh pipeline and run-twin cache) and 1999cbd (seedds#3372: the acquire sync waits for the successor present), with main's own store-witness growth and command-buffer growth; the GPU clock keeper (DM_GPU_KEEP) was declined upstream and goes too, as does the ubd_conflict_sh cache
…_SCALE stubs at v458752's NDSR rate bounds, the loader's state +0x14, and the Canyon Layer geo_mesh row): seedds#1847 closed; the render scale was declined as written (fixed build addresses; a function-matched stub would be welcome), and main pairs Bananza's mesh libraries automatically (no geo_mesh.tsv); game-patches.md regenerated
…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.
Avoid per-draw NSValue boxing + dictionary lookup on g_geo_mesh_runfn in geo_mesh_take (invalidated via g_geo_mesh_runfn_gen) and per-draw g_pso_mesh_lock + hash lookup in geo_mesh_pso_for when pso_key matches the last built pipeline. Co-authored-by: VladimirRIS-23-2 <38818762+vivashka@users.noreply.github.com> (cherry picked from commit 473c90d)
What and why
Donkey Kong Bananza's later layers ran at 20 fps on an M4 MacBook Air (10 GPU cores, fanless), its zoomed-out map docked at 30, and its scene held 1152x648 docked, which a 2560x1440 screen showed blurred. Four commits:
dm/games/040074A01BF12000/patches.py,loader.c):DM_RENDER_SCALEfixes the scene at one of the game's dynamic-resolution steps (1.0, 1.375, 1.5, 2.0 of the NDSR output). The game sizes its targets per step, so a scale between the steps snaps down; this is in its note.hle_nvn.c,nvn_obj.h): it was fenced with every submission so far, so a game waiting on it every frame waited for the frame it had just submitted.DM_NVN_ACQ_FENCE=lastgives the old fence.nvn_mtl.m,nvn_geometry.inc,nvn_queue.inc): uniform-only argument-block patches, a 65,536-slot store-witness set (16,384 overflowed and ended the pass before each HUD draw), long passes split while the GPU is idle (geometry mesh draws included), cached mesh pipeline and run-twin lookups, and a duty-driven GPU clock keeper on the Mac (macOS lowers the clock of a frame-paced GPU: the same pass 23 ms paced at 30 fps, 12.6 ms back to back).docs/reference/frame-rate.mdentries for each mechanism;docs_symptoms.pyanddocs_patches.pyrun.Checked
make -C dm/host/tests GAME=040074A01BF12000 runpasses; the CI list of CPU-only gfx tests (t_perf_order --cpuand the 26 others) passes; tool tests: all pass excepttest_env_switches(DM_NVN_CUT_FIRST,DM_NVN_RT_RECLAIM,DM_NVN_VC_WAYSquoted in docs) andtest_tree_tar, which fail the same way onmainat 7b6506d, andtest_nsp_nup/test_xcode_workflow, which need more free disk than this Mac has. GPU (Metal) tests not run.lint_c/lint_pythonnot run locally (no clang-tidy / ruff).040074A01BF12000v458752 (from a NUP), Layer 200 (Hilltop Layer) and its map, many runs of 4-10 minutes withDM_NVN_TSVframe rows,DM_NVN_GPUPROFand pass dumps, screenshots compared by eye.scripts/regress.py check --games: not run; only this game is local. Commit 2 (acquire fence) and 3 (pass splits, argument patches, GPU clock keeper) reach every NVN game.ea0c98dfthe 1080p frame is 18.1 ms here: the queue snapshot adds about 1.2 ms before the replay, and the game's GPU event waits send almost every submission through the scheduler (in the note; not changed here beyond the snapshot's buffer growth).Docs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)🤖 Generated with Claude Code