Skip to content

chain/build: bound first-build preparation and shader scheduling - #896

Closed
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/first-build-performance
Closed

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/first-build-performance

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

First builds overlap discovery and bound rewrite, shader and archive preparation. Main still lacks the dependency-ready shared-budget scheduler and bounded preparation mechanisms, so this PR remains relevant. RomFS extraction stays serial; the independent review's large-image slowdown remains unresolved and parallel extraction stays withdrawn. Both raw and wrapped integrity failures retain strict/allow-damaged behavior.

Rebased 69d3c993c3b759b65db0ed2240c90a30fe05d812 onto de2018e0100e75e782464a830250800bdfebb219, producing d56bd72022934f2b33bacc5e321dff77fdfef3d8. Only the generated shader-chain header conflicted; it was regenerated from the combined sources as 302f165cf901. Main's cache-full staging rollback, forked worker/parent SQLite service, tessellation capture, bit0-mask/per-vertex/native float-add rewrites, current archive readers and content-based PSO keys remain. Core builder functions (including commit, fin/fin_worker, job_for, finish and geometry_finish) match main exactly. The current area/component subject replaces the old subject; all substantive original commit-body/context is preserved below.

Fresh exact-tree checks: 368 tests ran, 367 passed and one tessellation GPU test skipped (requires DM_TEST_TESS/t_tess). Native Python 3.14.6, Xcode 27.2 (27B52), supported Metal 32023.922.4, J=2, current locked native translator, DMSH_TEST_METAL=1. The selected suite covers scheduling/discovery, current shader rewrites with supported compiler controls, cache-full/staged publication, code/chain fingerprints, archive specialization/isolation, rewrite analysis/budgets, incremental packing, IPA compression, regression/impact tooling, environment/usage catalogues and docs. No assertions, baselines or toolchain locks were relaxed.

Actual builder CLI: four authored keyed compute shaders in each of J1 threads, J2 threads, J2 processes and warm J2 process cache. All 16 shader builds succeed, with byte-identical MSL/reflection/metallib payloads across configurations. This is a synthetic scheduling/cache check, not a performance or game-equivalence claim. Pinned Ruff/Pyright lint passed 321/321, zero new/stale. Generated header/symptoms, full main/range diff, test-tree identity, ancestry and whitespace checks passed.

The serial extractor source, native executable, synthetic extraction test and its fixture are byte-identical to the prior published head; the executable still embeds source cee30e1549db7083. The prior raw/wrapped C# extraction evidence remains historical. No production extractor or game extraction was rebuilt on this pass.

Impact remains broad across rewriting/packing/NVN chains. Intended game controls are BotW/TotK (driver constants and large profiles), Scarlet (driver reads), Hades (Vulkan targets) and Balatro (OpenGL targets). No current real-game regression, full native graphics/host campaign, gameplay, device test or first-build benchmark was run for this candidate. Those titles and game-sized peak disk/performance remain unchecked. Historical six-game results used the named older revisions and unsupported .620, as preserved below; they are not current supported-toolchain game evidence. No CI status is inferred from local checks.

Earlier published description and validation (historical)

First builds overlap discovery and bound rewrite, shader and archive preparation. RomFS extraction remains serial; both raw and wrapped integrity failures retain strict and allow-damaged behavior.

Current integration: 693ef171770a08087577adb6fa117a7122b9c1aa rebased onto 90b7cefd1d572ab05859c73930b436c4040cd25c, producing 69d3c993c3b759b65db0ed2240c90a30fe05d812. Main's forked finishing workers, parent SQLite service, pre-fork PCH creation, current shader-image stamps, tessellation transformations and all new archive readers remain present. Translation and finishing share J active slots: process-backed finishing holds its slot until output publication, then only its dependent vertices become ready. Worker counters/results are collected in key order. The Mac/iOS target helper uses main's current deployment and math flags. Offline preparation retains main's function-constant specialization, compute groups, failing-pipeline isolation and content-based archive keys.

The changed extractor source also requires a refreshed universal NativeAOT executable. Both arm64 and x86_64 report source cee30e1549db7083; SHA256 38ca9e51872ee901616d676f3fcac139b8279299469aa2822dfb8b2b8dbe39c8. No translator binary or compiler lock was changed.

Fresh final-head verification on 69d3c993c3b759b65db0ed2240c90a30fe05d812: 121 tests passed for overlapping discovery/scheduling, main's new base/DLC duplicate-shader merge semantics, incremental input/profile invalidation, SARC names, generated chain and docs. Main's new merge_keys function is retained exactly; base-game row attribution, pair union and the unequal-code duplicate error all remain. The production builder/scheduler, PSO preparation, rewriter, extractor, supported toolchain and generated chain are byte-identical to the broader tested integration below; only main's new discovery merge and incremental fixture paths require these additional checks. Final pinned lint321/321, zero new/stale; final range/main diff, ancestry and whitespace checks pass. An initial exact-head command omitted required DM_GAME and stopped before tests; the recorded successful run explicitly sets it.

On tested integration 2bf7017b23117d80f287899c7ef7832af98152ea against main 48dca7a4ad146afc05a01cbd200387d8854ebea7, 353 tests ran, 352 passed and one GPU tessellation test skipped. The 337-test suite covers bounded scheduling, overlapping discovery and new archive-reader ordering, source-driven streamed output/worker callbacks, PSO specialization/isolation and compute groups, cache fingerprints, serial LibHac synthetic-image extraction, function analysis/budgets, Mac/IPA packing, chain, regression harness and docs. Another 16 code-fingerprint, usage and environment checks passed. Native Python 3.14.6, Xcode27.2(27B52), supported Metal32023.922.4. The skipped tessellation GPU case requires t_tess; its two source/layout tests passed. No GPU tessellation claim follows.

The actual builder CLI translated four authored keyed compute shaders in each of J1 threads, J2 threads, J2 process workers and warm J2 process cache. All16 shader builds succeeded; their MSL, reflection and metallib payload bytes were identical. Current combined chain: a9482a3165eb. The universal extractor built successfully for both Mac architectures. Its fixture verifies normal multi-block and empty images, raw/wrapped strict failure preserving the old image, allow-damaged output and non-integrity read failures. No assertion, suppression, baseline or toolchain lock was relaxed.

Pinned lint passed: 321 baseline findings, zero new/stale. Generated header/symptoms, exact-range impact, range-diff, full remaining diff, ancestry and whitespace checks passed. Source review proves main's fin/fin_worker, job_for/finish (including tessellation), all rewrite/reflection/entry/tess helpers and translator/lock unchanged. A prior 350-test run on 2a4645c66a1dde6f28b786f5749416ee3d389bd1 passed, including supported Mac/iOS PCH/compiler checks; those PCH test/recipe/compiler inputs are byte-identical to final. Earlier integration fixture/import/type issues were corrected before this result; an initial private synthetic setup lacked two required empty/folder inputs, corrected without production workarounds.

Impact: this tool path reaches NVN shader builds and rewriting broadly; BotW/TotK exercise driver constants and large profiles, Scarlet driver reads, Hades Vulkan selection and Balatro OpenGL selection. The fresh checks use generated inputs only. Real-game shader comparisons, complete host/GPU coverage, gameplay, measured first-build improvements and game-sized peak disk remain unavailable for this integration. Earlier large-image extraction and hardware limitations remain open. No game extraction/cache rebuild, signing, installation or benchmark was performed. Remote CI belongs to its separate cycle; local tests do not establish a fresh CI pass.

Historical validation and review resolutions

First builds overlap discovery and bound shader, rewrite and archive work. RomFS extraction stays serial after the reported large-image slowdown. Raw and wrapped integrity failures retain strict and allow-damaged handling.

Current rebase

693ef171770a08087577adb6fa117a7122b9c1aa rebases dc3751f0cde5f28813c0dde4524811724c486ce9 onto main bbea4c90f136f478e25228bc3d4ab33c77420f2e with the original feature commit and message. The scheduler keeps main's HMMA imports and keyed package lookup. The overlapping scan uses main's escaped boot-NRO paths. Bounded PSO readers use layer_out from reflection, with exact main pair-selection logic and content-based archive keys. Combined chain 0eb19efddc62.

  • 236 focused tests ran, 230 passed, six inherited errors, zero skips. Native Python 3.14.6, Xcode 27.2 (27B52), pinned Mac/iOS Metal .922.4. Ran python3 -B -m unittest -v with DM_GAME=010015100B514000, J=2, DOTNET_ROOT=/usr/local/share/dotnet and DMSH_TEST_XLATE set to the bundled apphost:
dm.gfx.tests.test_{dmsh_schedule,shader_discovery,dmsh_hmma,dmsh_meshstage}
dm.tools.tests.test_{shader_package_keys,shader_toolchain_cache,nsp_chain,pso_offline,extract_image,regress,docs}

The six IntegerPassThrough errors reproduce with pinned main's function source and unchanged fixture. The fixture omits dmsh_fetch from its extracted globals. Providing the real dependency in an isolated diagnostic passed all six. No fixture repair is included.

  • Five additional layer-reflection tests passed (dm.tools.tests.test_dmsh_layer_out). Actual keyed synthetic builds used 12 authored shaders at J=1, J=2 and warm J=2 on Mac and iOS. All 72 target libraries were present and payloads matched. Tool lock, generated docs and diff checks passed.
  • Pinned lint: 339 / 336 baseline, three excess HMMA findings and zero stale. Diagnostics match isolated main 5e1c1aec, whose Python/lint inputs are unchanged on this pin.

Static impact shows three direct matches, one broad and 149 profiles without manifests. BotW and TotK cover NVN constants, Scarlet driver reads, Hades Vulkan and Balatro OpenGL. Current real-game comparisons, full native graphics validation and new performance measurements remain outstanding.

Earlier dc3751f0 on 413e8808 passed 424 tests and 72-library synthetic equality, with inherited lint 339/336. 136e8613 on 62f6a52c preserved both Unity and rewrite scheduling fingerprints, passed 211 tests and matched inherited lint 376/371. Both suites had zero skips.

Earlier rebase and validation on 9e3fa000 — 2026-11-08

Candidate 9e3fa000cf553f46ed3bbe66151d59d759e601d7 rebases f5d2098a50d6c6bdeb31884b06336627a005d23e onto main 555122a9069235441d5a88955105397ec6d53686 with its original feature commit and message. The one conflict was the generated shader-chain header, now d8b8c0fa644e. Review found the same 41 feature paths, unchanged feature patch lines outside that header, and all 83 upstream-only paths preserved. Main's per-component pixel output map, handle-table read changes, function-matched frame-step stubs, and updated Unreal fixed-rate matching are included. Its 2,000-capture flush policy and plain-compiler fallback are byte-identical to main. Render input preparation still uses --input-jobs, and main's --jobs still controls compute archive workers. The archive key covers canonical configuration and referenced library bytes.

Historical validation and limits

Native arm64 Python 3.14.6, macOS 26.6, Xcode 27.2 (27B52) and pinned Metal 32023.922.4 for Mac and iOS.

  • 254 focused tests passed, zero skips, including dependency scheduling, archive discovery, shader pool and cache behavior, supported Mac/iOS compiler equivalence, offline PSO preparation, ordered NSO analysis and current frame-step matching, serial LibHac integrity handling, and docs. The generated symptom index, tool lock, and git diff --check passed.
  • Native Metal passed with 135 archive checks, 43 stall and fallback checks, and one archive restart and compaction test. These use synthetic pipelines.
  • The actual shader builder compiled 12 authored compute shaders at J=1, J=2, and warm J=2 on both targets. All 36 shader builds completed, the 72 target libraries were present, packaged payload bytes matched across all three runs, and progress and scratch files cleared.
  • Pinned Python lint remains failing with 376 findings against 371 baseline entries, five excess findings in test_patches.py and no stale entries. An isolated exact-main run reproduced the same diagnostic text and totals. The fixture and its load_patches code match main. This PR leaves the fixture and lint baseline intact.

The exact-range impact report identifies three direct matches, one broad match and 149 profiles without usage manifests. The game comparison targets are Breath of the Wild and Tears of the Kingdom for NVN and driver-constant paths, Pokémon Scarlet for driver reads, Hades for Vulkan, and Balatro for OpenGL. Real-game shader comparisons, full graphics coverage, gameplay, and fresh first-build measurements remain outstanding for this chain. The earlier 785-test run belongs to f5d2098a50d6c6bdeb31884b06336627a005d23e. The large-image extraction slowdown remains unresolved. RePOP gameplay remained stopped.

Historical context: Validation commands for 9e3fa000

DM_GAME=010015100B514000 DOTNET_ROOT=/usr/local/share/dotnet J=2 \
PYTHONDONTWRITEBYTECODE=1 python3 -B -m unittest -v \
  dm.gfx.tests.test_dmsh_schedule \
  dm.gfx.tests.test_shader_discovery \
  dm.tools.tests.test_dmsh_pool_arrays \
  dm.tools.tests.test_shader_rewrites \
  dm.tools.tests.test_dmsh_code_fp \
  dm.tools.tests.test_shader_toolchain_cache \
  dm.tools.tests.test_shader_pch \
  dm.tools.tests.test_nsp_chain \
  dm.tools.tests.test_pso_offline \
  dm.tools.tests.test_function_parallel \
  dm.tools.tests.test_exclusive_windows \
  dm.tools.tests.test_nso_match \
  dm.tools.tests.test_patches \
  dm.tools.tests.test_ue_fixed_rate \
  dm.tools.tests.test_rewrite_jobs \
  dm.tools.tests.test_extract_image \
  dm.tools.tests.test_docs
make -C dm/gfx/tests -j2 GAME=010015100B514000 check_t_pso_archive check_t_pso_stall
DOTNET_ROOT=/usr/local/share/dotnet python3 -B dm/gfx/tools/tool_lock.py --check-tools
python3 -B dm/tools/lint_python.py --against 555122a9069235441d5a88955105397ec6d53686
python3 -B scripts/regress.py impact 555122a9069235441d5a88955105397ec6d53686..9e3fa000cf553f46ed3bbe66151d59d759e601d7
git diff --check 555122a9069235441d5a88955105397ec6d53686..9e3fa000cf553f46ed3bbe66151d59d759e601d7

Distinct intermediate historical checks (all apply only to the named revisions):

  • f5d2098a50d6c6bdeb31884b06336627a005d23e on main 01abf27977aa4a7366c4a14bc58d9eae75f1d8e6: 785 tests passed, zero skips; twelve authored compute shaders built Mac/iOS at J1, J2 and warm J2 with equal payload bytes. Preserved keyed packages, encrypted Unreal executable paths, accepted exclusive-window addresses, fixed-rate rewrite invalidation, compute archive workers and content-based keys. Pinned lint371/371. Game comparisons and new gameplay/performance remained unavailable.
  • 7fed17e186d7ee174439bc381dc3c1db66901410 on b2d46b86d03f4b03afe11ea61c67cdf00d7a5345: 581 tests ran, 580 passed and one unmodified main Watcher fixture errored; the broad suite was not green. A separate inherited pairing fixture lacked the staged reader; supplying that real reader privately passed all five assertions. Both repairs were kept out of that feature refresh. Pinned lint371/371, 24 fingerprint/PCH/compiler checks and 28 chain/docs checks passed. The twelve-shader Mac/iOS three-run comparison used 25e677066e2f84103c1bb6c2ab2064a3eddecb04, whose production/recipe inputs were identical to final (only Watcher-test restoration differed). No full-game equivalence, peak-disk or speedup claim follows.
  • 8164ef40a37ce9c66ee415ae6260119f8a96d904 on 865cc35fad7034d17c2190f8ce349f61f5bcaba1: 659 tests passed without skips after correcting the scheduler fingerprint and callback capture. Packed-input planning first failed with plain Path and passed with romfs.Path; archive hits materialized nothing. Three excess unchanged test_nso_match index findings reproduced on exact main (377/374 versus main390/387; blob042bc4320b0d2a1c22bf296c9877ece03108fb51). No baseline change. Main's ue_ring and PR rewrite_jobs fingerprints both retained.
  • 077d7a396152c026bde551aefcd51f62af5757a1 on f8a5618d5f505a4c0a0bcac7c413872d3a53c009: 488 tests passed without skips, lint376/376. Captured NROs stayed with the first executable; CRA ranges, AppleDouble filtering and current cache tar behavior were retained. Then-available builds did not include the intended five game controls.

These runs used native Python3.14 and supported Metal.922 where stated. Historical six-game results below used unsupported .620 and remain historical. Parallel RomFS extraction stayed withdrawn throughout; the large-image slowdown remains unresolved. No intermediate refresh established a new real-game speedup or gameplay result. Historical CI statements below belong only to their stated heads.

Original implementation, measurements, attribution and commit context (historical)

Integration and behavior

  • Captured runtime NROs remain scanned only with the first executable version. CRA archives retain their indexed range jobs and are excluded from loose-file scans. New upstream NARC/container readers and AppleDouble filtering remain intact. Two new integration regressions exercise the relocated NRO and CRA behavior.
  • Translation and compilation share the scheduler budget; paired vertices wait for their own pixel dependencies. The scheduler is included in the shader-code fingerprint and chain so a semantic scheduler change cannot evade cache invalidation. Upstream task/mesh buffer layouts and combined alpha/logic side libraries remain present.
  • Offline archive input preparation is reused across planning/digests/groups. Upstream's default grouping boundary is preserved: only more than the configured batch size uses groups; a list equal to the boundary stays one compiler run. Current input-based archive keys still cover canonical descriptors, library names/bytes, platform/architecture/minimum OS and compiler identity; moving identical inputs or updating only chain/profile metadata does not rebuild identical content. Canonical developer/archive-key documentation is kept aligned.
  • Direct Vulkan/OpenGL tools expose documented --targets selection and separate platform outputs. The normal NSP-script interface remains compatible; shader progress counts published outputs even when completion is out of key order.
  • RomFS extraction remains serial. Its only production C# difference from current main recognizes both raw and RomFS-wrapped integrity results; no parallel extraction speedup is claimed.

Fresh validation and current limits

432 affected tests pass with zero skips/failures/errors on correction revision 0ffb7b259ac5ca2f61c9b4b424cf22b05d19ac95; final ae39f94eac6b084edb89f86b8a9772a7b62317d6 has the identical tree. The suite covers scheduling overlap/order/errors, captured NRO and CRA preservation, worker allocation, NSO analysis, real serial LibHac image writing and raw/wrapped damage recovery on synthetic inputs, SARC bounded names, Vulkan/OpenGL targets, parallel packing, partial/seen builds and progress, grouped archive/key reuse, cache fingerprints, current containers, PCH compilation, combined pixel side libraries, chain and docs. Synthetic compiler probes use supported system Metal 32023.922.4 for both macOS and iOS. The production nx_extract project also builds in Release with .NET 10.0.402: zero warnings/errors. No game files or keys are used by those synthetic extraction fixtures.

The initial 432-test integration run exposed two failures and two errors: mocked archive plans bypassed required input preparation, an older batch test expected a one-base merge contrary to upstream's grouping boundary, and the new scheduler was missing from the shader-key fingerprint. The correction prepares real library metadata before synthetic plans, tests actual two-group prefetch reuse while retaining the boundary assertions, and adds scheduler fingerprint coverage. The corrected broad run above passes; the original failures are retained in private evidence.

Pinned Python lint against 975bb4c still fails only on main's unchanged dm/games/settings.py:115 ruff B023 (loop variable n in callback): 377 findings against 376 baseline, one new and zero stale. No unrelated repair, suppression or baseline change was made for that finding. Remote CI on this exact consolidated candidate is pending Agent 3 verification; local passing tests do not establish a current-head CI pass.

No new game benchmark, full game shader comparison or gameplay is claimed. Selected coverage would include Z-A (the measured discovery/pipeline path), Three Houses (LINKDATA preparation), Mario Kart World (task/mesh scheduling), Super Mario Galaxy (Vulkan) and Balatro (OpenGL). Current read-only inventory finds no installed Mac builds; no default harness Tree/worktree/prune calls were run in this refresh. These games remain unchecked. No actual game extraction/cache rebuild, signing or installation occurred.

Historical measurements and unresolved extraction finding

SevenSpiders' independent report compared cd859c3 to 2a8ee2e on a 10-core/16 GB Mac: the former parallel extraction was about twice as slow for a 3.5 GB image, while a 0.5 GB image improved about 2.4 times. The large-image cause was not identified. Parallel extraction was withdrawn and the serial path restored; this is not a claim that the slowdown was fixed. Other SARC/rewriter/split improvements, deterministic output checks and six-game/15,878-slot comparisons in that report retain their exact historical revisions. Its Metal 32023.620 override means library bytes are not comparable with supported-toolchain runs. The supported .922 compiler is now available here, but no new game shader comparison or timing run was performed.

All earlier measured tables, validation and limitations from the published description are retained below as historical context. Their old test, CI and performance results do not become results for the consolidated commit.

Validation command: python3 -B -m unittest -v dm.gfx.tests.test_shader_discovery dm.gfx.tests.test_dmsh_schedule dm.tools.tests.test_sarc_names dm.tools.tests.test_layer_targets dm.tools.tests.test_extract_image dm.tools.tests.test_function_parallel dm.tools.tests.test_rewrite_jobs dm.tools.tests.test_rewrite_parallel dm.tools.tests.test_romfs_read dm.ios.tests.test_pack_parallel dm.tools.tests.test_nsp_incremental dm.tools.tests.test_nsp_mac dm.tools.tests.test_pso_offline dm.tools.tests.test_shader_toolchain_cache dm.tools.tests.test_regress dm.tools.tests.test_usage dm.tools.tests.test_dmsh_code_fp dm.tools.tests.test_split_narc dm.gfx.tests.test_cra dm.tools.tests.test_uepak_iostore dm.tools.tests.test_nsp_progress dm.tools.tests.test_nsp_nup dm.tools.tests.test_nsp_nsz dm.tools.tests.test_nsp_scan dm.tools.tests.test_shader_pch dm.tools.tests.test_docs dm.tools.tests.test_nsp_chain dm.gfx.tests.test_dmsh_side, with DM_GAME=0100F43008C44000, DMSH_TEST_METAL=1, DMSH_TEST_METAL_SDKS=macosx,iphoneos and the exact bundled DMSH_TEST_XLATE. Production build: dotnet build dm/tools/nx_extract/nx_extract.csproj -c Release --no-restore -p:NuGetAudit=false.

Historical context: Original commit context — historical messages and integration rationale

These messages keep their historical revisions and validation scope; intermediate frontend wording is preserved as context, not a new requirement.

1f6c20ce1cedc05271ca9d1f464609e549d76c25 — seedds <[email protected]> (original published)

Reduce first-build work and parallelize extraction and analysis

b9117cba9ad5196dce152a84777ef6f35ed10ffb — seedds <[email protected]> (original published)

Pipeline shader builds and balance first-build preparation

6ff5b96f7be116b57e8105ce9496fe16971d553e — seedds <[email protected]> (original published)

Withdraw parallel RomFS extraction after review

Restore the serial image reader after a second-machine performance
regression. Preserve raw and RomFS-translated integrity-error handling
and its strict/lenient regression coverage.

Record the withdrawal and validation limits, and document the standalone
regression harness runtime and derived-profile setup.

22489fe91d3148d6c6c1352f74675b37e5df4607 — seedds <[email protected]> (original published)

Keep build findings and validation documentation in their intended places

361aa570f7760f846bef96c8e373f6adabff3d17 — seedds <[email protected]> (original published)

Keep build documentation aligned with archive inputs and supported Xcode

da505eeb11e02c93aa66046ce444488785e90d29 — seedds <[email protected]> (original published)

Map shared shader target changes to Vulkan and OpenGL games

2d441826d8372899beee9e191aa2a74c76e6923d — seedds <[email protected]> (original published)

ci: pin lint ratchets to the pull request event base

(cherry picked from commit f07d8b24dc01f460d672ad99ebf0be4948aedf18)

7d26a4c83851d660997bc992d0ba88ae206f2fec — seedds <[email protected]> (original published)

Preserve reviewed shader scan comments and reference order

dd6c982ee2df82143ee3b18b065a6edfab423c3b — seedds <[email protected]> (local integration correction/context)

Preserve captured NRO and CRA discovery through scheduling

773742222697ca3a40426a1013d2fa95adcee82f — seedds <[email protected]> (local integration correction/context)

Bound first-build preparation and pipeline shader scheduling

Overlap independent executable/archive/loose-file discovery while preserving ordering, captured NROs and every current container reader. Share one translation/compilation worker budget, bound NSO analysis and archive input preparation, and select Vulkan/OpenGL build targets explicitly. Keep serial RomFS extraction and raw/wrapped integrity-error reporting; the reviewed large-image extraction regression remains withdrawn, not claimed fixed.

Front-ends: direct Vulkan/OpenGL shader calls can select --targets; retain platform-specific outputs. Normal NSP-script invocation remains compatible, with out-of-order shader progress counted from published outputs.

0ffb7b259ac5ca2f61c9b4b424cf22b05d19ac95 — seedds <[email protected]> (local integration correction/context)

Keep scheduling fingerprints and grouped archive fixture contracts intact

Hash the scheduler with the build helpers so its semantic changes cannot evade shader cache invalidation. Keep upstream grouping only above the batch boundary, prepare actual library metadata before mocked archive plans, and exercise two groups in the prefetch regression rather than expecting a one-base merge.

Consolidated commit message

Bound first-build preparation and pipeline shader scheduling

Overlap executable/archive/loose-file discovery without changing source precedence or losing captured NRO and CRA inputs. Share one translation/compilation budget, bound NSO and offline-archive preparation, select Vulkan/OpenGL targets explicitly, and preserve upstream grouped-archive defaults and cache fingerprints.

Keep RomFS extraction serial and report both raw and wrapped integrity failures. The reviewed large-image extraction regression was withdrawn, not claimed fixed.

Historical context: Previously published validation, measurements and limitations — historical 7d26a4c83851d660997bc992d0ba88ae206f2fec

The following is the prior published description at its recorded revisions, not fresh current-head evidence.

This change reduces repeated work when packing a game for the first time. It keeps discovery results in input order, budgets concurrent rewrite analysis and IPA compression, builds the requested Vulkan/OpenGL targets, and starts shader jobs when their dependencies are ready. PSO preparation reads each unique library once and shares its function metadata and digest across eligible pairs.

Parallel RomFS extraction was withdrawn. A reviewer measured a slowdown on a large image on a 16 GB Mac. Its cause remains open. The extractor still streams serially, recovers after repeated damaged reads, and recognizes both the raw and translated integrity errors. The performance tables below measure individual stages. End-to-end speed and game memory usage remain unmeasured. Independent extraction report

Current validation

Rebased candidate 7d26a4c83851d660997bc992d0ba88ae206f2fec includes main bd98317eecfe832b40d401219c15207a398e78dd and preserves the current published head 1007ae953a0e34b2d311f49e2c497a31d4a83c23, including its collaborator main-merge resolution. The final tree exactly matches a clean merge of those two revisions. Upstream sequential PSO batching and the PR's parallel preparation/digest sharing remain integrated: batch keys consume the prepared digests; reflections are released before compilation. The CI event-base prerequisite remains separate because main still lacks it. The two renderer-baseline update commits are already on main and were omitted; the generated symptom refresh is incorporated without losing entries. Serial extraction remains restored and the unresolved large-image slowdown finding is retained.

  • Fresh arm64 Python 3.14.6 focused suite: 314 cases, 313 passed, one optional iOS Metal compile skipped. Coverage includes dependency-ready scheduling, source ordering/context restoration, prepared PSO inputs and batch reuse/failure publication, 512-descriptor memory/key compatibility, bounded rewrite/compression, platform selection, AppleDouble filtering, incremental/NUP packaging, upstream Unity/GLSLC paths, documentation and chain checks. Archive compiler/merger calls are synthetic stubs. No game extraction was rebuilt in this pass.
  • Native pinned Ruff/Pyright: 378 baseline findings, zero new or stale against bd98317eecfe832b40d401219c15207a398e78dd. git diff --check, full main-diff review and generated symptom/header checks pass. Chain 42f0e14b3e2a and the tool lock are unchanged. PSO preparation/batching ASTs match the published integration; compiler invocation, descriptor streaming and archive-key encoding match main. The C-lint baseline equals main; no unrelated analyzer repair is included.
  • regress.py impact bd98317eecfe832b40d401219c15207a398e78dd..7d26a4c83851d660997bc992d0ba88ae206f2fec identifies Hades, Breath of the Wild, Pokémon Scarlet and Tears of the Kingdom through broad rules and 130 profiles with unknown coverage. Intended regression targets remain Pokopia/Three Houses (archive discovery), Splatoon Raiders/Bananza (different shader paths) and Z-A (large package/rewrite/PSO inputs). Only Z-A is installed locally and lacks a smoke route. Locked macOS/iOS Metal 32023.922.4 is missing under selected Xcode 27.2 (27B52), so current-chain rebuilds, real archive compilation, GPU validation, five-game comparison and gameplay remain incomplete. No compiler override/cache reuse or CI monitoring was used. Prior results below remain historical and are not relabeled as current validation.

The final diff retains canonical build/archive-key documentation, durable findings and game reference links; it contains no agent plans or execution journals. Commands: DM_GAME=010015100B514000 DOTNET_ROOT=/usr/local/share/dotnet python3 -m unittest -v across the scheduler/discovery/PSO/pack/rewrite/NSP/docs/regression/Unity/GLSLC/Xcode modules; pinned lint_python.py --against bd98317eecfe832b40d401219c15207a398e78dd; dmsh_chain.py; docs_symptoms.py; regress.py impact; tool_lock.py --check-tools (blocked only by missing Metal).

Historical context: Earlier description and historical validation/feedback

This change reduces repeated work when packing a game for the first time. It keeps discovery results in input order, budgets concurrent rewrite analysis and IPA compression, builds the requested Vulkan/OpenGL targets, and starts shader jobs when their dependencies are ready. PSO preparation reads each unique library once and shares its function metadata and digest across eligible pairs.

Parallel RomFS extraction was withdrawn. A reviewer measured a slowdown on a large image on a 16 GB Mac. Its cause remains open. The extractor still streams serially, recovers after repeated damaged reads, and recognizes both the raw and translated integrity errors. The performance tables below measure individual stages. End-to-end speed and game memory usage remain unmeasured. Independent extraction report

Validation before the merge with main

Candidate 50974fcf2c206d13cd901940169a58d1c53c1364 rebases ba9f1cc2fd1386df6c6e17c097109bca705b72ad onto main 50363b14ef9b19d0e8ade35d78812bdc8e7f8b96. First-build discovery, rewrite budgets, IPA compression, Vulkan/OpenGL target selection, dependency-ready shader scheduling and shared PSO input digests remain relevant: main does not implement those changes. The fixed main still scans executables serially. Its empty-GLSLC-capture explanation is preserved in the relocated scan_mains worker. The combined shader chain, regenerated from source, is 42f0e14b3e2a.

The separate CI prerequisite remains: lint workflows fetch github.event.pull_request.base.sha, retaining the authored fix from f07d8b24dc01f460d672ad99ebf0be4948aedf18. Main still fetches the moving base branch name. This prerequisite changes no production behavior or lint baseline rules. No feature commit was dropped. Range-diff retains all eight commits: six unchanged patches, one scan-diagnostic integration and the regenerated header. Source comparisons confirm upstream provisional-version selection, derived-profile handling and GLSLC capture/coverage functions match main, and every PSO function matches the previous feature head.

After the first focused run, main advanced from 82246bd26444991e26ac3bbda2684d6e0219676a to 50363b14ef9b19d0e8ade35d78812bdc8e7f8b96. The original PR still conflicted and the private candidate was rebased again. Its final tree exactly matches a clean merge of the tested db5d77c1361352dc945c7d7c794eb5e4a8628274 tree and the later main. All 41 feature-only paths remain byte-identical to that tested revision; all seven upstream-only paths are byte-identical to the later main. Their sole intersecting path is the generated symptom index, which regenerated without a change. This retains the new texture view, sparse-dirty tracking, bindless access and 3D dump work without modifying it. The existing 293-test evidence is retained on the basis of those input identities; it is labeled with its tested revision below.

On arm64 macOS, native Python 3.14.6, .NET SDK 10.0.402 and Xcode 27.2 (27B52):

  • At db5d77c1361352dc945c7d7c794eb5e4a8628274 on main 82246bd26444991e26ac3bbda2684d6e0219676a, the focused command below completed 293 tests: 292 passed and one skipped. The skip is the optional real iOS Metal-library compile because its compiler component is unavailable. Tests cover serial LibHac extraction and damage handling, discovery overlap/source order and context restoration, bounded shader scheduling, rewrite budgets, IPA compression, requested graphics targets, PSO metadata/digest sharing and archive reuse, chain headers, incremental/NUP packaging, regression selection, docs, upstream stripped Unity layouts/GLSLC extraction and Xcode staging. The five synthetic extraction tests build and run the real C# writer against LibHac 0.19.0; no game files are used.
  • On final candidate 50974fcf2c206d13cd901940169a58d1c53c1364, the docs, chain, PSO, shader-discovery, incremental-packaging, Xcode-workflow and CI-toolchain modules completed 134 tests: 133 passed and the same optional Metal test skipped. The actual relocated scan_mains was also exercised with the explicit game profile, confirming main's empty-capture explanation and unchanged empty scan result.
  • The unchanged 512-descriptor PSO test still checks streamed-script peak Python allocation, released descriptor memory when the compiler stub begins, complete descriptor output, partial-file cleanup and legacy archive-key compatibility. Archive creation is stubbed; this supplies no real metal-tt or game RSS measurement.
  • Pinned Ruff/Pyright via dm/tools/lint_python.py --against 50363b14ef9b19d0e8ade35d78812bdc8e7f8b96 reports 378 baseline findings, zero new and zero stale. git diff --check, source/header checks and documentation tests pass. The final diff contains no agent planning or execution artifacts. Durable findings/reference links remain in their intended docs; unresolved extraction and end-to-end performance limitations are retained.
  • tool_lock.py --check-tools exits 1: translator/SPIRV-Cross match, but locked macOS and iOS Metal 32023.922.4 are missing from the selected Xcode. The lock is unchanged; no override or prior shader cache was used. Full current-chain Mac/iOS shader rebuilds, real archive compilation, GPU tests and runtime performance coverage remain incomplete. No gameplay or CI monitoring was performed in this pass. Earlier CI does not validate this candidate.

Earlier focused command at db5d77c1361352dc945c7d7c794eb5e4a8628274 (22 modules; final subset listed above):

DM_GAME=010015100B514000 DOTNET_ROOT=/usr/local/share/dotnet python3 -m unittest -v \
  dm.gfx.tests.test_dmsh_schedule \
  dm.gfx.tests.test_shader_discovery \
  dm.ios.tests.test_pack_parallel \
  dm.tools.tests.test_docs \
  dm.tools.tests.test_extract_image \
  dm.tools.tests.test_function_parallel \
  dm.tools.tests.test_layer_targets \
  dm.tools.tests.test_nsp_chain \
  dm.tools.tests.test_nsp_incremental \
  dm.tools.tests.test_nsp_mac \
  dm.tools.tests.test_nsp_nup \
  dm.tools.tests.test_pso_offline \
  dm.tools.tests.test_regress \
  dm.tools.tests.test_rewrite_jobs \
  dm.tools.tests.test_rewrite_parallel \
  dm.tools.tests.test_sarc_names \
  dm.tools.tests.test_shader_toolchain_cache \
  dm.tools.tests.test_usage \
  dm.tools.tests.test_unity_legacy_layout \
  dm.tools.tests.test_unity_text_glslc \
  dm.tools.tests.test_ci_toolchain \
  dm.ios.tests.test_xcode_workflow

Impacted games and available coverage. The fresh manifest scan (regress.py impact 50363b14ef9b19d0e8ade35d78812bdc8e7f8b96..50974fcf2c206d13cd901940169a58d1c53c1364) identifies four broad profiles—Hades, Breath of the Wild, Pokémon Scarlet and Tears of the Kingdom—and 130 unknown profiles. Pokopia and Fire Emblem: Three Houses cover indexed archive discovery; Splatoon Raiders and Donkey Kong Bananza cover different shader paths; Legends: Z-A covers large RomFS, rewrite and PSO inputs. These are the five intended local-game regression targets. The read-only inventory finds only Z-A v393216, with no smoke route. Together with the missing locked compiler, this prevents a current five-game comparison. This pass claims no shader-output comparison, game timing or gameplay pass.

Historical validation. At 09bcd4a9f9454000ef82afa2ea3c29745df412e1 on ad7af9cb34f5728bb0704c619ed12ebad9e6cf9a, 265/266 focused tests passed (one missing-compiler skip), the 55/56 final subset repeated that skip, the Release extractor build and five synthetic tests passed, and pinned Python lint had no new/stale findings. At 9c74ff28, 185 focused tests passed and the queue-origin fixture passed 398 assertions per encoder mode with Metal validation. At 7cfccbd1, 341 Python tests passed, the Mac host built, and a 32 MiB sparse package exercised 128 shader records with record-sized reads. These results and independent feedback below concern their stated earlier revisions.

Historical measurements

Apple M2 Max, macOS 26.6, native ARM Python 3.14. These are individual stage timings, not a complete first-build or cold-disk speedup.

Historical scheduling measurements

Comparison: prior PR head 2a8ee2e5 versus the earlier scheduling implementation. Alternating runs use separate fresh output directories. Shader/Metal caches start empty with no prefill; filesystem caches are not purged. Shaders use eight workers, rewrite uses the automatic budget, and PSO preparation uses eight readers.

Real Legends Z-A v393216 stage Runs per version Before median After median Reduction
Shader sample, 982 shaders including dependencies 3 123.245 s 116.296 s 5.6%
Full main + sdk rewrite stage 3 35.835 s 23.384 s 34.7%
PSO preparation, 26,051 pairs / 26,029 bases 5 8.862 s 6.983 s 21.2%

Shader and rewrite timings were noisy under filesystem event processing and Spotlight indexing. Shader ranges: baseline 113.822–160.096 s, candidate 113.126–136.036 s. Rewrite ranges: baseline 21.969–37.801 s, candidate 22.808–48.868 s. These medians do not establish precise gains, especially the 5.6% shader result. PSO runs were baseline 24.118, 9.400, 8.862, 7.959, 8.582 s and candidate 7.215, 7.093, 6.983, 6.525, 6.627 s; the median includes all five, including the first baseline outlier.

  • The shader sample requests 512 evenly spaced keys, expanding to 982 with dependencies. All 4,816 artifacts match after excluding the expected chain-version field and normalizing only verified filename-derived Metal initializer symbols and their covering MTLB HASH. Of 2,851 libraries, 75 variant libraries in the first comparison differed only in those symbols/hashes: scheduling can select a different first source filename for shared identical MSL. All other bytes matched; raw outputs are retained. Scratch runs explicitly used DM_ALLOW_OTHER_METAL=1 with installed Metal 32023.921.6, not pinned 32023.922.4.
  • Rewritten code and tables match byte-for-byte, excluding only the expected build_src.sha256 source fingerprint.
  • PSO descriptors, stamps and library digests match exactly. Timing includes planning, serialization, hashing and writing new descriptors/stamps; it excludes metal-tt compilation. Inputs were isolated from b-b7cd656abd7c. An earlier empty-input attempt was discarded and is not included in the results.

Earlier first-build improvements

These earlier stage benchmarks compare saved pre-change sources and were recorded before the publication rebase onto cd859c38. They have not been rerun or relabeled as timings of the latest commit. They use fresh outputs and warm filesystem caches on the same machine. Their baseline differs from the scheduling measurements above; the percentage reductions cannot be added.

Real Legends Z-A v393216 stage Runs per version Before median After median Reduction
Full main NSO rewrite 3 25.498 s 22.153 s 13.1%
Full shader split, RomFS + main 5 19.338 s 15.706 s 18.8%

Patched code and all six rewriter tables matched; build_src.sha256 intentionally changes with the source. All 16 shader packages/tables matched, covering 28,603 shaders. Shader timings were noisy: baseline 16.395–29.172 s, candidate 15.310–29.586 s, with system indexing active during slow rounds.

Synthetic stage Runs per version Before median After median
SARC names, 8 MiB / 128 members 5 0.535652 s 0.000240 s
IPA, 288 MiB incompressible input 3 5.471 s 1.075 s
IPA, 288 MiB mixed input 3 3.010 s 0.505 s
IPA, 288 MiB compressible input 3 1.222 s 0.309 s
iOS-only Vulkan, 48 shaders 3 2.576 s 1.368 s
iOS-only OpenGL, 48 shaders 3 3.830 s 3.221 s

SARC members and decompressed ZIP payload hashes matched. IPA sizes were unchanged for incompressible input, 151,683,065 → 151,632,138 bytes for mixed input, and 880,171 → 880,514 bytes for compressible input. A 4 GiB + 17 byte Zip64 fixture passed Python CRC and /usr/bin/unzip -t checks. Synthetic Vulkan/GL iOS libraries and tables were byte-identical; these runs used installed Xcode 27.0, not the pinned 27.2 toolchain.

Independent coverage of the earlier published revision

SevenSpiders compared cd859c38 against 2a8ee2e5 on a 10-core / 16 GB Mac, macOS 26.1, Xcode 16.4 / Metal 32023.620, with DM_ALLOW_OTHER_METAL=1. This is attributed external evidence for that earlier head, not validation of the later scheduler or the current review changes.

Game Successfully built shaders (both revisions) New failures / changed MSL / new interfaces
Star Wars: The Force Unleashed 206 0 / 0 / 0
Metroid Dread 1,010 0 / 0 / 0
Mario Strikers: Battle League 2,884 0 / 0 / 0
Chants of Sennaar 3,726 0 / 0 / 0
Dodgeball Academia 7,996 0 / 0 / 0
Eastward 56 0 / 0 / 0

Total: 15,878 successfully built shaders; Strikers' three other shaders failed identically on both sides. The reviewer also reproduced SARC, rewrite and discovery improvements, byte-identical outputs and damaged-file reporting. Runtime-root and derived-profile setup are now documented, including the distinction between the harness's automatic profile selection and direct shader-tool invocation.

Verification of the queued lint job

At 09bcd4a9, the full clang-tidy scan matched all 268 baseline findings, with zero file/check pairs above or below their counts. The job then compared that snapshot against a later main revision and reported false growth in t_movie_vpx.c (1 to 2).

This branch carries only the workflow and developer-guide commit f07d8b24 from #1060. Both lint jobs fetch the base SHA in the PR event. In a temporary Git repository with two successive base commits, running each workflow’s fetch command selected the event SHA after the branch advanced. Locally, the C comparison reproduced the reported failure against fd14f3bc and passed against the tested base ad7af9cb. Both C and Python rejected deliberately increased counts. All 40 tests in python3 -m unittest dm.tools.tests.test_lint_c dm.tools.tests.test_lint_python dm.tools.tests.test_docs passed on ba9f1cc2. This repair changes CI inputs and developer documentation only.

Metal fixture lint baseline

The failed scan on 50974fcf found 265 warnings against a baseline of 267. The two obsolete RetainCount allowances were also present on the tested base 50363b14. LLVM 23.1.4 stopped reporting them in t_queue_origin.m and t_view_levels.m when upstream changed the texture serial cache at 6fc34217. This branch carries the two fixture-row removals from #1141.

At 6222229a, the full local 225-source scan (python3 dm/tools/lint_c.py tidy -j4 --against 50363b14, after compdb --game 010015100B514000) matched all 265 findings with zero new or stale file/check pairs. All 19 C lint tests passed. Restoring one fixture allowance in a negative control failed the baseline-growth check. git diff --check passed. The repair changes only the baseline. Existing game and frame-time validation in this description applies to the feature as previously tested.

CI validation on 1007ae95

The merge with main 6ddeda92 preserves parallel shader input preparation, sequential PSO compilation batches and filtering of AppleDouble metadata. Both GLSLC capture and Unreal archive fixtures produced byte-identical outputs with one and three workers. Malformed real shader inputs still failed.

The full C analyzer scan across 226 sources initially found three fewer warnings than the inherited renderer counts. This branch carries the measured reductions from #1141. LLVM 23.1.4 then matched all 262 baseline findings. The pinned Python linters matched all 378 findings. Both comparisons used the integrated main revision.

The focused suite ran 329 tests with one optional skip. The final revision also passed the patch registry, C lint, documentation, PSO and external shader tests, with one optional skip among 85 tests. The five-game regression command stopped because only Legends Z-A had a local Mac build. The locked Mac and iOS Metal compilers were unavailable, so these results cover synthetic inputs and exclude gameplay and real archive compilation.

Historical context: Preserved published commit message

Original published ae39f94eac6b084edb89f86b8a9772a7b62317d6; its rebased candidate retains the same authorship and exact message. Any results named here belong to their original revisions.

Bound first-build preparation and pipeline shader scheduling

Overlap executable/archive/loose-file discovery without changing source precedence or losing captured NRO and CRA inputs. Share one translation/compilation budget, bound NSO and offline-archive preparation, select Vulkan/OpenGL targets explicitly, and preserve upstream grouped-archive defaults and cache fingerprints.

Keep RomFS extraction serial and report both raw and wrapped integrity failures. The reviewed large-image extraction regression was withdrawn, not claimed fixed.

@SevenSpiders

Copy link
Copy Markdown
Contributor

Verification on a second machine. Base cd859c38, candidate 2a8ee2e5. Apple M-class, 10 cores / 16 GB,
macOS 26.1, Xcode 16.4 / Metal 32023.620 (pinned is 32023.922.4, so everything ran with
DM_ALLOW_OTHER_METAL=1; the three stages changed here do not involve the Metal compiler, so the ratios are still
meaningful, but Metal bytes are not comparable to your runs).

What reproduces

Claim Your number Measured here
SARC names bounded (128 members / 7.3 MiB) 0.536 s → 0.00024 s 302.3 ms → 0.372 ms
Rewriter analysis parallel (TFU main) −13.1 % −12 % (1.71 → 1.51 s)
Shader split parallel (Dodgeball, 7,996 shaders) −18.8 % −7.5 % (2.12 → 1.96 s)
#810 damaged-file reporting synthetic real corrupted NCA: identical — exit 3 and the same hash check failed: /Content/Audio/SFXPack.pbn; with --allow-damaged, a byte-identical image
Byte-identical output Z-A split (TFU, Dodgeball), rewrite (TFU), extraction (TFU, Sennaar) all identical
Determinism — 6/6 extraction runs one SHA-256; repeated splits identical

The one that does not

Extraction, nx_extract base+update → RomFS.img, interleaved runs, identical output bytes every time:

image base candidate
3.5 GB (TFU) 5.27 / 7.05 / 5.92 s 11.63 / 14.63 / 11.74 s
3.5 GB, NSPs copied to the internal disk 5.02 / 4.18 s 8.51 / 9.54 s
0.5 GB (Sennaar) 1.08 / 0.91 s 0.42 / 0.43 s

So on this machine the parallel extraction is 2.4× faster on a 500 MB image and 2× slower on a 3.5 GB one, and
system time roughly doubles (≈1.0 s → ≈2.2 s on the large image) while user time barely moves. The slowdown is not
the external volume — it reproduces with the NSPs on the internal disk.

Given your note that the timings predate the publication rebase, I suspect the re-open-per-worker path added there
(one LibHac stack per worker, integrity checks) is what costs the system time on a 16 GB machine, and that the
benefit only shows while the working set fits comfortably in cache. Worth re-measuring after the rebase, and worth
knowing that on 16 GB hardware the change can be a regression for large RomFS images.

Regression coverage you listed as missing

regress.py check --no-smoke (chain comparison; #896 changes no shader bytes) on base vs candidate, using each
build's own profile (DM_GAMES_DIR=<build>/profile) and DOTNET_ROOT set:

game shaders (base → cand) newly failing changed MSL interface
Star Wars: The Force Unleashed 0100153014544000 206 → 206 0 0 0 / 0
Metroid Dread 010093801237C000 1010 → 1010 0 0 0 / 0
Mario Strikers: Battle League 010019401051C000 2884 → 2884 (of 2887, both sides) 0 0 0 / 0
Chants of Sennaar 0100543019CB0000 3726 → 3726 0 0 0 / 0
Dodgeball Academia 010001F014D9A000 7996 → 7996 0 0 0 / 0
Eastward 010071B00F63A000 56 → 56 0 0 0 / 0

No regressions across six games and 15,878 shader slots. (Strikers' three missing shaders are Next Level Games
revision-2 archives that neither tested tree can read; identical before and after.)

Tests

Your five new tests fail on cd859c38 and pass on 2a8ee2e5 (verified by staging the test files into the base
tree). dm/tools/tests 856 passed / 16 skipped, dm/ios/tests 48 passed. dm/gfx/tests has one failure that is
identical on base — Apple metal-tt here rejects .mtl4-json, i.e. a Metal-620 limitation, not your change.

Two harness notes (not your PR)

Filling in for the regress.py runs you could not do, two things needed setting here and are worth documenting:
DOTNET_ROOT (else the translator apphost finds the system .NET 9 and the lock preflight fails), and
DM_GAMES_DIR=<build>/profile for derived-profile builds (otherwise dmsh_build raises IndexError indexing a
12k-record package with a 16k-row repo table). Both bite anyone packing an unregistered version.

No game files or keys are included in this report; all artifacts stay local.

@thehobbit85 thehobbit85 changed the title Speed up first builds with bounded extraction, analysis and compression Speed up first builds with bounded I/O, analysis and shader scheduling Nov 2, 2026
@thehobbit85

Copy link
Copy Markdown
Contributor Author

Addressed in 91a9e209.

The parallel extraction change is withdrawn. The original serial LocalStorage / WriteStream path is restored, including #810's repeated-damage recovery. The remaining extractor change recognizes both the raw integrity result and its RomFS translation (2002-4144); synthetic tests cover strict/lenient handling of both.

Fresh post-rebase Z-A runs still favored parallel extraction on this Mac but showed increased system CPU time and wide timing variation. Worker-stack setup took only 0.017 s in the instrumented run, and healthy input never enters the reopen-after-damage path. That does not identify the cause of your large-image regression, so the extraction speedup is removed from the PR's claims rather than presented as fixed. The restored serial path produces the same 5,989,103,860-byte image and SHA-256 as both tested revisions.

Your six-game results are now credited with their exact base/head and unsupported-compiler setting, separately from the later scheduling changes. The development guide now explains DOTNET_ROOT, derived-profile selection, and the DM_GAMES_DIR / DM_GAMES_FIRST settings for direct tool calls.

The follow-up preserves the scheduling work published in 86c4ece3 while this review was being handled. The final local-game regression stops on the new chain's pinned-Metal check (32023.921.6 installed versus 32023.922.4 required); no override was used, and no current-chain gameplay pass is claimed.

The integrated Python suite passes 1,083 tests with 13 optional skips across 124 suites; pinned lint has no new or stale findings. The independent code and integration reviews found no actionable issues.

The native graphics suite also passes on the integrated revision with the installed compiler. The supported-compiler game regression limitation above remains.

@thehobbit85

Copy link
Copy Markdown
Contributor Author

CI follow-up is green: all eight checks pass on e309db89 (tests, lint-c, lint-python).

The host and sanitizer failures came from two test fixtures that still expected every guest-memory release to use mprotect. Upstream 8ea27784 now releases pages through MAP_FIXED mmap, with mprotect as its failure fallback. Commits a8375f90 and e309db89 update the fixtures to cover both paths, keeping their state-preservation and fatal-exit assertions. No production behavior or CI checks were disabled.

Both failures were reproduced before the fixes. Focused tests pass against the old and new release implementations; the full host and ASan/UBSan suites also pass locally against upstream with both fixes. The PR description now includes this follow-up and the current CI results.

@thehobbit85
thehobbit85 force-pushed the codex/first-build-performance branch 8 times, most recently from b22df46 to c93bd19 Compare November 3, 2026 00:41
@thehobbit85
thehobbit85 force-pushed the codex/first-build-performance branch 2 times, most recently from dc779d9 to 45e9164 Compare November 3, 2026 03:13
@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) rewriter The NSO rewriter and per-build patches packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers ios The iPhone and iPad app (dm/ios) tools Tools and scripts (dm/tools, scripts) docs Documentation shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders game: 0100F43008C44000 Pokémon Legends: Z-A labels Nov 3, 2026
@thehobbit85
thehobbit85 force-pushed the codex/first-build-performance branch 5 times, most recently from 9c74ff2 to 09bcd4a Compare November 3, 2026 19:17
@github-actions github-actions Bot added the ci Continuous integration and repository settings (.github) label Nov 3, 2026
@thehobbit85
thehobbit85 force-pushed the codex/first-build-performance branch 5 times, most recently from 077d7a3 to 8164ef4 Compare November 5, 2026 18:16
@thehobbit85
thehobbit85 force-pushed the codex/first-build-performance branch 7 times, most recently from 693ef17 to 69d3c99 Compare November 13, 2026 06:16
Overlap executable/archive/loose-file discovery without changing source precedence or losing captured NRO and CRA inputs. Share one translation/compilation budget, bound NSO and offline-archive preparation, select Vulkan/OpenGL targets explicitly, and preserve upstream grouped-archive defaults and cache fingerprints.

Keep RomFS extraction serial and report both raw and wrapped integrity failures. The reviewed large-image extraction regression was withdrawn, not claimed fixed.
@thehobbit85
thehobbit85 force-pushed the codex/first-build-performance branch from 69d3c99 to d56bd72 Compare November 14, 2026 16:42
@thehobbit85 thehobbit85 changed the title Speed up first builds with bounded I/O, analysis and shader scheduling chain/build: bound first-build preparation and shader scheduling Nov 14, 2026
@seedds

seedds commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Closing without merging. The SARC root-cause fix already landed in dac4a433. The remaining 43-file pipeline/budget bundle lacks a current end-to-end benefit, and the 3.5 GB parallel extraction change was withdrawn after being twice as slow. Keep the measured SARC diagnosis, but we should not land this stale broad stack.

@seedds seedds closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration and repository settings (.github) docs Documentation game: 0100F43008C44000 Pokémon Legends: Z-A ios The iPhone and iPad app (dm/ios) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers rewriter The NSO rewriter and per-build patches shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants