Repository navigation
Pipelines a hybrid draw stands in for are listed in pso_user.tsv when first asked for (from HookLink) - #2018
oliverames wants to merge 3 commits into
Conversation
1e1e0d5 to
c7da101
Compare
c7da101 to
6cec172
Compare
… first asked for, so the next start's prepare step builds it (from HookLink) pso_user.tsv took a pipeline's row only once its build finished. While a hybrid draw drew with its shader pair's pulling pipeline, the pipeline it wanted was built in the background; on an iPhone 18 Pro Max (HookLink's measurement) that took 5-50 s with the game running, against about 1 s in the prepare step. Castle Town asked for about 400 pipelines and finished about 60 a minute, so what was unbuilt when the run ended was never listed and the next start did not build it. demand_record writes the row when the hybrid draw first asks for the pipeline, once per key. The later row from the built pipeline is the same line and pso_user_record drops it. DM_PSO_DEMAND_RECORD=0 keeps the old order. Added t_pso_demand_record, the reference entry, the switch row and the game note line. Ported from HookLink's commit 0ad4e1a (https://github.com/dsi-hub/nxnative/tree/hooklink, project https://github.com/dsi-hub/HookLink), without its archive-miss memory (b3471d5) and keyed demand table (b15d36f): main has an archive-miss memory of its own (g_pbase_miss, PR seedds#1825) and no keyed demand table, so the call goes next to main's pso_pend_demand and runs for every stand-in draw, not only when no build is pending. Co-authored-by: dsi-hub <260802842+dsi-hub@users.noreply.github.com>
6cec172 to
2e74684
Compare
|
I prepared a test-only follow-up on this exact head. Production and chain are unchanged. The previous direct-helper test passed even if hybrid lookup omitted or misplaced the record call. The new fixture enters actual Checked head This proves actual lookup placement and process-reload visibility, not a game draw, fresh-process prewarm compilation, power-loss durability or the reported iPhone performance. Flag variation does not independently test replay-thread concurrency. Apple M4 Max / macOS27.2 / Xcode27.2. All inputs synthetic. Feel free to fold these cases or the four-file commit into this PR. |
Only the game note's "Found on this game" list conflicted; both sides kept.
The earlier fixture called demand_record directly and could not detect a missing or misplaced pso_get call site. Compile synthetic Metal functions, cache real stand-ins, and suspend the production background queues while real lookups encounter both new and independently prequeued demands. An exec child checks canonical rows through warm_parse before either compile can run; completion replaces the stand-ins and preserves identical deduplicated rows. Cover recording disabled and the 65536-entry admission boundary, including eventual recording beyond that early-demand limit. With API validation, both encoder configurations pass on/off/cap cases. Removing call-site recording fails the matched control, as does limiting it to newly queued demands. Six docs tests pass and focused LLVM23 analysis adds no findings. This is test/docs only: no game assets, gameplay timing, power-loss durability or fresh-process prewarm compilation claim. Co-authored-by: Adam Kratch <70729875+akratch@users.noreply.github.com> Co-authored-by: akratch <70729875+akratch@users.noreply.github.com>
|
Thanks @akratch, these are much better tests than mine: mine passed even with the record call missing or in the wrong place. I've folded your commit into this PR (f6eac81, with you as co-author) and merged main 1992edb in. Only the game note's list conflicted. On an M2 Pro, |
|
Landed on main as 015fed3a, after integration and a clean rebase onto current main. Author credit: Yes. Oliver Ames, Adam Kratch and DSi have verified co-author trailers for the retained implementation, design/diagnosis and real lookup/reload fixture. Thank you all. Integration: Yes. Demand is recorded outside the new-admission branch, including independently pending and unadmitted builds. Main's prediction scheduling and permanent pulling-pipeline behavior are preserved; no new file format or chain change. Focused checks: Pass. Demand on/off/cap: 56/42/53 parent checks plus exec-child reload checks with Metal validation. Existing preparation checks: 123 each through MTLDevice and Metal 4; pending builds: 92; lookup waits: 9. All 12 documentation/environment-switch/test-Makefile checks pass; focused LLVM 23 has no new findings. Demand/reload, preparation and the 12 documentation checks were repeated successfully after rebasing onto 1db4bcb. Regression: Moderate, adequately checked. NieR's 1,225-shader NVN route was selected as a light host regression. Both full 220-second runs against b04c42b reached the target, with unchanged shaders and no new diagnostics, crashes or hangs. The first covered-window baseline was repeated. The raw harness retains its moving 180-second screenshot warning (17 dHash bits, RGB 7.94); inspection showed ship/effect/subtitle timing differences. Three fresh replays per revision of frame 10,800 passed the existing 2,094-pixel tolerance (baseline at most 1,295 differing pixels; candidate 963). Performance: Measured preparation increase. A controlled 400-row backlog from recorded NieR pipelines (390 additional normalized pipelines), with warm Metal cache, identical archive copies and 14 workers on M4 Pro/macOS 27.2.1, raised median preparation from 0.95 s to 1.68 s (+0.73 s) and compiled 270 extra bases. This is work moved into preparation, not compilation removed; the test did not naturally reproduce a gameplay backlog or measure an iPhone cost. Method, timings and limitations. Confidence: High. The persistence boundary and controlled preparation cost are verified; phone performance remains unknown. Binding: General host, now and at the loosest correct binding. Root cause or workaround? Root-cause fix. Actual demand is persisted before background compilation can outlive the session. From-scratch design: Yes. The existing canonical manifest and writer are sufficient. Should we just leave it? No. The verified persistence gap justifies this narrow correction. Remaining: iPhone validation only. Castle Town's natural backlog, gameplay benefit and resulting preparation increase have not been locally measured on a phone. No further code changes or author replies are required for this landing. |
What and why
pso_user.tsvlists the pipelines a device needs so the next start's prepare step builds them before the first frame. It took a pipeline's row only once the build had finished. When a hybrid draw stands in for a pipeline (it draws with its shader pair's pulling pipeline), the pipeline it wants is built in the background (pso_pend_demand). On HookLink's iPhone 18 Pro Max those builds took 5-50 s during play, with the game on two performance cores, against about 1 s in the prepare step. Castle Town asked for about 400 pipelines and finished about 60 a minute, so whatever was unbuilt when the run ended was never listed, and the next start did not build it.demand_record(dm/gfx/nvn/nvn_mtl.m) writes the row when the hybrid draw first asks for the pipeline, once per key (at most 65,536 keys remembered). The later row from the built pipeline is the same line, andpso_user_recordalready drops duplicates.DM_PSO_DEMAND_RECORD=0records a pipeline only once built, as before.Ported from HookLink's commit 0ad4e1a (engine branch: https://github.com/dsi-hub/nxnative/tree/hooklink, project: https://github.com/dsi-hub/HookLink). Their commit sits on two others that are not ported here (archive-miss memory, keyed demand table), so I adapted it: the call goes beside
main'spso_pend_demandin the hybrid branch and runs for every stand-in draw (theirs also ran when a build was already pending), without the archive-miss lines. Main has since gained an archive-miss memory of its own (g_pbase_miss, PR #1825). That doesn't change this PR: the row is written when the draw takes its stand-in, whether or not the archive search ran, andg_pbase_misslives only in the process, so it lists nothing inpso_user.tsv. Added: a test, the reference entry (docs/reference/shaders.md), the switch row and a line in the game's note.Checked
make -C dm/gfx/tests GAME=0400486024DEC000 check_t_pso_demand_recordpasses (the newt_pso_demand_record, run twice: default andDM_PSO_DEMAND_RECORD=0). It callsdemand_recordtwice for one key and checks one row, a second key gets its own row, and with the switch at0no row is written. With thepso_user_recordcall indemand_recordremoved, both default-run checks fail; restored afterwards. The test does not draw, so the call site in the hybrid path is not run by any test: that needs translated shader libraries with pulling variants.dm/tools/tests/test_env_switches.pyandtest_docs.pypass.pso_user.tsv, or how much longer the next start's prepare step takes with them. The full GPU test run (make -C dm/gfx/tests run) and a full host build were not run.Front ends
No front-end interface change.
Docs
docs/reference/shaders.md("A pipeline a hybrid draw stood in for listed only once built") and the game's note, andpython3 dm/tools/docs_symptoms.pywas rundocs/env_switches.tsvhas a row forDM_PSO_DEMAND_RECORD.