Repository navigation
Conversation
…ven while earlier work runs: Ocarina of Time -0.85 ms a frame on an M1 Ocarina of Time holds one frame in flight: its main thread waits on the fence of the frame it just submitted (the wait ledger: SyncWait on the newest fence 0.72 times a frame, 17.4 ms), so at each frame boundary the GPU has nothing queued until the next frame's first segment is committed. sub_cut's busy rule commits a segment only once no earlier one is in flight, which held that first segment back until the previous frame's last ran out, and then until the next cut point: a counter-free Metal System Trace on an M1 showed 0.4-3 ms of GPU idle there every frame. Now a submission's first segment is cut after DM_NVN_CUT_FIRST_N draws (8) and committed at once (DM_NVN_CUT_FIRST, on by default; =0 off, ab for the DM_AB phases), so it runs while the previous frame's last work finishes. Measured (0400486024DEC000, Kokiri Forest, MacBook M1 8-core GPU, fullscreen, in a tree with other local changes, among them the image-heap alias flush once a submission of the companion PR, which lets command buffers overlap at all): DM_NVN_CUT_FIRST=ab:2,3/4 in 300-frame phases, frame p50 36.33 / 36.41 / 36.37 ms with it against 37.19 / 37.33 / 37.41 without; with the phases swapped (ab:0/2, 450-frame phases) 36.48 / 36.53 / 36.51 against 37.57 / 37.38 / 37.35: -0.85 ms, lower in every phase both ways. Without the overlap the alias flush on every barrier forbids, an earlier test of committing every segment at once gained nothing, so the gain here likely needs that change. Not run: this branch's host in game, any test suite, the iPhone, other games. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tried this on an M1 Pro (16-core GPU, macOS 27.2.1) with OoT, in a tree with your other open PRs merged on top of main (no 2525), MetalFX on, dynamic resolution off, mesh-as-compute off. Same-process On this GPU I don't see a frame-time change: frame p50 stayed at 33.3 ms with it on and off, at a 30 and a 60 fps target. The M1 Pro has headroom here (GPU ~24-27 ms), so there's no idle gap at frame boundaries to win back the way there is on your 8-core M1. One thing I did notice: the GPU time counter reads higher with it on, every cycle:
That's +2.4 ms in the paired 60 fps run and about +1.9 ms in a 9-phase leave-one-out run at 30 fps. It might just be segments overlapping and being counted twice rather than real extra work, since frame pacing didn't change at all, but it'll make GPU-time comparisons look worse with this on. |
…ven while earlier work runs: Ocarina of Time -0.85 ms a frame on an M1 Hand port of seedds/nxnative PR seedds#2526 (commit efa80a1, Adya). Main split sub_cut into sub_cut_ready since the PR was written, so the first-segment draw count goes into sub_cut_ready and the busy rule in sub_cut skips the first segment, as in the PR. nxnative-ultimate: off by default here (DM_NVN_CUT_FIRST=1 turns it on); the PR has it on. No change measured on an M1 Pro.
What the 2026-11-16 search tried in in-run A/B and did not keep (open pull requests seedds#2526, seedds#2677 and seedds#2771 measured on this game, DM_NVN_ARGS_LEAN, DM_NVN_REC_EAGER, DM_NVN_PASS_FENCE), and what shader_row_bounds measured on its light loops. Docs only.
What the 2026-11-16 search tried in in-run A/B and did not keep (open pull requests seedds#2526, seedds#2677 and seedds#2771 measured on this game, DM_NVN_ARGS_LEAN, DM_NVN_REC_EAGER, DM_NVN_PASS_FENCE), and what shader_row_bounds measured on its light loops. Docs only.
|
Hi! This branch is based on a To pick up the fix, merge the current git fetch origin
git merge origin/main
git pushIf the merge has conflicts, ask here if you want help with them. |
|
Tested on an M2 MacBook Air (16 GB), Ocarina of Time v131072, on a local test build that carries this PR. Same method as above, Castle Town only: A = default, B =
On this machine at cap 60, where the GPU is the bottleneck, I see no measurable effect either way. That fits the PR's numbers, which come from an M1 where submission was more CPU-bound. One caveat: one of the six runs (A3) hung on an unrelated, known freeze and is left out, so A has two runs. |
|
Thank you for the Metal System Trace and M1 measurements (and thanks to @devMlGUE and @dpadr for the follow-up tests on M1 Pro and M2 Air). We are closing this PR rather than rebasing it onto current
Checked: Reviewed this PR against current Still open: We have not measured an 8-core M1 on current |
What
A submission's first segment is cut after
DM_NVN_CUT_FIRST_Ndraws (8) and committed at once, even while earlier segments are still running (DM_NVN_CUT_FIRST, on by default;=0off,abfor theDM_ABphases).Why
Ocarina of Time holds one frame in flight: its main thread waits on the fence of the frame it just submitted (wait ledger: SyncWait on the newest fence 0.72 times a frame, 17.4 ms). At each frame boundary the GPU has nothing queued until the next frame's first segment is committed.
sub_cut's busy rule commits a segment only once no earlier one is in flight. That held the first segment back until the previous frame's last ran out, and then until the next cut point. A counter-free Metal System Trace on an M1 showed 0.4–3 ms of GPU idle at every frame boundary. Committed early, the first segment runs while the previous frame's last work finishes.Performance
Ocarina of Time (0400486024DEC000), Kokiri Forest, MacBook M1 (8-core GPU), fullscreen, in a tree with other local changes. Those include the image-heap alias flush once a submission (companion PR), which lets command buffers overlap at all.
ab:2,3/4, 300-frame phasesab:0/2, 450-frame phasesAbout −0.85 ms a frame, lower in every phase both ways.
An earlier test of committing every segment at once gained nothing while the alias flush on every barrier serialized the GPU. So this gain probably depends on the companion change.
Switches (in
docs/env_switches.tsv)DM_NVN_CUT_FIRST=0|1|ab: on by default.DM_NVN_CUT_FIRST_N=<draws>: the first segment's size (default 8).Not run
🤖 Generated with Claude Code