mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #1013] make_game assets: BCPack follow-up pass in worker processes, costliest pool first (OLD-9924) #1050
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1050
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1013
Author: @Diegobecker07
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-9924-bcpack-parallel📝 Commits (3)
fd19cb2make_game: run asset exports and pool follow-ups on --jobs workers, results in order740445amake_game assets: BCPack follow-ups in worker processes, largest firstb6b1fe7make_game assets: start the BCPack follow-ups with the most pixels to decode📊 Changes
2 files changed (+276 additions, -9 deletions)
View changed files
📝
make_game.py(+90 -9)📝
tests/test_make_game_assets_pools.py(+186 -0)📄 Description
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)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.