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, |
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.