Repository navigation
Conversation
|
Note: I couldn't run |
…s translated) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013SzykpcKm2eZPvPjGPKx1C
# Conflicts: # dm/gfx/nvn/nvn_mtl.m
|
Rebased onto main (04811a6); no changes besides conflict resolution (the forward declarations next to gmem_commit_patch). |
With no segment on the GPU and DM_NVN_PASS_SPLIT draws (256) encoded since the last cut, the open pass is ended (attachments stored by rp_end as at every other mid-pass end), the segment committed, and the next draw opens the pass again with loads; at most DM_NVN_PASS_SPLIT_MAX (2) splits a pass. A pass reopened by a split does not run the dispatch-hoist scan again.
|
Rebased onto main (2e6edda), retitled to the Checked on this commit (M4 Max): host build, |
|
Now that this Mac has the chain lock's compiler (Xcode 27.2), regress.py check (full): PASSBaseline
BOTW
|
A segment could be committed only between passes, so a long pass reached the GPU at its end: Breath of the Wild draws 2,700 of its 4,100 draws a frame into one G-buffer pass, and the GPU, done with the shadow passes, waited about 2.5 ms of a 9 ms frame for it. At a draw, with nothing committed still on the GPU, DM_NVN_PASS_SPLIT draws (default 256, 0 off) since the last cut and a cut that will commit, the pass is ended, the segment committed, and the next draw opens the pass again with loads; at most DM_NVN_PASS_SPLIT_MAX (default 2) splits per NVN pass. The author measured BotW on an M4 Max at 120 fps: frame p50 / p90 8.75 / 9.33 -> 8.34 / 8.68 ms. Beside the pull request: the split ends a pass only when sub_cut will commit after it (sub_cut_ready, shared with sub_cut; before, DM_NVN_CUT=0 or a cut above 256 draws stored and loaded the attachments for nothing); the split's pass end always stores its attachments (the store lookahead skips the rest of the pass and could leave unstored one the reopened pass loads, with DM_NVN_TBDR=1); the resume flag that skips the dispatch-hoist scan is cleared at each target change; the readable-tile check redraw is not split. Checked on an M4 Pro: regress.py check on BotW and OCTOPATH TRAVELER II, shaders unchanged, no new RED lines, screenshots match. BotW's run-to-run noise (GPU 6-12 ms a frame on identical code, including a split-off control) is larger than the change; a second split-on run matched main (GPU 8.4 vs 8.8 ms). Graphics tests pass except t_present_rescue's 2 present-link checks, which fail on main too. Not run: iPhone, Ocarina of Time (the case of PR #2560, which this supersedes). Co-authored-by: Xipzer <60103178+Xipzer@users.noreply.github.com>
|
Landed on main as 1831312, with you as co-author. Thank you. Changes beside yours:
Checked on an M4 Pro with |
|
Checked 1831312 (DM_NVN_PASS_SPLIT, default 256) on Ocarina of Time (Switch 2), M5 Pro 24 GB, Hyrule Field, same host, 4 boots per setting, alternated: neutral. Frame p99 19.86 ms with the split vs 19.89 without, GPU p50 10.70 vs 10.61 ms. It rarely fires there: the GPU is seldom idle when a pass reaches 256 draws. No objection to the default. Thanks for taking it. |
… 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.
A long render pass is now handed to the GPU in parts while it is translated, instead of after it is fully translated.
Why. Breath of the Wild draws 2,700 of its 4,100 draws a frame into one G-buffer pass, and its main thread waits on each frame's fence before it starts the next. A render pass could only be cut at its end (
sub_cutruns atOP_SET_RT). So the GPU finished the shadow passes before the G-buffer pass and then waited about 2.5 ms for the whole pass to be translated. A Metal System Trace at 120 fps on the Mac shows the GPU busy for 6.3 ms of each 9 ms frame, in one block, with the idle time between frames.What. At a draw,
pass_split_tryends the open pass and commits the segment when:g_seg_inflight),DM_NVN_PASS_SPLITdraws (default 256,0off) were encoded since the last cut,sub_cut, plus the merge states).The pass end is
rp_end, the path every other mid-pass end (feedback splits, game barriers) takes. Its store lookahead has no index past this point, so it stores every attachment (why=6), and the next draw opens the pass again with loads. In a pass dump the loads show asload cannot be skipped, and no clear is replayed.Each split costs a store and a load of the attachments, so
DM_NVN_PASS_SPLIT_MAX(default 2,0no limit) caps the splits per NVN pass, counted by render target changes (g_setrt_n). A pass reopened by a split skips the dispatch-hoist scan (g_split_resume): the pass's first draw already scanned that stretch, and rescanning it from each split cost the submit thread more than the split saved.Measured on an M4 Max, Breath of the Wild 1.9.0 at 190% (3040x1976) with MetalFX, one spot, frames presented directly (
DM_PRESENT_LINK=0), 170 s runs, before this branch's merge with the newerDM_NVN_CUT_BUSY:DM_NVN_PASS_SPLIT_MAX8.34 ms is the 120 fps cap. Attachment traffic was within noise across the variants: 4.1-4.4 GB of loads and stores a frame in every one. With
DM_NVN_CUT_BUSYonmain,sub_cutholds a commit while a segment is in flight. A split only happens with none in flight, so the two do not fight.Graphics tests pass, except
t_nvn, which aborts with the BotW profile onmaintoo and passes withDM_PRESENT_SNAP=0.test_env_switchespasses.