perf(build): object keys name a play profile by its contents, not its path in the work folder #660
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!660
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:perf/profile-path-key"
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?
Type: perf · Risk: low · Tested on: Windows 11, game-free checks · Needs: a timed two-folder build with the object store (Windows or Linux, any GPU)
Why
The object store (#371) and
scripts/dev_packs.pylet a new work folder take the objects another folder already compiled. Two kinds can't be shared today: the eight hot pieces and the renderer's own objects.make_game.pyhandsbuild.pyboth play profiles from inside the work folder (RX_PGO=<work>/longshot_pieces.prof, and since #569RX_VK_PGO=<work>/longshot_vk.shipped.profdata), and the object key holds that path, so every new folder compiles them again. The hot pieces are the longest single compiles of a build.Split out of #30 at HumanBean's request in its review.
What changed
Object keys now name a play profile by its contents only.
build.pyalready puts a digest of the profile's bytes beside its path (-DLONGSHOT_PROFILE_SHA1,-DLONGSHOT_VK_PROFILE_SHA1), so the path is replaced by<profile>in the text the key is made from, as--sysroot=already is.nx2/build.pyflag_text:-fprofile-instr-use=<path>becomes-fprofile-instr-use=<profile>. The compile itself still gets the real path.tests/test_profile_path_key.py(new): two folders' profile paths give one key, another profile's contents another (for both defines), and every"-fprofile-instr-use=" +inbuild.pycarries its digest in the same list, so the key still changes when a profile does. It fails on main.Measurements
Verdict: game-free: the eight hot pieces' and the renderer objects' keys are now the same in a second work folder with the same profile, where main gives them another key, so the object store can share them; another profile still changes the key. The compile time this saves in a second folder is not timed yet: it will be added here when the two-folder builds under Must be tested are run, by me or by anyone who runs them first.
Hardware: Ryzen 9 3900X, 64 GB, Windows 11 (the key needs no GPU)
Scene: none (a build change, game-free, no dump)
Method:
flag_text()from each tree's ownnx2/build.py, for a hot piece's flags and a renderer object's, with the profile in two work folders and with another profile's digest; the key is the same or not, so there is nothing to take a median ofHow to reproduce: the script below,
python -I -B profile_key_compare.py <tree>, with a checkout of main @6c9edffeand of this PR @42a4e6896c9edffe42a4e689profile_key_compare.py
Flags and settings
None: no switch, menu row, ini key or build flag changes.
Testing
Tested:
tests/test_profile_path_key.pyon this branch (passes) and against main'sflag_text(the keys differ across folders);python -I -B tests/run_all.pyon this branch and on main6c9edffe, Windows 11 (with the Builder's llvm-mingw clang (12 at once), this branch: 530 passed, 16 failed, 35 skipped, no failure that main doesn't have; main @6c9edffe: 529 passed, 16 failed, 35 skipped (seven checks that timed out or were blocked by Windows Defender while other compiles ran passed when run again alone). The 16 that fail on main too: test_appimage_player_build, test_cpm_discovery, test_crash_dialog, test_env_on, test_fpx_sticky, test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_oot_state_tap, test_readback_late, test_seed_reader, test_spawn_emit, test_tested_configurations, test_vk_pgo, test_vram_budget_row, test_walk_key).Not tested: a real build: that the second folder takes the hot pieces and the renderer's objects from the store; Linux.
Must be tested:
dev_packs.py basefolders of one commit over oneLONGSHOT_OBJ_STORE, on main @6c9edffeand on this PR, expecting the second folder's@@filelines to show thecode_hot_*pieces and thevk_*objects as cached on this PR, where on main they are new; with both builds' "where the time went" tables.Risks
What could break: a different profile at the same path still changes the key (the digest beside the path), so nothing stale is reused. A profile flag added later without its digest beside it would lose that; the new check fails on one.
Turning it off: revert the commit.
Compatibility: the eight hot pieces' and the renderer objects' keys change once. A player's next build compiles them again, and one whose last build kept its translation (
--kept-lift) translates the game once more:kept_partis made from the same flag text, so the kept list no longer fits (KEPT_STALE). Saves, the options file, the shader caches and the vk ABI are unchanged.Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.🤖 Generated with Claude Code
Measurements now has a game-free comparison of the hot pieces' and the renderer objects' keys across two work folders, on main and here. Out of WIP so review and independent testing can start now: the measurement here is game-free (Measurements, with the script to rerun it), and the timed builds under Must be tested are not run yet. I will run them and edit this description with the numbers when they are done; anyone with a build tree and their own game files is welcome to run them first and post the results here.
WIP: perf(build): object keys name a play profile by its contents, not its path in the work folderto perf(build): object keys name a play profile by its contents, not its path in the work folderView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.