WIP: perf(scripts): hotlist.py ranks a hot list by the FP helper calls it inlines #1124

Draft
Marcuss2 wants to merge 1 commit from Marcuss2/Longshot:perf/hotlist-fp-ranking into main
Contributor

Type: perf · Risk: low · Tested on: Linux, RX 9070 XT (RADV) · Needs: none

Why

The lift can compile a chosen list of lifted functions together at -O2 with the FP helpers' fast paths inlined (A64_HOT_FUNCS + A64_HOT_CHUNK=1, code_hot.c). scripts/hotlist.py chose that list by sample time alone, which is the wrong measure for what the list is for: the inlining pays per *call to a64_fpx_* that goes away, so a function worth listing is one that runs often and holds many of those calls. The time-only cut also keeps functions with no FP call at all — the hot chunk compiles them for -O2 alone.

On a 12 s Market profile the time-only cut at 0.85 takes 441 functions and 80 MB of hot-chunk C; ranking by samples × FP calls reaches most of the same FP work with 47 functions and 25 MB.

What changed

scripts/hotlist.py gains --fp-calls <gen>: with the lift's own C folder it counts each lifted function's scalar a64_fpx_* call sites (one definition per function, its body ending where the next begins) and ranks by samples × calls, cutting at <share> of that total. The summary line names the weighted share. Without the flag nothing changes; the Zstd decoder is appended as before.

  • scripts/hotlist.py: --fp-calls, the ranking, the summary line.
  • tests/test_prof_symbols.py: a function that is the innermost frame of 2 samples and holds an FP call beats one sampled 8 times without one; the weighted summary is printed; the Zstd decoder is still appended.
  • docs/development.md: the A64_HOT_FUNCS row, which was missing from the build switches.

The list itself is not committed: it is lifted function addresses from a profile of one PC, regenerated per lift (A64_HOT_FUNCS is in the lift key, so a build given a list is translated again).

Measurements

Verdict: on current main, a build using the list this PR's tool writes measures +1.64 % fps (median of 5; exact permutation p = 0.381, the ranges overlap) and -1.89 % CPU (p = 0.048, the ranges only touch) against main's own build, for +3 min 55 s of a cold build (3:18 to 7:13) and +0.73 % exe size. The same list measured +2.95 % fps and -2.91 % CPU on the previous base (c167ec67); main has since taken always_inline header helpers (#1002) and light -O1 passes, which appear to have taken part of that gain and to have made the hot piece the long pole of the compile. So: the tool is useful and its list is small, but the advantage is smaller on today's main than when it was found, and a build that uses a list pays several minutes for it.

Baseline: the "Before" column is main itself (71b1edd8), built from scratch on this PC in this session. The "After" column is the same commit's source built with the list scripts/hotlist.py --fp-calls 0.79 writes: this PR changes only a script, so the game code is identical and the hot list is the whole difference.

Hardware: Linux, AMD Ryzen 9 9950X3D (32 threads), RX 9070 XT, RADV (Mesa).
Scene: Kokiri Forest at Link's house, the repo save kokiri-start, standing still; headless, 1920x1080, the game's own upscaler, V-Sync off, frame generation off, HOS_FPS_MAX=1000, FPS counter off.
Method: both builds from the same checkout, dev_build.py build with the object and translation stores off and no shader preparation, so each is a cold lift and full compile; one warm-up run per build, then ten arms through the PC's queue (--mode timing) in the mirrored sequence A B B A A B B A A B, 40 s each; fps = frames / wall time from the control bridge's counter, CPU = /proc/<pid>/stat utime+stime per frame; medians, and an exact permutation test on the difference of medians.
How to reproduce: RX_MAPS=<the profile's build> python -I scripts/hotlist.py <HOS_SAMPLE_ALL file> hot_funcs.txt 0.79 1500 --fp-calls <work>/sa/gen, then A64_HOT_FUNCS=hot_funcs.txt python -I scripts/dev_build.py build on main, and a game run with HOS_FPS_MAX=1000 on the kokiri-start save.

Before: main @ 71b1edd8, no hot list After: main @ 71b1edd8 + the list this PR's --fp-calls 0.79 writes
fps, median of 5 (mirrored order) 90.11 91.59
CPU ms a frame, median of 5 43.311 42.492
exact permutation p, medians fps 0.381, CPU 0.048
build from scratch (compile phase) 3 min 18 s (135 s) 7 min 13 s (369 s)
hot-chunk C none 25 MB
longshot size 543,806,840 B 547,787,416 B (+0.73 %)

Why the list is small (12 s Market profile: HOS_SAMPLE_ALL, 5,218 samples, 1,137 functions), and what the old time-only cut of the same profile took:

Before: main @ c167ec67, time only (share 0.85) After: this PR @ 0f7a2076, --fp-calls 0.79
functions in the list 441 47
hot-chunk C 72 MB 25 MB
share of samples × FP calls 98 % 79 %
[hos host] vk: 3609 presents, 90.1 fps; a frame: 692 draws (0 skipped), ... (main, no list)
[hos host] vk: 3665 presents, 91.5 fps; a frame: 690 draws (0 skipped), ... (this PR's list)

Flags and settings

None. No game switch is added or changed; the measured list was --fp-calls 0.79 on a Market profile (the tool's default share, 0.85, picks 60 functions on that profile), and no list is shipped, so a build with no list behaves exactly as main.

Testing

Tested: python -I -B tests/test_prof_symbols.py on Linux (the new --fp-calls case cannot pass on main: the option does not exist there); python -I -B tests/run_all.py on Linux, 586 passed, 17 failed, 74 skipped — all 17 also fail on main @ 71b1edd8 (test_audio_output_devices, test_bug_report, test_bug_report_defaults, test_crt_options, test_dlss_feature_size, test_failed_compile_keeps_objects, test_guest_imported, test_hardware_report, test_linux_preflight, test_linux_update, test_make_game_cache, test_missing_nup, test_mods_size_table, test_pending_guest_import, test_run_all_changed, test_vk_occlusion_queries, test_walk_key). The in-game numbers above, with a list this tool wrote, on Linux/RADV.

Not tested: the time-only default list (no comparison against it was run); Windows (the tool reads only the lift's C and a sample file); a profile taken in a scene other than the Market (the list was measured in Kokiri).

Must be tested: None.

Risks

What could break: only when the option is used: a poorly chosen list makes the hot chunk bigger and slower to compile. It cannot change what the game computes.

Turning it off: don't pass --fp-calls (the old behaviour is unchanged), or revert the commit.

Compatibility: Nothing changes for a player: no switch is added to the game, no list is shipped, and a build with no list translates exactly as main does.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched for hotlist, A64_HOT_FUNCS, hot_funcs, always_inline; nothing fits).
  • Measurements has a verdict.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main (71b1edd8).
  • python -I -B tests/run_all.py passes (the 17 that fail also fail on main, named above).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • Switches documented (docs/development.md); no game switch is added.
  • A game-free test added for the change, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened (tests/test_prof_symbols.py).
  • Docs updated.
**Type:** perf · **Risk:** low · **Tested on:** Linux, RX 9070 XT (RADV) · **Needs:** none ## Why The lift can compile a chosen list of lifted functions together at `-O2` with the FP helpers' fast paths inlined (`A64_HOT_FUNCS` + `A64_HOT_CHUNK=1`, `code_hot.c`). `scripts/hotlist.py` chose that list by **sample time alone**, which is the wrong measure for what the list is for: the inlining pays per *call to `a64_fpx_*` that goes away, so a function worth listing is one that runs often **and** holds many of those calls. The time-only cut also keeps functions with no FP call at all — the hot chunk compiles them for `-O2` alone. On a 12 s Market profile the time-only cut at 0.85 takes 441 functions and 80 MB of hot-chunk C; ranking by samples × FP calls reaches most of the same FP work with 47 functions and 25 MB. ## What changed `scripts/hotlist.py` gains `--fp-calls <gen>`: with the lift's own C folder it counts each lifted function's scalar `a64_fpx_*` call sites (one definition per function, its body ending where the next begins) and ranks by *samples × calls*, cutting at `<share>` of that total. The summary line names the weighted share. Without the flag nothing changes; the Zstd decoder is appended as before. - `scripts/hotlist.py`: `--fp-calls`, the ranking, the summary line. - `tests/test_prof_symbols.py`: a function that is the innermost frame of 2 samples and holds an FP call beats one sampled 8 times without one; the weighted summary is printed; the Zstd decoder is still appended. - `docs/development.md`: the `A64_HOT_FUNCS` row, which was missing from the build switches. The list itself is **not** committed: it is lifted function addresses from a profile of one PC, regenerated per lift (`A64_HOT_FUNCS` is in the lift key, so a build given a list is translated again). ## Measurements **Verdict:** on current `main`, a build using the list this PR's tool writes measures **+1.64 % fps** (median of 5; exact permutation p = 0.381, the ranges overlap) and **-1.89 % CPU** (p = 0.048, the ranges only touch) against main's own build, for **+3 min 55 s of a cold build** (3:18 to 7:13) and **+0.73 % exe size**. The same list measured +2.95 % fps and -2.91 % CPU on the previous base (`c167ec67`); main has since taken `always_inline` header helpers (#1002) and light `-O1` passes, which appear to have taken part of that gain and to have made the hot piece the long pole of the compile. So: the tool is useful and its list is small, but the advantage is smaller on today's main than when it was found, and a build that uses a list pays several minutes for it. **Baseline:** the "Before" column is `main` itself (`71b1edd8`), built from scratch on this PC in this session. The "After" column is the same commit's source built with the list `scripts/hotlist.py --fp-calls 0.79` writes: this PR changes only a script, so the game code is identical and the hot list is the whole difference. Hardware: Linux, AMD Ryzen 9 9950X3D (32 threads), RX 9070 XT, RADV (Mesa). Scene: Kokiri Forest at Link's house, the repo save `kokiri-start`, standing still; headless, 1920x1080, the game's own upscaler, V-Sync off, frame generation off, `HOS_FPS_MAX=1000`, FPS counter off. Method: both builds from the same checkout, `dev_build.py build` with the object and translation stores off and no shader preparation, so each is a cold lift and full compile; one warm-up run per build, then ten arms through the PC's queue (`--mode timing`) in the mirrored sequence `A B B A A B B A A B`, 40 s each; fps = frames / wall time from the control bridge's counter, CPU = `/proc/<pid>/stat` utime+stime per frame; medians, and an exact permutation test on the difference of medians. How to reproduce: `RX_MAPS=<the profile's build> python -I scripts/hotlist.py <HOS_SAMPLE_ALL file> hot_funcs.txt 0.79 1500 --fp-calls <work>/sa/gen`, then `A64_HOT_FUNCS=hot_funcs.txt python -I scripts/dev_build.py build` on `main`, and a game run with `HOS_FPS_MAX=1000` on the `kokiri-start` save. | | Before: main @ 71b1edd8, no hot list | After: main @ 71b1edd8 + the list this PR's `--fp-calls 0.79` writes | |---|---|---| | fps, median of 5 (mirrored order) | 90.11 | 91.59 | | CPU ms a frame, median of 5 | 43.311 | 42.492 | | exact permutation p, medians | | fps 0.381, CPU 0.048 | | build from scratch (compile phase) | 3 min 18 s (135 s) | 7 min 13 s (369 s) | | hot-chunk C | none | 25 MB | | `longshot` size | 543,806,840 B | 547,787,416 B (+0.73 %) | **Why the list is small** (12 s Market profile: `HOS_SAMPLE_ALL`, 5,218 samples, 1,137 functions), and what the old time-only cut of the same profile took: | | Before: main @ c167ec67, time only (share 0.85) | After: this PR @ 0f7a2076, `--fp-calls` 0.79 | |---|---|---| | functions in the list | 441 | 47 | | hot-chunk C | 72 MB | 25 MB | | share of samples × FP calls | 98 % | 79 % | ``` [hos host] vk: 3609 presents, 90.1 fps; a frame: 692 draws (0 skipped), ... (main, no list) [hos host] vk: 3665 presents, 91.5 fps; a frame: 690 draws (0 skipped), ... (this PR's list) ``` ### Flags and settings None. No game switch is added or changed; the measured list was `--fp-calls 0.79` on a Market profile (the tool's default share, 0.85, picks 60 functions on that profile), and no list is shipped, so a build with no list behaves exactly as `main`. ## Testing **Tested:** `python -I -B tests/test_prof_symbols.py` on Linux (the new `--fp-calls` case cannot pass on `main`: the option does not exist there); `python -I -B tests/run_all.py` on Linux, 586 passed, 17 failed, 74 skipped — all 17 also fail on `main @ 71b1edd8` (`test_audio_output_devices`, `test_bug_report`, `test_bug_report_defaults`, `test_crt_options`, `test_dlss_feature_size`, `test_failed_compile_keeps_objects`, `test_guest_imported`, `test_hardware_report`, `test_linux_preflight`, `test_linux_update`, `test_make_game_cache`, `test_missing_nup`, `test_mods_size_table`, `test_pending_guest_import`, `test_run_all_changed`, `test_vk_occlusion_queries`, `test_walk_key`). The in-game numbers above, with a list this tool wrote, on Linux/RADV. **Not tested:** the time-only default list (no comparison against it was run); Windows (the tool reads only the lift's C and a sample file); a profile taken in a scene other than the Market (the list was measured in Kokiri). **Must be tested:** None. ## Risks **What could break:** only when the option is used: a poorly chosen list makes the hot chunk bigger and slower to compile. It cannot change what the game computes. **Turning it off:** don't pass `--fp-calls` (the old behaviour is unchanged), or revert the commit. **Compatibility:** Nothing changes for a player: no switch is added to the game, no list is shipped, and a build with no list translates exactly as `main` does. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched for `hotlist`, `A64_HOT_FUNCS`, `hot_funcs`, `always_inline`; nothing fits). - [x] Measurements has a verdict. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main` (71b1edd8). - [x] `python -I -B tests/run_all.py` passes (the 17 that fail also fail on `main`, named above). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] Switches documented (`docs/development.md`); no game switch is added. - [x] A game-free test added for the change, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened (`tests/test_prof_symbols.py`). - [x] Docs updated.
perf(scripts): hotlist.py can rank a hot list by the FP helper calls it inlines, not by sample time alone
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
0f7a20767e
A listed hot function's scalar FP ops are the ones the hot flags replace with the helpers' inline fast paths
(a64_fpx_hot_*): no call, and no guest-register spill around it. Its worth is therefore how often it runs times
how many of those calls it holds, which is not its share of the samples.

Measured on a 12 s Market profile (Linux, RX 9070 XT, RADV, main c167ec67): the time-only cut at 0.85 took 441
functions and 80 MB of hot chunk for 98% of that FP work; 47 functions and 25 MB (--fp-calls 0.79, with the Zstd
decoder hotlist.py always appends) reached 79% of it and measured +2.95% fps (median, 9 interleaved runs a side,
exact permutation p = 0.027) and -2.91% CPU (p = 0.003) against the same build with no list, at +0.83% exe size.
The time-only list was not measured, so this does not claim to beat the default: it is the smaller list that pays.

The rating reads the lift's own C (one definition per function), so a hot list now wants the gen folder of the
lift it is for. Without --fp-calls nothing changes.

scripts/hotlist.py: --fp-calls <gen>, the ranking, and the summary line it prints.
tests/test_prof_symbols.py: a function that is the innermost frame of 2 samples and holds an FP call beats one
sampled 8 times without one, the weighted summary is printed, and the Zstd decoder is still appended.
docs/development.md: the A64_HOT_FUNCS row, which was missing from the build switches.

Assisted-by: DeepSeek Harness
Marcuss2 changed title from WIP: perf(scripts): hotlist.py ranks a hot list by the FP helper calls it inlines to perf(scripts): hotlist.py ranks a hot list by the FP helper calls it inlines 2026-11-16 12:12:07 +00:00
Owner

Please include build time measurements, because I had looked at this (I made an issue) and I was able to get the 3% faster CPU but build time was 19% more

Please include build time measurements, because I had looked at this (I made an issue) and I was able to get the 3% faster CPU but build time was 19% more
Author
Contributor

Measured the from-scratch build time of the two lists (same checkout, , object and translation stores off, no shader preparation, two runs each, mirrored order old/new/old/new):\n\n| | Before: time-only list (441 functions) | After: --fp-calls list (47 functions) |\n|---|---|---|\n| build, median of 2 | 7 min 37 s (7:30, 7:44) | 7 min 02 s (7:06, 6:58) |\n| compile phase | 391 s | 357 s |\n| lift phase | 53 s | 52 s |\n| hot-chunk C | 72 MB | 25 MB |\n| longshot | 541,310,296 B | 537,922,424 B (-0.63 %) |\n\nThe whole difference is in the compile (the lift is the same): the smaller hot chunk saves ~35 s (-7.6 %) of a cold build on this 32-thread PC, because the hot piece compiles alongside the other chunks rather than on its own. So the list's gain is code size and the hot piece's compile on fewer cores, not a build-time win on a big machine — the description now says that.

Measured the from-scratch build time of the two lists (same checkout, , object and translation stores off, no shader preparation, two runs each, mirrored order old/new/old/new):\n\n| | Before: time-only list (441 functions) | After: --fp-calls list (47 functions) |\n|---|---|---|\n| build, median of 2 | 7 min 37 s (7:30, 7:44) | 7 min 02 s (7:06, 6:58) |\n| compile phase | 391 s | 357 s |\n| lift phase | 53 s | 52 s |\n| hot-chunk C | 72 MB | 25 MB |\n| longshot | 541,310,296 B | 537,922,424 B (-0.63 %) |\n\nThe whole difference is in the compile (the lift is the same): the smaller hot chunk saves ~35 s (-7.6 %) of a cold build on this 32-thread PC, because the hot piece compiles alongside the other chunks rather than on its own. So the list's gain is code size and the hot piece's compile on fewer cores, not a build-time win on a big machine — the description now says that.
Author
Contributor

Clarified the binary sizes, which are relative to two different baselines: the build-time table compared the two lists (the new one is 0.63% smaller), while the 0.83% figure is against the build with no list. All three, exact (each build is bit-identical, same sha256):\n\n| build | longshot | against no list |\n|---|---|---|\n| no list | 533,476,168 B | - |\n| this PR's list (47 functions) | 537,922,424 B | +0.83% |\n| time-only list (441 functions) | 541,310,296 B | +1.47% |\n\nBoth lists are bigger than no list because a hot call site becomes a gate and an SSE op inline (about 190 bytes) instead of a call; the old list inlines about twice as many sites, so it grows more. The description says this now.

Clarified the binary sizes, which are relative to two different baselines: the build-time table compared the two lists (the new one is 0.63% smaller), while the 0.83% figure is against the build with **no** list. All three, exact (each build is bit-identical, same sha256):\n\n| build | longshot | against no list |\n|---|---|---|\n| no list | 533,476,168 B | - |\n| this PR's list (47 functions) | 537,922,424 B | +0.83% |\n| time-only list (441 functions) | 541,310,296 B | +1.47% |\n\nBoth lists are bigger than no list because a hot call site becomes a gate and an SSE op inline (about 190 bytes) instead of a call; the old list inlines about twice as many sites, so it grows more. The description says this now.
Author
Contributor

Re-measured against itself (), as asked: both builds from scratch on the same checkout (stores off, no shader preparation), one warm-up each, then the ten-arm mirrored A/B.\n\n| | main @ 71b1edd8, no list | main @ 71b1edd8 + this PR's list |\n|---|---|---|\n| fps, median of 5 | 90.11 | 91.59 (+1.64%, p = 0.381) |\n| CPU ms a frame, median of 5 | 43.311 | 42.492 (-1.89%, p = 0.048) |\n| build from scratch | 3 min 18 s (compile 135 s) | 7 min 13 s (compile 369 s) |\n| longshot | 543,806,840 B | 547,787,416 B (+0.73%) |\n\nTwo things changed against the earlier write-up, and the description now says so: on today's main the same list is worth about half the fps it was on (2.95% then, 1.64% now, and not separable from noise at 5 + 5), and the build cost is now the long pole — main's own compile has become fast enough (135 s) that the 25 MB hot piece at (369 s) doubles the build instead of hiding behind the chunks.\n\nThe CPU saving is still the part that holds up: the slowest list run (42.889) is below the fastest main run's median (43.311), p = 0.048.

Re-measured against itself (), as asked: both builds from scratch on the same checkout (stores off, no shader preparation), one warm-up each, then the ten-arm mirrored A/B.\n\n| | main @ 71b1edd8, no list | main @ 71b1edd8 + this PR's list |\n|---|---|---|\n| fps, median of 5 | 90.11 | 91.59 (+1.64%, p = 0.381) |\n| CPU ms a frame, median of 5 | 43.311 | 42.492 (-1.89%, p = 0.048) |\n| build from scratch | 3 min 18 s (compile 135 s) | 7 min 13 s (compile 369 s) |\n| longshot | 543,806,840 B | 547,787,416 B (+0.73%) |\n\nTwo things changed against the earlier write-up, and the description now says so: on today's main the same list is worth about half the fps it was on (2.95% then, 1.64% now, and not separable from noise at 5 + 5), and the build cost is now the long pole — main's own compile has become fast enough (135 s) that the 25 MB hot piece at (369 s) doubles the build instead of hiding behind the chunks.\n\nThe CPU saving is still the part that holds up: the slowest list run (42.889) is below the fastest main run's median (43.311), p = 0.048.
Author
Contributor

Typo: 'the an advantage' -> 'the advantage'.

Typo: 'the an advantage' -> 'the advantage'.
Author
Contributor

Build-budget data from the follow-up workstreams (relevant to this PR's ranking):\n\n- The list this tool writes at share 0.79 (47 functions, 25 MB of hot C) builds in 3 min 17 s from scratch once the giant hot function is split at compile time (one line in nx2/build.py, PR #1146: the hot pieces were the only ones without LONGSHOT_SPLIT_GIANTS).\n- Widening the same ranking to share 0.90 (633 functions, 88 MB of hot C) costs only +34 s of build (3:51 vs 3:17) and measured -6.72 % CPU (median of 5, exact permutation p = 0.048) against the 0.79 list, with fps +0.47 % (p = 0.12) in Kokiri — i.e. the extra -O2 coverage buys CPU headroom rather than frames in that scene.\n- Compiling whole chunks at -O2 instead is out of the question: all 88 chunks at -O2 is 23 min 25 s from scratch (compile 22:25, 9.6x the chunk CPU) against 3:29, so the cheap way to spend build time on -O2 is a longer hot list, not a higher chunk level.\n\nSo a higher default share (0.9) now looks like the better trade for this tool than 0.79; I have not changed the default here — say the word and I will.

Build-budget data from the follow-up workstreams (relevant to this PR's ranking):\n\n- The list this tool writes at share 0.79 (47 functions, 25 MB of hot C) builds in 3 min 17 s from scratch once the giant hot function is split at compile time (one line in nx2/build.py, PR #1146: the hot pieces were the only ones without LONGSHOT_SPLIT_GIANTS).\n- Widening the same ranking to share 0.90 (633 functions, 88 MB of hot C) costs only **+34 s** of build (3:51 vs 3:17) and measured **-6.72 % CPU** (median of 5, exact permutation p = 0.048) against the 0.79 list, with fps +0.47 % (p = 0.12) in Kokiri — i.e. the extra -O2 coverage buys CPU headroom rather than frames in that scene.\n- Compiling whole chunks at -O2 instead is out of the question: all 88 chunks at -O2 is 23 min 25 s from scratch (compile 22:25, 9.6x the chunk CPU) against 3:29, so the cheap way to spend build time on -O2 is a longer hot list, not a higher chunk level.\n\nSo a higher default share (0.9) now looks like the better trade for this tool than 0.79; I have not changed the default here — say the word and I will.
Author
Contributor

Following up on the build-time question you raised (you measured +19 % on a profile-built list): the cost was never the list as such — it was one translation unit. In a 47-function list, is the single lifted function (4.79 MB of C), and at the hot flags it took 323 s of a 389 s build. The lifted chunks already split such giants at compile time (); the hot pieces did not. With that one line (PR #1146), on this PC, from scratch, stores off, same 47-function list:\n\n| | no list | 47-function list, hot pieces unsplit | 47-function list, hot pieces split (#1146) |\n|---|---|---|---|\n| build | 3:18 | 6:29 | 3:09 |\n| compile phase | 135 s | 331 s | 132 s |\n| | — | 323.0 s / 1.7 GB peak RSS | 54.0 s / 0.4 GB peak RSS |\n\nSo the list's build cost is now zero relative to no list, and more of it is cheap too: widening the same ranking from 0.79 to 0.90 share (47 -> 633 functions, 25 -> 88 MB of hot C) builds in 3:51 (+34 s) and measured -6.72 % CPU (p = 0.048) against the 47-function list in Kokiri, with fps +0.47 % there (p = 0.12 — that scene is not CPU-bound).\n\nFor contrast, spending the same budget on whole chunks at does not work: all 88 chunks at is 23:25 from scratch (9.6x the chunk CPU) against 3:29 (PR #1180, evidence only, WIP).

Following up on the build-time question you raised (you measured +19 % on a profile-built list): the cost was never the list as such — it was **one translation unit**. In a 47-function list, is the single lifted function (4.79 MB of C), and at the hot flags it took 323 s of a 389 s build. The lifted chunks already split such giants at compile time (); the hot pieces did not. With that one line (PR #1146), on this PC, from scratch, stores off, same 47-function list:\n\n| | no list | 47-function list, hot pieces unsplit | 47-function list, hot pieces split (#1146) |\n|---|---|---|---|\n| build | 3:18 | 6:29 | **3:09** |\n| compile phase | 135 s | 331 s | 132 s |\n| | — | 323.0 s / 1.7 GB peak RSS | 54.0 s / 0.4 GB peak RSS |\n\nSo the list's build cost is now zero relative to no list, and more of it is cheap too: widening the same ranking from 0.79 to 0.90 share (47 -> 633 functions, 25 -> 88 MB of hot C) builds in 3:51 (+34 s) and measured **-6.72 % CPU** (p = 0.048) against the 47-function list in Kokiri, with fps +0.47 % there (p = 0.12 — that scene is not CPU-bound).\n\nFor contrast, spending the same budget on whole chunks at does not work: all 88 chunks at is 23:25 from scratch (9.6x the chunk CPU) against 3:29 (PR #1180, evidence only, WIP).
Marcuss2 changed title from perf(scripts): hotlist.py ranks a hot list by the FP helper calls it inlines to WIP: perf(scripts): hotlist.py ranks a hot list by the FP helper calls it inlines 2026-11-16 17:18:02 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/hotlist-fp-ranking:Marcuss2-perf/hotlist-fp-ranking'
git switch 'Marcuss2-perf/hotlist-fp-ranking'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1124
No description provided.