Repository navigation
nvn/pipelines: a non-compiling call waits for another thread's archive lookup of the same base, so a draw during a background lookup takes its stand-in instead of compiling its base - #2770
Conversation
…sults Memory: the combined phone builds' extra 300-500 MB is the shadow target's 288 MB pool held twice (PR seedds#2775), and on the Mac no added host change holds more (C-2's table). Frame rate: a draw that came during another thread's archive lookup compiled its base on the submit thread (PR seedds#2770), and the stuck slow state's next step is a phone A/B of the build with the new lines.
A-1 done on the Mac, phone not measured (PR seedds#2775): a memory pool's Finalize takes the serial entries naming its textures, so the old 288 MB shadow heap goes at the field load A-2 done: phone build oot-sleep-a fddbb950 B-1 done: the overnight A/B (fix2 1/8 stuck, a2 4/8, all1 3/8; verdict not established) in the game note B-2 partial: the main thread waits and host threads lines are in; the stuck state's cause is open; no phone test (the batch started after 09:00) B-3 done: oot-sleep-all 57c9267a (fix2 + 53cbb99 + C-3 + C-1 + A-1 + B-2), app built, not installed; the game note's open items; regress.py check PASS on Ocarina of Time C-1 done, phone not measured (PR seedds#2770): a non-compiling pipeline call waits for another thread's archive lookup of the same base C-2 done (measurement, no commit): on the Mac no added host change holds more memory C-3 done: phone build oot-sleep-c 5dd697c2, 53cbb99 and C-3 kept
…'s archive lookup of the same base, not only returns nil, so a draw that comes during a background lookup takes its stand-in instead of compiling its base on the submit thread pso_build_ex with compile 0 (a draw asking whether its base or its pulling base is made or archived, a prewarm task) returned nil at once when another thread held that base's job, so that it would never wait for the Metal compiler. A job's owner first only looks in the archives, which takes milliseconds, and a non-compiling owner does nothing else. A draw that came during such a lookup of its pulling base found no stand-in; its own base was already known missing, so it compiled that base on the submit thread. The prediction's background base lookups (pso_bg_look, PR seedds#2677) make the race happen every time: they look up the bases of the draws that come next in the same submission, milliseconds before those draws. On the owner's iPhone 17 play of 2026-11-14 the builds with them had single draws waiting 0.3-1.8 s on first visits ("draws that waited: pulling base not made yet" 1 / 861 ms, 2 / 1,081 ms, 8 / 1,786 ms per 300 frames, while the background lookups found every base: 21 of 21), against 1 / 95 ms on the build without them. - PbaseBuild.looked / found: the owner leaves looked once it has looked in the archives (or skipped them for a base known missing), with the base it found, before the compaction's capture and before any compile. - A compile 0 call that finds another thread's job waits on looked and takes found; when the lookup found nothing it returns nil as before, without waiting for the compile. Mac, M4, Ocarina of Time v131072, an unattended route from a Kakariko save (out to Hyrule Field and back), a first visit (no recorded pipeline list), the archive holding only the pair prebuild's pulling bases (as the phone's bundled archive), hosts on the phone tree (be8db251 + seedds#2677's commits), one run each: draws that waited 214 / 32.0 s without the fix, 216 / 29.5 s with it. On the Mac an archive lookup takes well under a millisecond, so the race's window is small there and the waits left are draws whose pulling base no archive holds; the race shows on the phone, where a lookup takes about 10 ms. Not run: the phone (no phone in this batch). Checked: t_pso_look_wait 9 checks, new (fails without the fix: the call during a 200 ms lookup returned nil at once); t_pso_pending 66, t_pso_stall 73, t_pso_archive 362, t_pso_depth_stencil 301, t_pso_prewarm 64, t_pso_warm 123, t_pso_bundle 83, t_pso_msaa 34; test_docs; lint_c.py tidy (nothing above the baseline). regress.py: not run. The only game this Mac can run it on is Ocarina of Time, which has no smoke route, so the check is its shader chain alone, which this change does not touch; the route runs above booted the game with the change. New reference entry: docs/reference/frame-rate.md, "A draw that came during another thread's archive lookup compiled its base"; symptom index updated. (cherry picked from commit 51a1de4)
…sults Memory: the combined phone builds' extra 300-500 MB is the shadow target's 288 MB pool held twice (PR seedds#2775), and on the Mac no added host change holds more (C-2's table). Frame rate: a draw that came during another thread's archive lookup compiled its base on the submit thread (PR seedds#2770), and the stuck slow state's next step is a phone A/B of the build with the new lines. (cherry picked from commit 68c2ef3)
51a1de4 to
b830eda
Compare
Prediction synchronously looked up and specialized pulling stand-ins on the submit thread, including keys that were never drawn. Move the base lookups to background workers and reuse the process-wide base/miss caches. Take only C-3 from PR #2677; submission copying, storage takeover and sampling remain separate. Give each prediction a retained budget, charged under the pending-table lock only when a guess is admitted. Reserve a slot while its draw waits so a background admission cannot replace the completed pipeline before that draw takes it. Sample admission/completion/steal counts coherently for diagnostics. The full-table fixture reproduced wrong-pipeline delivery before reservation. Checked together with PR #2770 on Apple M4 Pro, macOS 27.2.1: lookup 9, background lookup 17, pending 92, stall 110, depth/stencil 228/231/228/231; docs 6; clang-tidy LLVM 23.1.5 with no baseline increase; unsigned iOS production-project compile/link fixture with synthetic inputs. Full regress.py check: NieR Automata 010056B015FE8000, 220 seconds per side, 1,225/1,225 shaders each, no changed MSL, interface changes or new RED kinds; PASS. This light NVN title covers the shared archive path. Both runs were busy, so their timing is not a performance qualification. iPhone testing was waived by the owner on 2026-11-17; phone benefit remains unverified. Co-authored-by: Stan Bono <3304418+stan69b@users.noreply.github.com>
A non-compiling pipeline lookup returned nil when another thread owned the same base's job. A draw could therefore miss an archived pulling stand-in and compile its own base on the submit thread. Publish the archive result through a separate completion group before any compaction capture or compile. A non-compiling waiter takes that result, or returns nil on a completed archive miss, without waiting for compilation. Keep the compiling completion path unchanged. Include the reciprocal OoT finding and the optional matched phone comparison. Checked with the corrected background predictor: lookup-wait fixture 9, background lookup 17, pending 92, stall 110, depth/stencil 228/231/228/231; docs 6; clang-tidy with no baseline increase; unsigned iOS compile/link fixture; full NieR Automata regression PASS (1,225 shaders, 220 seconds per revision, no new RED or interface changes). The Mac runs were busy and do not establish a gain. The owner waived the iPhone retest on 2026-11-17; phone performance remains unverified. Co-authored-by: Stan Bono <3304418+stan69b@users.noreply.github.com>
|
Landed on The non-compiling waiter now uses a separately published archive result before any compaction capture or compile. Code and final diff were reviewed. Stan Bono is credited on both commits as Validation: lookup-wait 9, background lookup 17, pending jobs 92, stall 110, depth/stencil 228/231/228/231; documentation 6; generated symptom index current; clang-tidy LLVM 23.1.5 with no baseline increase; unsigned production iOS compile/link fixture with synthetic inputs. After the clean rebase onto 44d67fb, lookup 9, background 17, pending 92, the upstream arena fixture 42 and documentation 6 passed again, as did unsigned iOS compilation. Range-diff confirmed both patches were unchanged by rebase. The full NieR regression below used the earlier main base 60284e7 and the reviewed combined implementation. NieR was chosen as a light NVN archive title (1,225 shaders), covering the common pipeline path. Both runs were explicitly busy; screenshots at 100/180 seconds were reviewed and show the same flight sequence with formation/timing differences and no obvious new missing geometry. The shared measurement lock serialized game runs. Full regression reportregress.py check (full): PASSBaseline
NieR Automata The End of YoRHa Edition
|
…sults Memory: the combined phone builds' extra 300-500 MB is the shadow target's 288 MB pool held twice (PR seedds#2775), and on the Mac no added host change holds more (C-2's table). Frame rate: a draw that came during another thread's archive lookup compiled its base on the submit thread (PR seedds#2770), and the stuck slow state's next step is a phone A/B of the build with the new lines. (cherry picked from commit 68c2ef3)
…sults Memory: the combined phone builds' extra 300-500 MB is the shadow target's 288 MB pool held twice (PR seedds#2775), and on the Mac no added host change holds more (C-2's table). Frame rate: a draw that came during another thread's archive lookup compiled its base on the submit thread (PR seedds#2770), and the stuck slow state's next step is a phone A/B of the build with the new lines. (cherry picked from commit 68c2ef3) Rebased onto main ffb06d6, whose note now has the archive-lookup retest section (waived for landing) and the reference entry for the shadow target's pool (13c35e9): the first-visits line now reads resolved in the host with the phone benefit unverified and links that section, and the +340-380 MB line links the memory.md entry instead of repeating its Mac measurements.
What
pso_build_exwithcompile0 (a draw asking whether its base or its pulling base is made or archived, a prewarm task) returned nil at once when another thread held that base's job, so that it would never wait for the Metal compiler. A job's owner first only looks in the archives, which takes milliseconds, and a non-compiling owner does nothing else. So a draw that came during another thread's lookup of its pulling base found no stand-in. Its own base was already known missing, so it compiled that base on the submit thread.The prediction's background base lookups (
pso_bg_look, #2677) make the race happen every time: they look up the bases of the draws that come next in the same submission, milliseconds before those draws.Fix: the owner leaves a second group,
PbaseBuild.looked, once it has looked in the archives (with the base it found infound), before the compaction's capture and before any compile. A non-compiling call that finds another thread's job waits onlookedand takesfound. When the lookup found nothing it returns nil as before, without waiting for the compile. The wait is one archive lookup at most.Evidence
The owner's play of Ocarina of Time on an iPhone 17 (2026-11-14), builds with #2677's background lookups: single draws waited 0.3–1.8 s on first visits (
draws that waited: pulling base not made yet1 / 861 ms, 2 / 1,081 ms, 8 / 1,786 ms per 300 frames) while the background lookups found every base they looked for (21 of 21). The build without them: 1 / 95 ms.Mac (M4), Ocarina of Time v131072: an unattended route from a Kakariko save, out to Hyrule Field and back, as a first visit (no recorded pipeline list), with an archive holding only the pair prebuild's pulling bases (what the phone's bundled archive holds). Hosts on the phone tree (be8db251 + #2677's commits), one run each:
On the Mac the fix makes no measurable difference. An archive lookup takes well under a millisecond there, so the race's window is small; the waits left are draws whose pulling base no archive holds. The race shows on the phone, where a lookup takes about 10 ms. Not run: the phone (none was available for this change).
Checked
t_pso_look_wait, new, 9 checks: a non-compiling call during another thread's 200 ms lookup takes the base it found and compiles nothing (fails without the fix: nil at once); during a lookup that finds nothing, followed by a 2 s compile, it returns nil after the lookup; a non-compiling owner still marks a missing base.t_pso_pending66,t_pso_stall73,t_pso_archive362,t_pso_depth_stencil301,t_pso_prewarm64,t_pso_warm123,t_pso_bundle83,t_pso_msaa34; on the phone tree with OoT-30 C: base lookups of predicted keys in the background, a takeover that looks at each entry once, submissions copied without the submission lock #2677:t_pso_bg_look14,t_pso_look_wait9,t_pso_pending57.test_docs;lint_c.py tidy: nothing above the baseline (LLVM 21 on this Mac).regress.py check: not run. The only game this Mac can run it on is Ocarina of Time, which has no smoke route, so the check would be its shader chain alone, which this change does not touch (Echoes of Wisdom and Super Mario 3D All-Stars stop with ERROR on their baseline: their shader packages predate keyed records).regress.py impactnames Breath of the Wild, Pokémon Scarlet and Tears of the Kingdom (every NVN game through the pipeline archive), none of which this Mac has. The route run with the fix booted Ocarina of Time and walked the whole route with no crash; its only[RED]line is the one every run of this setup prints (c1_full.tsvstale for these Mac libraries), the same as the run without the fix.New reference entry:
docs/reference/frame-rate.md, "A draw that came during another thread's archive lookup compiled its base"; symptom index updated.