Repository navigation
Speed up first builds with bounded I/O, analysis and shader scheduling - #896
thehobbit85 wants to merge 5 commits into
Conversation
|
Verification on a second machine. Base What reproduces
The one that does notExtraction,
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 Given your note that the timings predate the publication rebase, I suspect the re-open-per-worker path added there Regression coverage you listed as missing
No regressions across six games and 15,878 shader slots. (Strikers' three missing shaders are Next Level Games TestsYour five new tests fail on Two harness notes (not your PR)Filling in for the No game files or keys are included in this report; all artifacts stay local. |
|
Addressed in The parallel extraction change is withdrawn. The original serial 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 The follow-up preserves the scheduling work published in 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. |
|
CI follow-up is green: all eight checks pass on The host and sanitizer failures came from two test fixtures that still expected every guest-memory release to use 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. |
128460a to
103ed7f
Compare
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.
(cherry picked from commit 35a55ff)
103ed7f to
fbdc8e0
Compare
Reduce first-build work through ordered parallel shader discovery and function analysis, bounded IPA compression, requested-platform Vulkan/OpenGL compilation, dependency-ready NVN shader scheduling, adaptive rewrite CPU allocation and concurrent PSO preparation. The regenerated shader chain is
f5b4fbea0450. Its inputs include main’s Ampere translator and updated shader ABI and the scheduler. The translator binaries and Metal lock match the integrated main revision.Parallel RomFS extraction was withdrawn. The extractor uses the serial
LocalStorage/WriteStreampath and retains raw and RomFS-translated integrity-error handling. A second machine showed about a 2× slowdown on a 3.5 GB image with 16 GB RAM, alongside a smaller-image speedup. The cause remains open. The remaining stages have separate measurements below. SevenSpiders’ reviewRevision
fbdc8e03cb95c42b024eafe15c158b6e2f6e2346includes main4a2a81a64f029d0a75ade9523c8ffc6c89465375. The new jump-table guard and Ampere translation do not supply bounded shader scheduling, parallel function analysis, adaptive rewrite allocation or concurrent PSO preparation.Validation on
fbdc8e03cb95.DM_GAME=010015100B514000 python3 -m unittest dm.tools.tests.test_docs dm.tools.tests.test_jump_copies dm.tools.tests.test_rewrite_parallel dm.tools.tests.test_rewrite_jobs dm.tools.tests.test_function_parallel dm.tools.tests.test_nsp_incremental dm.tools.tests.test_nsp_chain dm.tools.tests.test_shader_toolchain_cache dm.tools.tests.test_pso_offline dm.gfx.tests.test_dmsh_schedule dm.gfx.tests.test_shader_discovery— 214 passed.The rebased rewriter retains the new upstream jump-table bound check through the indirect load. The upstream function changes match main and the jump-table regressions passed.
scripts/regress.py check --no-smoke --games 04007EF01F8AE000,0400380020056000,0100BC0018138000,0100A83022A22000,0100F43008C44000exited 2 at discovery. Fortune’s Weave and Splatoon Raiders exercise the newer shader pipeline, Super Mario RPG and Z-A cover other NVN profiles, and Absolum exercises executable rewriting. Only Z-A was installed. No game comparison ran.Pinned Python lint passed with zero new or stale findings.
GitHub checks for this revision
Earlier integration tests on
ac9d9d8531f6.DM_GAME=010015100B514000 python3 -m unittest dm.tools.tests.test_docs dm.tools.tests.test_nsp_chain dm.tools.tests.test_shader_toolchain_cache dm.gfx.tests.test_dmsh_pairs dm.gfx.tests.test_shader_discovery dm.gfx.tests.test_dmsh_schedule dm.gfx.tests.test_unity_compute dm.gfx.tests.test_unity_known_trees dm.tools.tests.test_rewrite_parallel dm.tools.tests.test_rewrite_jobs dm.tools.tests.test_pso_offline dm.tools.tests.test_nsp_incremental. All 161 tests passed. Pinned Python lint passed with zero new or stale findings.Each rewrite analysis pass reads its current worker allocation and keeps the requested job chunk size. The pool inherits main’s SIGTERM masking around fork and teardown, default signal action in workers, and orderly close/join. The shared cancellation fixture imports the allocation helper in every subprocess. Gzip and Splatoon NDSR detection, profile promotion and observed-depth selection remain in the combined paths. PSO preparation feeds cached library digests into main’s content-based archive key and refreshes metadata on reuse.
Earlier validation on
7de907d2ad7dpassed 186 focused tests and the pinned lint check. Historical stage measurements below come from their stated revisions.Canonical developer documentation describes the concurrency, serial extraction and archive reuse behavior. The game note retains the timing tables, uncertainty and limitations, with subsystem references under “Found on this game”.
Historical validation: the prior integration passed 109 focused tests, host build/full native host suite, memory/heap ASan/UBSan, memory TSan, real GPU dirty tracking and memory-profile checks. The broader review-follow-up Python campaign reported 1,083 passed and 13 optional skips across 124 suites, and the native graphics suite passed using the installed compiler. Original extraction follow-up produced identical 5,989,103,860-byte images: three alternating serial/parallel medians were 7.997/5.322 s, with wide 6.329–10.278/2.175–5.882 s ranges; stack opening took 0.017 s in one diagnostic run. These local observations neither reproduce nor explain the reported large-image regression. The restored serial extractor matches the baseline image hash.
The latest historical
regress.py check --games 0100F43008C44000 --baseline cd859c38attempt on the scheduling/withdrawal implementation stopped at candidate compiler preflight: installed Mac/iOS Metal32023.921.6differs from locked32023.922.4. No override was used for that check; no shader comparison or gameplay completed. An earlier 28,603-shader cached comparison predates the scheduler and does not validate this chain. Z-A was the only discovered local Mac build; its extraction, modules, shaders and PSO inputs cover the changed stages. Other games remain unchecked locally.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
2a8ee2e5versus 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.main+sdkrewrite stageShader 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.
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 usedDM_ALLOW_OTHER_METAL=1with installed Metal32023.921.6, not pinned32023.922.4.build_src.sha256source fingerprint.metal-ttcompilation. Inputs were isolated fromb-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.mainNSO rewritemainPatched code and all six rewriter tables matched;
build_src.sha256intentionally 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.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 -tchecks. 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
cd859c38against2a8ee2e5on a 10-core / 16 GB Mac, macOS 26.1, Xcode 16.4 / Metal32023.620, withDM_ALLOW_OTHER_METAL=1. This is attributed external evidence for that earlier head, not validation of the later scheduler or the current review changes.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.
Remaining validation limitations
0100F43008C44000, update 2.0.2 / v393216). Its large RomFS, executable modules and shader/PSO inputs exercise the affected paths; additional local games remain unchecked; the six-game external results above cover only the earlier head.32023.921.6differs from pinned Xcode 27.2 / Metal32023.922.4. Full Mac/iOS shader rebuilds and regression comparison with the supported compiler remain outstanding. The scratch shader benchmark's override is explicitly unsupported-toolchain evidence; the repository lock stays unchanged.smoke.tsvroute. Passing native host/graphics checks is not gameplay validation. No existing player build was replaced.Shared geometry fixture CI fix
The fixture in this branch matches the #959 prerequisite in both patch and file contents. Its rebased commit is
fbdc8e03cb95.Prior published commit
128460af4393applied #959 as a separate prerequisite. Onac9d9d8531f6, LLVM 23.1.4 reproduced both C lint findings in the geometry hazard fixture inherited from main. At that earlier head, the focused lint check passed and the Mac GPU fixture passed all 65 assertions in each of three cut configurations with Metal API validation. The prerequisite changes only the synthetic test. The feature validation and its limitations above still apply to the feature revision they name.