make_game assets: BCPack follow-up pass in worker processes, costliest pool first (OLD-9924) #1013
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1013"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-24T16:49:58Z.
Claimed in the coordination issue as: OLD-9924 (claim)
Carries over #192 (old pull request 9924 by tedin7), rebased on current
mainwith tedin7's commit kept as the firstcommit. Once this one is reviewed, #192 can be closed in its favour.
What and why
The assets stage's BCPack follow-up pass (
ttpf_assets.complete_pool) decodes in pure Python, one texture poolafter another, so it keeps one core busy: on the machine below it took 78 min 30 s with the other 23 cores
idle. This branch runs it one pool per worker process.
From tedin7's commit:
parallel_map(), the results and the log lines in pool order as from a serial run, and thefirst failure in pool order being the one reported. On top of it:
follow_pool(), through the samettpf_manifest()check), so the mainprocess neither holds every pool's catalog nor pickles one to each worker. A manifest that is not complete is the
same single build error as before.
follow_cost()counts the pixels of the rowscomplete_pool()decodes (the rowsttpf_assets.candidateaccepts; 0 for a pool the pass already stamped), from the manifestsassets()readsanyway. The source file's size is a poor guide: the slowest pool (467 s alone) is a 0.79 GiB one with 1,038
candidate rows, while each 2.5 GiB terrain pool has about 250 and takes 280-400 s. Over the 52 pools measured,
the pixel count ranks the serial times with Spearman 0.82, the file size with 0.44.
--jobs, or the stage's share of it when shaders run beside it; at most 61 workers on Windows(
ProcessPoolExecutor's limit).rpf9dumpexports stay one at a time, as onmain: one texture-pool export already kept about 3/4 of 24cores busy and peaked at 8.2 GiB, so two side by side would compete for the same cores and double the memory.
Tested
Without the game:
tests/test_make_game_assets_pools.py, 16 tests. New or changed: exports run one at a time with the whole--jobsbudget; the costliest pools follow first (file sizes in the opposite order, a stamped pool last, the sameorder on a resumed build); a follow-up reads its own manifest and reports a broken one;
parallel_map()returnsresults in item order and raises the earliest failure in item order. Negative control: the new tests fail on
tedin7's commit alone (2 failures, 3 errors), and the ordering test fails with the order by file size.
tests/test_make_game_*.pyfiles,tests/test_text_write_line_endings.py,scripts/check_no_game_data.pyon the changed files,
python -m compileall -q make_game.py tools tests,make_game.py --help.With the game (retail package 1.0.2.1; Windows 11 Pro, 24 logical cores, 48 GiB, output on an SSD):
Before: the serial pass of a full
check,assetsbuild onmainat21625bca8, timed from the manifests'stamps: 11:32:07 → 12:50:37, 78 min 30 s for all 57 pools.
After: before the pass reached them, a watcher saved the pre-pass manifests of 52 of the 57 pools (the other 5
are small pack pools that finished within seconds of their export). The pass was then replayed on copies of
those 52 folders, with this branch's
parallel_map(follow_pool, ...)called asassets()calls it, 12 workers(the default
--jobson this machine), no build or other heavy work running:main, live build, 57 pools)With the cost order the slowest pool starts first and ends last, at 625 s, so the pass now takes as long as that
one pool does on a busy machine; going lower would mean splitting a pool across workers.
Output: for both replays, every manifest equals the serial build's (compared as parsed JSON) and all 735 BCPack
DDS files it wrote are byte-identical (SHA-256), with the same file list in every pool folder.
GPUs tested: n/a (build-script change, no GPU code); the build machine has an NVIDIA GeForce RTX 5070 Ti, driver
621.24, Windows 11 Pro.
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-25T13:13:36Z.
Re-checked against current main (
0d80bc5df). Main changedmake_game.pyin other places and the PR still merges cleanly, so I did not rebase it. On the merged tree, all 24tests/test_make_game_*.pyfiles pass, along withtest_text_write_line_endings.py,compileallandmake_game.py --help.The three open PRs that touch
make_game.py(#1013, #1378, #1407) also merge with each other without conflicts. The same tests pass with all three merged on main (27 files).CI is waiting for workflow approval (first-time contributor).
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-25T18:16:08Z.
Rebased onto current main (
b9320a118). The only conflict was the import block: main addedimport tracebacknext to theconcurrent.futuresline this PR extends. tedin7's commit keeps its author, andgit range-diffshows changes to that import context only. The third commit is unchanged.Re-verified on Windows 11 Pro (26300) with Python 3.14. On the rebased branch, all 24
tests/test_make_game_*.pyfiles pass (16 tests intest_make_game_assets_pools.py), along withtest_text_write_line_endings.py,test_dstorage_history.py,compileallandmake_game.py --help. The three open PRs that touchmake_game.py(#1013, #1378, #1407) still merge with each other without conflicts, and the same set passes with all three merged on main (26 files). The BCPack timings in the description were measured on the previous base and were not rerun.CI for this push is waiting for workflow approval (first-time contributor).
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T00:22:29Z.
Native Windows 11
spawnMultiprocessing Verification (b6b1fe75fc) — PASSDiff-audited
make_game.py(+84/-12) andtests/test_make_game_assets_pools.py(+186/-0) and verified Red -> Green merged ontoorigin/main(48bae6cad) on Windows 11 (10.0.26200, NTFS, Python3.12.10with-I, WindowsspawnProcessPoolExecutor).Results
origin/main48bae6cadwith PR'stest_make_game_assets_pools.py):FAILED (failures=1, errors=4)(Ran 16 tests in 9.048s,rc=1— pool follow-ups ran serially sofollow_that_needs_companytimed out waiting for a concurrent peer worker, andfollow_pool/parallel_map/ExportFailedwere absent).PR #1013merged ontoorigin/main):python -I tests/test_make_game_assets_pools.py:Ran 16 tests in 2.762s — OK(rc=0) on native Windowsspawnworker processes, confirming clean pickling of module-level callables acrossProcessPoolExecutor(os.name == "nt"61-worker cap), concurrent multi-pool BCPack follow-ups logging deterministically in pool order, descending pixel-cost scheduling (stampedpools weighted0), and earliest-in-pool-order failure reporting.tests/test_ci_registration.py(18/18),tests/test_text_write_line_endings.py(3/3), andscripts/check_no_game_data.py:OK.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:43:41Z.
RUN of #1013 (red/green,
python -I, no build, no game, no GPU)Heads tested: PR head
b6b1fe75fc03, current main829530dbd019; merged = main + PR head,git merge --no-ff, local only (merged cleanly).Commands, one process each, from the worktree root:
python -I tests/test_make_game_assets_pools.pyRelated: every
tests/test_make_game_*.py(25 other files) and every other test file that mentionsmake_game(30 files, e.g.test_ttpf_assets.py,test_progress_dashboard.py,test_shader_stage_resume.py,test_semantic_mutants.py,test_docs_cli_flags.py,test_text_write_line_endings.py,test_ci_registration.py; those that exist on the tested tree). Alsopython -I -m compileall -q make_game.py tools testsandpython -I make_game.py --help.make_game.pywith the PR's version of the test file):FAILED (failures=1, errors=4)of 16 tests. Four tests error becauseparallel_mapandExportFaileddo not exist in main'smake_game.py(AttributeError), andtest_the_costliest_pools_follow_firstfails its order assertion (main does not put the stamped pool last). This is a real red: the new and changed tests fail on main's code for the reason the PR fixes (the follow-up pass in worker processes, costliest pool first).test_make_game_assets_pools.py16 ran, OK; compileall and--helpexit 0. Of the 50 related files that exist at that head, all pass excepttest_tool_stdout_encoding.py(1 failure), which also fails on plain main.test_make_game_assets_pools.py16 ran, OK; compileall and--helpexit 0. Of 55 related files, 50 pass. The 5 failures are the same on plain main (same counts), so they are pre-existing and not caused by the PR:test_make_game_pipelines.py(failures=3),test_make_game_preflight.py(failures=1),test_docs_cli_flags.py(failures=1),test_progress_dashboard.py(failures=1),test_tool_stdout_encoding.py(failures=1).Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12, GPU not used.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:55:25Z.
Merged after enlight3d's red/green check (check) (RTX 3090, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto
main57d3222bfwithout conflict, and its test file(s) (tests/test_make_game_assets_pools.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.