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/tooling
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
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
risk
high
risk
low
risk
medium
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 @1310ecc6and of this PR @14e623ba1310ecc614e623baprofile_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 @14e623ba(passes) and against main'sflag_text(the keys differ across folders); the game-free key comparison under Measurements, run again on main @1310ecc6and this PR @14e623ba(the same results as before the rebase). The 41 checks that read this diff (python -I -B tests/run_all.py --jobs 6 --exactwith the checks undertests/andnx2/test_*.pythat name a changed file, and the ones it adds or changes), not the whole suite, on this branch @14e623ba(rebased onto main @1310ecc6), Windows 11 Pro, with the Builder's llvm-mingw clang (the v2.0.14 tools): 34 passed, 6 failed, 1 skipped (a tool this PC lacks). The 3 that fail also fail on main @1310ecc6(the whole suite there: 500 passed, 17 failed): test_appimage_player_build, test_linux_preflight, test_vk_pgo. test_dll, test_driver_cache_folder, test_pipeline_tour are skipped on Windows in a whole run (Linux-only or a full game build); named, as here, they fail on main @1310ecc6too. The checks: test_dll, test_appimage_licenses, test_appimage_player_build, test_bake_ds, test_bake_skeleton, test_build_cleanup_scope, test_build_hash_cache, test_build_times, test_compile_retry_jobs, test_compiler_failure, test_cpm_discovery, test_cpu_target, test_dev_packs, test_dlss_sdk_cache, test_driver_cache_folder, test_exclusive_marks, test_failed_compile_keeps_objects, test_fpx_sticky, test_kept_translation, test_late_fix_build, test_lift_cache, test_link_path_comma, test_linux_preflight, test_make_game_ngx, test_mem_gate, test_mem_gate_children, test_mem_gate_leases, test_mem_limit, test_pipeline_tour, test_prepare_at_build, test_profile_path_key, test_program_cache_format, test_recorder_sync, test_shader_stamp_cache, test_shader_stamp_inputs, test_split_giants, test_stale_hot_pieces, test_switches_removed, test_third_party_objects, test_utf8_paths, test_vk_pgo.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 @1310ecc6and on this PR @14e623ba, 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 folder42a4e6897514e623ba1aRebased onto main @
1310ecc6(head14e623ba, no conflicts; it also merges cleanly with main @7bacf846). The 41 checks that read this diff, not the whole suite (the agreed process now): 34 passed; the 3 that fail also fail on main @1310ecc6, and 3 Linux-only or game-build checks, skipped on Windows in a whole run, fail when named on main too (listed under Testing). The game-free key comparison was run again on both trees, the same results. No code change.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.