perf(vk): log GPL availability for stage-library A/B #2729

Open
github-sync wants to merge 5 commits from github/pr/2729 into main
Owner

@yeetbot90 opened this pull request on GitHub · 2026-11-12 09:36 UTC · original

> [@yeetbot90](https://github.com/yeetbot90) opened this pull request on GitHub · 2026-11-12 09:36 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2729) ## Summary - At device start, log `vk: GPL: available|on|off` with the reason (fast-link, EDS3 bits, `RX_VK_GPL`). - Document `RX_VK_GPL` / `RX_VK_GPL_SYNC` / `RX_VK_GPL_NO_CACHE` and how to A/B using the present-line library stats. Measure-only (default still off). Live AMD RX 9070 XT already reports `pipeline libraries yes`. ## Test plan - [x] `python -I -B tests/test_gpl_status_log.py` - [x] CI: Python source checks green on Windows + Ubuntu (all four jobs). - [x] Rebuild tip `hookshot_vk.dll` into `D:\Hookshot_OOT` - [x] `--prepare-shaders` without `RX_VK_GPL`: `vk: GPL: available (set RX_VK_GPL=1 to A/B stage-library links; ask-only yes)` - [x] With `RX_VK_GPL=1`: `vk: GPL: on (stage libraries + link; ask-only yes)`; prepare then warms stage libraries (`warming stage libraries on N workers`) - [x] Present-line library stats on AMD RX 9070 XT / Windows, RX_VK_GPL=1, in play past 1000 presents: `vk: GPL: on (stage libraries + link; ask-only yes)` and `later in the same session, 23000 presents at about 120 fps: 160 libraries the driver had and 1582 cold, all 1582 built by workers (532807 ms)` Made with [Cursor](https://cursor.com) <!-- github-sync:item:2729 -->
Centralize pool sizing in prepare_pool_workers so HOOKSHOT_SHADER_WORKERS /
RX_VK_PREPARE_WORKERS can A/B fewer threads when RAM is tight, without changing
the default half/usable/background sizes. Log a one-line CPU and RAM snapshot
at prepare start.

Co-authored-by: Cursor <[email protected]>
Cap auto-sized prepare pools by available RAM when HOOKSHOT_PREPARE_RAM_GUARD
is on, and always force a tiny pool under ~2 GB so a prepare does not thrash.
Explicit worker overrides still win for A/B.

Co-authored-by: Cursor <[email protected]>
Add scripts/prepare_workers_bench.py to A/B HOOKSHOT_SHADER_WORKERS via
--prepare-shaders and write hookshot_prepare_workers.txt. Honour that file
when no env override is set, and log process working-set / peak on the
prepare resources line for those runs.

Co-authored-by: Cursor <[email protected]>
Print whether graphics pipeline libraries can be turned on (and what is
missing) at device start, and document RX_VK_GPL for Part 3 measurement.

Co-authored-by: Cursor <[email protected]>
test_prepare_stall's predict harness needed PreparePool / prepare_pool_workers /
prepare_resources_log after the override wiring. The pool-workers check now
stubs prepare_ram_mb (shared fake avail on Windows and Linux) and compiles with
_CRT_SECURE_NO_WARNINGS so getenv is not an error under MSVC headers.

Co-authored-by: Cursor <[email protected]>
Author
Owner

@Joey-Magnus requested changes on GitHub · 2026-11-12 14:34 UTC · original

This branch is #2725, #2727 and #2728 plus ef1d5289, so it's the one to review. I merged it into current main and ran tests/run_all.py --jobs 4: 428 pass, and the only failure is test_lift_cache.py, which fails on main here too. Before it can go in:

  • The override and the workers file also resize the in-play background pool. gpu/vk/vk_progcache.cpp:770 and :775 return before the PreparePool::Background branch at :778, so HOOKSHOT_SHADER_WORKERS=24 (or a bench-written file) means 24 translation threads in gameplay. The docs say "no gameplay change". Apply the override only to the Translate/Pipelines pools.
  • Env values are read with getenv/atoi/atof (:678, :770 and the reserve helpers). Please use env_int. Also, HOOKSHOT_SHADER_WORKERS=0 or a typo currently forces 1 worker; it should mean auto.
  • The <2 GB "RAM low" cap at :807 is on by default for everyone. That needs a maintainer decision and a measurement.
  • The GPL status log (vk_main.cpp:1478) has nothing to do with worker counts, and it copies gpl_wanted()'s condition instead of calling it. Please move it to its own PR off main.
  • The description should open with why.
> [@Joey-Magnus](https://github.com/Joey-Magnus) requested changes on GitHub · 2026-11-12 14:34 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2729#pullrequestreview-5876241563) This branch is #2725, #2727 and #2728 plus ef1d5289, so it's the one to review. I merged it into current main and ran tests/run_all.py --jobs 4: 428 pass, and the only failure is test_lift_cache.py, which fails on main here too. Before it can go in: - The override and the workers file also resize the in-play background pool. gpu/vk/vk_progcache.cpp:770 and :775 return before the `PreparePool::Background` branch at :778, so `HOOKSHOT_SHADER_WORKERS=24` (or a bench-written file) means 24 translation threads in gameplay. The docs say "no gameplay change". Apply the override only to the Translate/Pipelines pools. - Env values are read with getenv/atoi/atof (:678, :770 and the reserve helpers). Please use `env_int`. Also, `HOOKSHOT_SHADER_WORKERS=0` or a typo currently forces 1 worker; it should mean auto. - The <2 GB "RAM low" cap at :807 is on by default for everyone. That needs a maintainer decision and a measurement. - The GPL status log (vk_main.cpp:1478) has nothing to do with worker counts, and it copies `gpl_wanted()`'s condition instead of calling it. Please move it to its own PR off main. - The description should open with why. <!-- github-sync:r:5876241563 -->
Commenting is not possible because the repository is archived.
No description provided.