Repository navigation
Reuse pipeline archives across shader-chain updates on macOS and iOS - #895
Closed
thehobbit85 wants to merge 1 commit into
Closed
thehobbit85 wants to merge 1 commit into
thehobbit85 wants to merge 1 commit into
Conversation
3 tasks done
seedds
added a commit
that referenced
this pull request
Nov 2, 2026
…unchanged (#895) The offline archive's key held the chain label, the profile stamp, the builder's source and the libraries' absolute paths, so a chain update recompiled an archive from the same inputs. The key is now what metal-tt compiles from: the pipeline script without library locations, the referenced libraries' names and bytes, the architecture, the platform, the minimum OS and metal-tt's version. The reflection is still checked against the current chain first, and prebuilt.tsv and the other metadata are written on every run. Measured on Pokemon Legends: Z-A after a comment-only chain edit: 462.78 s with the old key, 10.10 s with the new one. An update that changes a library in the archive still rebuilds it. Existing keys rebuild once. Co-authored-by: Eliran Zach <[email protected]>
Owner
|
Landed on main as 80eb5a3, with you as co-author. Thanks: the fix to the key is the right one and your code is in nearly as it was. Changes on the way in:
I didn't re-run a real archive for this one, and no game has booted on a reused archive yet. |
This was referenced Nov 4, 2026
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…unchanged (seedds#895) The offline archive's key held the chain label, the profile stamp, the builder's source and the libraries' absolute paths, so a chain update recompiled an archive from the same inputs. The key is now what metal-tt compiles from: the pipeline script without library locations, the referenced libraries' names and bytes, the architecture, the platform, the minimum OS and metal-tt's version. The reflection is still checked against the current chain first, and prebuilt.tsv and the other metadata are written on every run. Measured on Pokemon Legends: Z-A after a comment-only chain edit: 462.78 s with the old key, 10.10 s with the new one. An update that changes a library in the archive still rebuilds it. Existing keys rebuild once. Co-authored-by: Eliran Zach <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Rebuilding an unchanged NSP after a shader-chain update can spend several minutes recompiling the offline pipeline archive even when its shader libraries and pipeline settings are identical. The old cache key included the chain label, profile stamp, whole builder source, and absolute library paths.
Key the shared macOS/iOS archive builder by its compiler inputs: the complete generated pipeline configuration with library paths normalized to stable labels, referenced library names and bytes, GPU architecture, target platform, minimum OS, and Metal translator version. Reflection-chain validation still runs before reuse; runtime stamps and remainder lists refresh on a hit. Changed compiler inputs and missing archives still rebuild. Existing keys require one warm-up rebuild.
The PR contains only archive reuse, tests, and documentation. It preserves upstream's disk-space checks and temporary-file cleanup. See the mechanism and LegendsZA measurements.
Benchmark
Pokémon Legends: Z-A 2.0.2 (v393216), title ID
0100F43008C44000; Apple M2 Max, macOS 26.6, Xcode 27.0 / AIR-TT 32023.921, native arm64 Python. Measured on8dfa9c6d8b0eplus this cache change, before rebasing the PR onto upstreammain.The controlled update was a temporary comment in a chain tool, changing chain
a7dbbce711c3to5b1637c7f097while leaving shader output unchanged. Both archive commands consumed the same 26,029 bases and referenced library bytes. The legacy key changed; the content key did not. The cached 1,217 MB archive retained its SHA-256 and modification time. The temporary source edit and chain header were restored.Warm-up is excluded. The legacy comparison was primed with the verified warm archive and the exact old-format key, and a real legacy invocation confirmed a hit before the update. After the update, the legacy builder actually recompiled its archive. The full app run spent 4m59s extracting shaders, 5m10s preparing shaders (all 28,603 restored from cache), 16s in the archive stage, and 2m02s packaging/signing. These are stage measurements and one complete new-builder run, not a paired total-build speedup or a promise of these savings when shader output changes.
The build used
--platform mac-app --allow-other-metalbecause the installed Xcode 27.0 differs from the locked 27.2. Commands, hashes, logs, and results remain beside the local game under<build>/performance-research/pipeline-archive-reuse/.Checked
b4880a9d83bf: all 116 Python test files indm/tools/tests,dm/ios/tests, anddm/gfx/testspassed (1,063 tests, 13 skipped), using native arm64 Python, CI'sDM_GAME/translator settings, and access to the Metal tools.lint_python.py --against origin/main: 391 baseline findings, zero new or stale findings.make -C dm/gfx/tests GAME=0100F43008C44000 check_t_pso_bundle: 52 checks, zero failures.git diff --checkpassed.--platform ios --gpu g18p. Cold archive creation took 4.445 s; reuse after a chain-folder/reflection move took 0.234 s, preserving inode/mtime and refreshing the runtime stamp. This is host-side iOS archive validation. No LegendsZA IPA or device run was timed; no iOS signing or installation occurred. LegendsZA's current profile does not enablepso_mtl4, so its default iOS build does not request this archive stage and receives no default IPA speedup from this change.smoke.tsv, so the harness did not run gameplay. Other games and the complete graphics test suite remain unchecked. This regression and the benchmark were recorded before the publication rebase; publication checks above validate the rebased code separately.regress.py impact origin/main..HEADmaps the change topresent:pipeline_prebuildfor Mac/iPhone offline archives. Its manifests report no affected known game and 120 unknown profiles; that is incomplete coverage, not evidence that other games are unaffected.Recorded regress.py check report
regress.py check (full): PASS
Baseline
8dfa9c6d8b0e20f5a9563d7034773eda5755ca498dfa9c6d8b0e, candidateworktree8dfa9c6d8b0e (+ uncommitted changes); Apple M2 Max, macOS 26.6, Xcode 27.0; 485 s0100F43008C44000LegendsZA
0100F43008C44000: PASSDocs
Current published head
b4880a9d83bfc17379af8dd3c9e00c7ab87ff2c0has all 7 applicable CI checks successful, including every applicable workflow and job. Verified on 2026-11-01 against exact head/run/job provenance and recorded maincd859c38a8f8890ddbb57a23d6f45e23ba9e6651. Historical results and local limitations above remain separate. Workflows: lint-python, tests.