Repository navigation
Compile offline pipeline archives in optional sequential batches - #1119
Closed
itsrenoria wants to merge 1 commit into
Closed
itsrenoria wants to merge 1 commit into
itsrenoria wants to merge 1 commit into
Conversation
…mplete archive A 32,864-base Odyssey archive exhausted paging space inside Apple GPU compilation on an 8 GB M2 even after the Python memory fix. --batch-size limits each sequential compiler invocation, then metal-pack combines every successful group into the existing archive format. Keep the default and full-input archive key compatible. Cache each group independently and keep compiler or merge failures fatal. Add resume/failure tests and a synthetic Metal 4 merge check; document the complete archive validation and physical-footprint measurements.
seedds
added a commit
that referenced
this pull request
Nov 3, 2026
…n sequential groups of at most N bases and merges them with metal-pack: Super Mario Odyssey's 32,864 bases no longer exhaust an 8 GB Mac's paging space in air-nt (#1119) The default (0) keeps the single compiler invocation. Each group has a content key, so a failed run keeps the groups it finished. Co-authored-by: itsrenoria <1799282+itsrenoria@users.noreply.github.com>
Owner
|
Landed on main as 6ddeda9, with you credited as co-author. |
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…n sequential groups of at most N bases and merges them with metal-pack: Super Mario Odyssey's 32,864 bases no longer exhaust an 8 GB Mac's paging space in air-nt (seedds#1119) The default (0) keeps the single compiler invocation. Each group has a content key, so a failed run keeps the groups it finished. Co-authored-by: itsrenoria <1799282+itsrenoria@users.noreply.github.com>
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
Super Mario Odyssey 1.4.1 finishes shader translation on an 8 GB M2 but its 32,864-base offline archive exhausts paging space inside Apple's GPU compiler. The kernel killed
air-nt, reporting 33,856 MB. This happened with the Python memory fix from db8acc5 already applied.Add an optional
pso_offline.py --batch-size Npath: compile sequential groups containing at most N bases, with each script referencing only the libraries it needs, then combine every group withmetal-pack -nthreads 1. The result is the existing single<arch>.mtl4aarchive. The default,--batch-size 0, keeps the single compiler invocation.Each group has a content-based cache key covering its descriptors, library bytes, GPU, platform, OS minimum and compiler. Completed groups survive a failed run; changing one group rebuilds that group. A compile or merge failure stays fatal and cannot publish a new complete archive key or coverage stamp. The full archive retains its existing input key, so the normal Mac app packer can reuse it. The shader translation chain, host and profile inputs are unchanged.
This bounds the number of compiler inputs, not memory: one expensive pipeline or the final merge can still exceed available resources. Related to #1022, which requests archive partitioning for another workload; this PR does not claim to resolve that report.
Usage: run the standalone archive builder with its usual game/library/output/work/GPU/platform options and
--batch-size 1000, then run the normal app packer with the same work directory. See the development guide and the reference entry.Checked
python -m unittest dm.tools.tests.test_pso_offline dm.tools.tests.test_docs: 45 tests passed, including batch resume, a partial last group, changed-group invalidation, strict compile/merge failure handling, and reuse through the ordinary archive key.make -C dm/gfx/tests GAME=0100000000010000 check_t_pso_bundle: 58 checks passed on current main plus this change. The fixture builds both ordinary and one-base-per-group archives, opens the merged archive through Metal 4, retrieves a base from each group, rejects an absent depth entry and compares coverage stamps.lint_c.py compdb --game 0100000000010000andlint_c.py tidy --against origin/main dm/gfx/tests/t_pso_bundle.m: 0 file/check pairs above the baseline, 0 below. The existing baseline was unchanged.0100000000010000, update 1.4.1 / v393216. All 33 groups compiled and merged; directMTL4Archivelookups found 32,864 of 32,864 bases, with no compiler fallback. The 1,018,501,792-byte bundled archive matched the verified output, and the Mac app passed resource and signature checks.applegpu_g14g, macOS 26.6.1, Xcode 27.2 (27B52), Metal Toolchain 27B47, Metal/AIR-TT 32023.922.b2197aa0df0c. The PR is based on current main; focused unit, lint and synthetic Metal checks were repeated there.pso_offline.pyis outside the shader translation chain.The kernel kill figure and the sampled footprint are different measurements; no percentage reduction or hard memory cap is inferred. Physical/lifetime peak footprint came from
proc_pid_rusage, sampled once per second; short-lived processes can be missed. The pilot took 20.5 s; the complete batched pass reusing that first group took 507.2 s; full archive lookups took 18.2 s.scripts/regress.py impact origin/main..HEADmaps the change topresent:pipeline_prebuild. Four recorded profiles have no matching usage and 130 profiles have no manifest, so this report supplies no cross-game verification.Regression scope: the change is confined to an opt-in offline archive construction path. The focused tool suite, synthetic Metal bundle test and complete archive coverage checks exercise it directly; the shader/runtime regression harness does not exercise batch compilation. Other games, GPU architectures, OS/compiler versions and batch sizes remain unverified.
Docs
docs/reference/shaders.md, usage is indocs/development.md, and the measured workload is in Odyssey's game note.python3 dm/tools/docs_symptoms.pyregenerated the symptom index.