WIP: perf(build): lifted chunks of ~4 MB, by guest address, besides chunks.txt's boundaries #31
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
needs measurements
question
testing wanted
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!31
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:perf/smaller-chunks"
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?
Why
A small update that changes a few of the game's functions still recompiles every lifted chunk that holds one, and a chunk is ~24 MB of C: a typical one takes ~227 s of compiler time. Splitting the lifted C into ~4 MB pieces by guest address makes that ~41 s, with no cost in play or in a full build.
What changed
sub_startsinnx2/chunks.pyadds a chunk boundary everySUB_STRIDE(0x40000) of guest address, at the first function at or after it, besidesimage/chunks.txt's stable boundaries;writebuilds itsBoundariesfrom both. They are guest addresses, so they stay put when a function grows: a change moves no boundary but its own chunk's.chunks.txtkeeps only the boundaries it had, and they are worked out again each lift from the same functions, so dropping this change later is clean.write: more than 1000 chunks (acode_NNNN.c) stops the lift with a message, sincesplit_big,split_hotandbuild.pymatch three-digit chunk names.tests/test_sub_chunks.py(new): the first function past each stride; a long function spans strides without a boundary inside it; a function found since moves one boundary at most; chunks end at them as well as at the saved boundaries;writeuses them and saves onlychunks.txt's; the stride makes chunks of a few MB.The first build after this compiles every lifted chunk once (all boundaries are new): for a player, that update takes about as long as a full build, once. Updates after it recompile only the ~4 MB pieces that changed.
Flags and settings
None.
Measurements
Measured on the GitHub version (NotRexed/Hookshot#2890), not yet on Longshot: this PR stays WIP until it is.
Compiles: Ryzen 9 3900X, Windows 11 (as the GitHub description states it).
In the game: RTX 3080 (NVIDIA 621.14), Ryzen 9 3900X, 64 GB, Windows 11; Kokiri Forest from a save (the game logic bounds its frame on the CPU there); two interleaved pairs of 30 samples, the median of each.
The heavy-function cluster (old chunks 021-023) still takes 300-900 s per piece on this PR. No errors in either game run.
These two were measured with the author's other local build changes on the same side (this, the lift key's environment, link skips and others), each in a fresh player-like work folder, so they are not this PR alone:
The smaller pieces spread better over the cores.
Testing
Tested: the runs under Measurements (on the GitHub version) and the game-free checks this description names.
Not tested: Linux. The 1000-chunk guard (the game's code makes ~330 pieces).
Needs other testers:
mainwith the ~4 MB chunks (request to open)Screenshots
Nothing on screen.
Risk and rollback
The first build after this lands compiles every lifted chunk once, for players too. A stride that made more than 1000 chunks would stop the lift with a message rather than leave a chunk out. Nothing is saved to
chunks.txt, so reverting the commit is enough.Reviewer notes
Carried over from NotRexed/Hookshot#2890 with the move to Longshot: the same change on Longshot's
main, with its rename applied. Its review and discussion are there.Checks run on the GitHub version: every check that reads the changed files (9), through
run_all.py, rebased on GitHub'smainof that day (with NotRexed/Hookshot#2748's spawned emit), Windows: 8 pass;test_spawn_emitfails the same way onmainthere. Only those checks were run, not the whole suite. The checks and the game runs were done on the GitHub version; this branch is the same change with the rename applied (the same files and line counts). Forgejo runs no checks; they were not run again here. Part of the dev-loop proposal's work on small updates (NotRexed/Hookshot#2636).Issues
None on Longshot. See NotRexed/Hookshot#2636.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.docs/tested-configurations.mdfor each measured run.MKWVK_API_VERSIONbumped (gpu/vk/vk_api.h'sMkwVkHostorMkwVkRendererchanged).mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
perf(build): lifted chunks of ~4 MB, by guest address, besides chunks.txt's boundariesto WIP: perf(build): lifted chunks of ~4 MB, by guest address, besides chunks.txt's boundariesBack to WIP under #48's process: this was carried over before the new template. Its description will be brought to the template and measured on Longshot (main against this PR, at named commits) when it's wanted for review; ask here if you'd like it sooner.
Description brought to Longshot's PR template (#48). Still WIP: its numbers are from the GitHub version, and it isn't rebased on current main; it gets measured on Longshot (main against this PR, at named commits) before it is marked ready.
Description moved to the template's Testing section and whole checklist (#72): what was tested, what wasn't, and what needs other testers (their test requests to open while this is WIP).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.