Repository navigation
Timer flushes wait during any prewarm, so the start after a cold start does not compact (Ocarina of Time 762 s → 3.3 s) - #1879
bettterlabs wants to merge 3 commits into
Conversation
…riod, not a file per 10 s timer flush, and the prepare line counts the bases a compaction captures again: on Ocarina of Time a cold start left 80 run files, so the next start compacted them all, 762 s before the first frame with 0 compiled in the log; now the cold start leaves 5 files and the next start takes 3.3 s (GitHub issue seedds#1747) The timer's flush (10 s after a burst of new bases) ran during a prewarm that does not compact, so a cold start wrote a file every 10 s (80 files here; seedds#1747's left 43). More than PSO_ARCH_COMPACT run files make the next start a compaction, whose prewarm captures every base it takes from them again from the original functions (the seedds#342 workaround), a full compile each, and a capture counted neither as compiled nor apart from the lookups. Now arch_flush_from holds the timer's flushes for any prewarm, as it did for a compacting one, so a prewarm writes a file per ARCH_PERIOD_MAX; full periods and failed captures are still handed over at once. The prepare line says how many bases were captured again, the bases line their time. A cold start that ends in its prewarm now leaves about a period of captures unwritten, built again at the next start, where it left up to 10 s of them. t_pso_archive (135 -> 145 checks): nine new bases in a prewarm with a timer flush after each make 3 files with a period of 4; a compaction counts its recaptures and their time. test_pso_archive.py, fresh processes: that cold start then a next start that compacts and builds nothing; a cold start ended after 6 bases, then a next start that takes the 4 written and builds the other 5. On bd979ce with eed7c42 (this Mac's library chain), copies of the device archive's prebuilt files with a 30,838-line list: before, a cold start wrote 80 files and the next took 761.61 s; with the change 5 files and 3.30 s. Reference entry, game note, development.md, symptom index.
…y on a compacting start: a start that does not compact no longer prints "0 of them captured again for the compaction"
# Conflicts: # dm/gfx/nvn/nvn_mtl.m # dm/gfx/tests/t_pso_archive.m
…ile per 10 s timer flush, and what the archive holds unwritten is written at quit and starts writing on going to the background: on Ocarina of Time a cold start left 80 run files, so the next start compacted them all, 762 s before the first frame with 0 compiled in the log; now the cold start leaves 5 files and the next start takes 3.3 s (PR #1879, issue #1747) The timer's flush (10 s after a burst of new bases) ran during a prewarm that does not compact, so a cold start wrote a file every 10 s (80 files on Ocarina of Time; #1747's left 43). More than PSO_ARCH_COMPACT run files make the next start a compaction, whose prewarm captures every base it takes from them again from the original functions (the #342 workaround), a full compile each, and a capture counted neither as compiled nor apart from the lookups. Now arch_flush_from holds the timer's flushes for any prewarm, as it did for a compacting one, so a prewarm writes a file per ARCH_PERIOD_MAX; full periods and failed captures are still handed over at once. The prepare line and the bases line count the bases a compaction captured again, and their time. Holding the timer meant a quit during a cold start's prewarm lost the period under way, up to 2,000 bases, minutes of compiling. mtl_arch_save hands the current period over prewarm or not: from atexit (⌘Q, closing the window, exit()), waiting up to 10 s for the period's compiles and the writes (a file of 900 bases took 1.8-4 s); from the graceful exit (dm_gfx_quit) within its 1.5 s; and from dm_gfx_suspend (iOS background, Mac minimize) without waiting. A write the exit cuts short leaves no compacting marker that would turn compaction off on that system build: arch_mark removes this run's marker at exit and writes none after, and keeps one a crashed run left. Checked: t_pso_archive 172 checks; test_pso_archive.py, fresh processes: a cold start with a timer flush after each base makes 3 files and the next start compacts and builds nothing; one killed after 6 bases leaves the full period alone (next start takes 4, builds 5); one that quits there writes the other 2 too (next start takes 6, builds 3) and keeps an earlier run's marker. The Metal graphics tests, host tests, Mac host build and lint-c pass. In the game (PR #1879, M4, main bd979ce + eed7c42, 30,838-line list): before, 80 files and a next start of 761.61 s; after, 5 files and 3.30 s. regress.py not run: the local builds' shader packages predate keyed records (f7a5452) and need splitting again. Co-authored-by: bettterlabs <279109819+bettterlabs@users.noreply.github.com>
|
Landed as 4a81561, with you credited as co-author. Thanks for the clear diagnosis and the measurements. Your change went in as it was: a prewarm's timer flushes wait for a full period, and the compaction counter. The code comment now says 80 files, as your docs do. On top of it, what the archive holds unwritten is now written when the player quits (atexit for ⌘Q, closing the window and exit(), waiting up to 10 s; the graceful exit within its 1.5 s). It also starts writing when the app goes to the background or the window is minimized. So a quit during a cold start's prewarm no longer loses up to a period (2,000 bases). A write the exit cuts short leaves no #1747 stays open: the files written during play are #1880's part, and the reporter's retest is still to come. |
…ile per 10 s timer flush, and what the archive holds unwritten is written at quit and starts writing on going to the background: on Ocarina of Time a cold start left 80 run files, so the next start compacted them all, 762 s before the first frame with 0 compiled in the log; now the cold start leaves 5 files and the next start takes 3.3 s (PR seedds#1879, issue seedds#1747) The timer's flush (10 s after a burst of new bases) ran during a prewarm that does not compact, so a cold start wrote a file every 10 s (80 files on Ocarina of Time; seedds#1747's left 43). More than PSO_ARCH_COMPACT run files make the next start a compaction, whose prewarm captures every base it takes from them again from the original functions (the seedds#342 workaround), a full compile each, and a capture counted neither as compiled nor apart from the lookups. Now arch_flush_from holds the timer's flushes for any prewarm, as it did for a compacting one, so a prewarm writes a file per ARCH_PERIOD_MAX; full periods and failed captures are still handed over at once. The prepare line and the bases line count the bases a compaction captured again, and their time. Holding the timer meant a quit during a cold start's prewarm lost the period under way, up to 2,000 bases, minutes of compiling. mtl_arch_save hands the current period over prewarm or not: from atexit (⌘Q, closing the window, exit()), waiting up to 10 s for the period's compiles and the writes (a file of 900 bases took 1.8-4 s); from the graceful exit (dm_gfx_quit) within its 1.5 s; and from dm_gfx_suspend (iOS background, Mac minimize) without waiting. A write the exit cuts short leaves no compacting marker that would turn compaction off on that system build: arch_mark removes this run's marker at exit and writes none after, and keeps one a crashed run left. Checked: t_pso_archive 172 checks; test_pso_archive.py, fresh processes: a cold start with a timer flush after each base makes 3 files and the next start compacts and builds nothing; one killed after 6 bases leaves the full period alone (next start takes 4, builds 5); one that quits there writes the other 2 too (next start takes 6, builds 3) and keeps an earlier run's marker. The Metal graphics tests, host tests, Mac host build and lint-c pass. In the game (PR seedds#1879, M4, main 618d2bd + 7fe4c2d, 30,838-line list): before, 80 files and a next start of 761.61 s; after, 5 files and 3.30 s. regress.py not run: the local builds' shader packages predate keyed records (b8b5732) and need splitting again. Co-authored-by: bettterlabs <279109819+bettterlabs@users.noreply.github.com>
…ion by size tier and archive indexes, seedds#1844 merged, 3D texture mirrors, native mesh pipelines in the archive, follower-scan groups) Hand-resolved: main's compaction and mesh-pipeline archive replace the tail-compaction marker and the mesh-parts draw we carried; the copy mirrors keep our `mir` flag for pkg_copy_absorb; patch_nso.py keeps fixed_resolution beside main's fs_address; the translator keeps the seedds#1585 site argument. Translator rebuilt: chain 1268cc9dae8a. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014eD437mxrMnW2UwLZhpwc7 Upstream pull requests applied in this commit (their authors' work, brought onto this tree with a three-way merge; the description is in each PR): - seedds#1585 by nafields (open): Raw global memory through a pointer read when the draw is bound: the host fills each fixed-offset pointer's pool range before the draw (chain 1ffcb6b77740) - seedds#1844 by nawangwe (closed): Shader libraries compile with -fwrapv: Ocarina of Time's mesh-shader models no longer take their ambient light from the wrong probe texels - seedds#1879 by bettterlabs (closed): Timer flushes wait during any prewarm, so the start after a cold start does not compact (Ocarina of Time 762 s → 3.3 s) - seedds#1880 by bettterlabs (closed): Pipeline archive compaction by size tier, so the start after play recaptures what play added, not the whole archive (Ocarina of Time 713 s → 24 s)
What and why
The start after a cold start spends minutes in the prepare step, and the log says no base was compiled: here 761.61 s on an M4, the same pattern as #1747 (309 s, 0 compiled).
Cause. The timer's flush (10 s after a burst of new bases) runs during a prewarm that doesn't compact, so a cold start writes a run file every 10 s: 80 files here. More than
PSO_ARCH_COMPACTrun files make the next start a compaction. Its prewarm captures every base it takes from those files again from the original shader functions (the #342 workaround), a full compile each. A capture counts neither as compiled nor apart from the lookups, so the prepare line reads 0 compiled.Change:
arch_flush_fromholds the timer's flushes for any prewarm, as it already did for a compacting one. A prewarm then writes a file perARCH_PERIOD_MAX. Full periods and failed captures are still handed over at once.pipeline bases so faralso their time.Trade-offs:
One of two independent PRs; the other, #1880, compaction by size tier, deals with the files play adds afterwards.
Checked
Tests (M4, macOS 27.2, on 270b6fd):
t_pso_archive: 172 checks (162 on main).test_pso_archive.py: 3 tests (1 on main).Game run: Ocarina of Time
0400486024DEC000(v131072). The host was main bd979ce + eed7c42, with and without this change; this Mac's shader library is that chain, and the archive code there is the same as main's. Each start used a copy of the device archive's prebuilt files with a 30,838-line prewarm list, stopped at the title, one run each with nothing else running:Device: Mac mini M4, 16 GB, macOS 27.2.
Not checked: a build of current main in a game; iOS; lint-c;
regress.py check(other games named byimpact: Breath of the Wild, Pokémon Scarlet, Tears of the Kingdom).Docs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index)