Repository navigation
Conversation
…FAST_WAKE, on by default) and runs the submission's CPU-side writes itself when its feedback handler has not yet The waiter used to sleep until the commit feedback handler of the fence's submission had run, which comes 0.26-0.28 ms after the GPU end on an M2 Max. It now waits on g_ev, which the queue signals after each submission, and then makes the writes of every submission up to the fence that no handler has made yet (post_early: events, samples-passed and counter reports; a ring of POST_RING records, each run once, by whichever comes first). A counter report of the fence's last segment takes the wake time as the segment's end and the later of its commit and the previous segment's end as its start (segment timestamps). Breath of the Wild writes 5 timestamp reports a frame and nothing else at the GPU end (the wait ledger now counts them): the frame-interval controller and dynamic resolution read them right after the frame's wait, which is why letting that wait lag broke the picture. Mac, Breath of the Wild, encode thread and snapshots, DM_FPS_TARGET=120, load 4.8-5.5 (not a clean measurement): the newest-fence SyncWait wakes 0.08 ms after the GPU end instead of 0.29, its blocked time 5.8 -> 5.0-5.3 ms a frame, frame time p50 9.35 -> 8.4-8.7 ms; the picture is right. t_nvn passes with and without DM_NVN_ENC_THREAD=1 DM_PRESENT_SNAP=1. t_fuse_check waits up to 2 s for its comparison, which runs in the commit feedback handler that a fast-woken SyncWait no longer waits for (a diagnostic, DM_NVN_FUSE_CHECK)
…rd is handed to the encode thread at once (rec_publish), not when its block of 256 records fills Mac, Breath of the Wild, encode thread and snapshots, DM_FPS_TARGET=120, load 4-6 (direction only): the frame's wait on its newest fence (the critical path's tail) DM_NVN_CUT=0 12.5 ms a frame (frame time p50 16-17 ms), 64 (default) 5.6 ms (p50 9.2), 16 5.35 ms (p50 8.9); 64 stays the default until the iPhone has measured smaller segments
…platform mac along a fixed route and reports frame-time percentiles A route is a line of the profile's new bench.tsv: the scripted input (DM_KEYS, seconds from the start) and the measured window, from when the scene is loaded. Each run starts from a copy of the same save and reads the host's per-frame rows (DM_NVN_TSV): frame time (start to start) and time on screen at p50 / p95 / p99 / max, frames longer than 1.5 frame times, dropped frames, GPU time p50 / p95, the game's speed against real time where the frame step logs it, and the [RED] lines. Variants (environment switches, or another host, shader libraries, rewritten modules or pipeline archive) run in turn, repeated, and are reported as medians with their range in results.md / results.json beside each run's log, frames.tsv and two screenshots at the same moments. Breath of the Wild has three routes: a save in Zora's Domain with the camera turning and Link walking (zora-pan), the same standing still, and a probe for the load time. Used for the baseline in issue seedds#159: main + seedds#76 + seedds#158 on an M2 Max at 900p and a 120 fps target, three variants, two runs each. docs/development.md ("A benchmark on the Mac") and dm/games/README.md describe it; dm/tools/tests/test_bench.py checks the window, the percentiles (nearest rank) and that every bench.tsv parses.
Integrate fast shared-event wakeups, per-segment publication, array-slice pass merging, and independent compute dispatch hoisting from the PRs. Serialize CPU completion effects before publishing completed fences and validate recycled post records. Preserve submission order for early waits. Guard scheduling against attachment aliases, first-draw and bindless reads, indirect ranges, stencil writes, and explicit barriers. Add direct Metal regression coverage and a gated CPU completion race test with TSAN. Record final BotW and Metroid Dread gameplay validation with optimizations on and off. BotW retains fewer render passes, but the measured 60 Hz M4 Pro runs do not establish a timing speedup. Keep the original higher-load and iOS performance claims explicitly unverified. Co-authored-by: v0lumehi <[email protected]>
|
Integrated into main in 6062518, co-authored with @v0lumehi. The shared-event wake and immediate segment publication are retained. The review confirmed a CPU completion race: claiming a post record did not mean its event/report writes had finished, so another waiter could publish completion too early. The fix serializes those effects, completes earlier submissions in order, and validates the fence generation when a delayed callback encounters a recycled ring slot. Fence/completion counters are atomic. Validation includes a gated competing-waiter/recycled-slot regression (8 CPU checks, also passing under ThreadSanitizer), 37 production-path Metal ordering checks in direct encoding, deferred encoding, and all optimizations disabled, plus the full graphics suite. After integration with current main, the archive tests (52 bundle / 57 archive checks), profiler tests (28 checks), documentation checks, both Mac hosts, and all 133 iOS source compiles pass. Optional shader-fixture checks without local fixtures were skipped. Gameplay coverage includes BotW outdoors and Metroid Dread's playable cave room, with optimizations on and off. Fourteen benchmark runs of the fixed implementation, before rebasing onto current main, completed without a red line or crash. The repeated M4 Pro / 60 Hz tests do not establish a timing speedup; blocking SyncWaits were rare. They do not reproduce the original M2 Max / 120 fps workload or validate iPhone runtime performance. Four further on/off execution checks after integrating current main reached frame 5,000 in BotW and 4,400 in Dread, all without errors. Display-link stalls and incomplete screenshots exclude those extra checks from the gameplay/timing evidence. Full measurements and limitations are recorded in the BotW note and Dread note. Closing because the changes and review fixes are now incorporated into main. |
Integrate fast shared-event wakeups, per-segment publication, array-slice pass merging, and independent compute dispatch hoisting from the PRs. Serialize CPU completion effects before publishing completed fences and validate recycled post records. Preserve submission order for early waits. Guard scheduling against attachment aliases, first-draw and bindless reads, indirect ranges, stencil writes, and explicit barriers. Add direct Metal regression coverage and a gated CPU completion race test with TSAN. Record final BotW and Metroid Dread gameplay validation with optimizations on and off. BotW retains fewer render passes, but the measured 60 Hz M4 Pro runs do not establish a timing speedup. Keep the original higher-load and iOS performance claims explicitly unverified. Co-authored-by: v0lumehi <[email protected]>
…ings (equivalents of Docked and Handheld preset)' (seedds#158) from iH8Ecchi/BananaNative:fefw-pr-res into android Reviewed-on: https://git.eden-emu.dev/moceure/BananaNative/pulls/158
…, seedds#164, seedds#165, seedds#109, seedds#166-seedds#168) Conflicts: the launcher profile columns 18 (fps_steps) and 19 (mesh_vegetation_cut) are taken, so variants move to column 20; GAME_SETTINGS keeps hold60, full_vegetation and aspect; docs/agents/game-patches.md regenerated. moceure#39 (whose old commit 0749171 could not be fetched from the server) touches no file of this PR but env_switches.tsv, which merges cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
Breath of the Wild blocks in one SyncWait per frame, on the fence of its newest submission. With #157's wait ledger (
DM_NVN_WAITS=1) on an M2 Max, that wait woke 0.29 ms after the GPU had finished, because the waiter slept until the commit feedback handler of the fence's submission had run, and the handler comes 0.26–0.28 ms after the GPU end. That time sits on the critical path of every frame.With the encode thread on, a segmented submission's segments (
DM_NVN_CUT) reached the encode thread only when their block of 256 records filled, so the GPU started the frame's first segments later than the submit thread had finished them.Change
DM_NVN_FAST_WAKE, on by default;=0turns it off). The game's SyncWait (newest fence, older fence, acquire sync) now waits ong_ev, the event the queue signals after each submission, instead of on the feedback handler.post_early): events, samples-passed reports and counter reports.POST_RINGrecords. Each record runs once, by whichever comes first, the handler or the waiter (post_claim,post_run).rec_publishinsub_cut), not when its block of records fills.Measurements
DM_FPS_TARGET=120, load 4.8–5.5, so not a clean measurement):<key>_bp) #123–Pipeline prebuild, with the pairs of agl's BAHS programs (pso_pairs.tsv) #125 and Mac: present snapshots (DM_PRESENT_SNAP=1): a game with two swapchain textures runs a frame ahead, and the frame step judges lateness by the screen #87, encode thread and snapshots, the default frame step, 2 minutes from a fresh pipeline archive): the newest-fence SyncWait wakes 0.054 ms after the GPU end, and the feedback handler comes at 0.153 ms.DM_NVN_CUT=0(frame time p50 16–17 ms), 5.6 ms with the default of 64 (p50 9.2 ms), and 5.35 ms with 16 (p50 8.9 ms). 64 stays the default until smaller segments are measured on the iPhone.Reproduce
DM_NVN_WAITS=1: the[waits]line every 300 frames givesnewest-fence SyncWait wakes … ms after the GPU end (feedback handler at … ms)and the CPU-side writes at the GPU end per frame.DM_NVN_FAST_WAKE=0for the comparison. The log says at the first wait whether SyncWaits wake on the GPU's signal.DM_NVN_CUT=<n>for the segment size.Risk
post ring: the writes of fence N never ran), so a lost write cannot pass silently.Tested
On this branch:
t_fs_case, which fails the same way on main on a case-sensitive volume;t_nvnincluded, passes as is. WithDM_NVN_ENC_THREAD=1 DM_PRESENT_SNAP=1it passes except the fivet_rt_rangeruns, which abort the same way on main (the encode thread has no stand-in for a texture → buffer copy);t_fuse_checknow waits up to 2 s for its comparison. The comparison runs in the commit feedback handler, which a fast-woken SyncWait no longer waits for; it is a diagnostic (DM_NVN_FUSE_CHECK), and nothing else the game reads is made there;DM_NVN_ENC_THREAD=1 DM_PRESENT_SNAP=1 DM_NVN_WAITS=1, a fresh pipeline archive): a correct picture (DM_NVN_SHOT), no red line, no fatal error, on screen p99 16.67 ms with no frame dropped. The only Breath of the Wild shader library on this Mac is built for the chain of Pulling vertex shader variants in the translation chain (<key>_bp) #123 (97e2f301eb73), so this run used these commits on top of Pulling vertex shader variants in the translation chain (<key>_bp) #123–Pipeline prebuild, with the pairs of agl's BAHS programs (pso_pairs.tsv) #125 and Mac: present snapshots (DM_PRESENT_SNAP=1): a game with two swapchain textures runs a frame ahead, and the frame step judges lateness by the screen #87; the host code of these commits is the same.Not tested on this branch: the iPhone (the numbers above are from the previous base), other games, and
DM_NVN_FAST_WAKE=0in play.