fix(vk): the first start of the game after a preparation builds the listed pipelines itself #2865

Closed
github-sync wants to merge 1 commit from github/pr/2865 into main
Owner

@hckrman101 opened this pull request on GitHub · 2026-11-12 17:55 UTC · original
Merged on GitHub in 3723fd0b49

After #2760, programs are loaded when the game creates them (where the GPU has mesh shaders), and their pipelines come from the caches alone once hookshot_pipelines.bin.built says they are there. A --prepare-shaders run wrote that marker after building the listed pipelines in its own process. If the play that follows is not answered from that work, the session compiles its pipelines in play, with draws left out until each is ready.

This makes the first start of the game after a preparation build the listed pipelines itself (before the title), and write the marker then: the preparation no longer writes it. One line in precompile_built_write.

Measured

RTX 3090, NVIDIA 620.70, Linux, a fresh folder (build, --prepare-shaders, then a new game), default options, played by hand for 1.5-3.5 minutes:

main (86a9cda2 with main) this change
graphics pipelines the loads at create asked for and found in no cache 4,718 0
draws and dispatches left out 46,026 40
waits for shaders or pipelines 29 (3.5 s; single frames of 2.0 and 1.5 s) 0
pipelines compiled in play 373 10
compute pipelines in no cache 666 490

How far this result goes, read this before merging:

  • In both runs the preparation used a different NVIDIA driver shader cache folder (a test queue's private one) than the play that followed (the user's own, nearly empty: 2 MB). So the play process could not have the preparation's compiles in the driver's cache. That is the state after a driver update or a cleared driver cache, not a normal Builder preparation, where both share one cache. Whether a normal preparation on NVIDIA is answered in play on main is not yet known; it is being tested. On an RX 580 (RADV) a preparation followed by play was answered.
  • With this change the first start compiled all 25,337 listed pipelines in the play process in 166 s (cold driver cache) before the title. With a driver cache that holds the preparation's work this build took 11-15 s in earlier runs.
  • The compute pipelines are not covered: 490 were still in no cache, and the 10 compiles and 40 left-out draws are most likely those.

Tests

None added; tests/test_warm_bounded.py and the other touched tests were not rerun on this commit. Built and played once, as above. CI decides.

Follow-up (being prepared)

  • At a start in create mode, ask the caches for a sample of the listed pipelines and build before the title when they do not answer (a driver update, a cleared cache), instead of trusting the marker.
  • Compute pipelines in that build.
  • The safety net of #2760 counts waits for loads only: it should also count draws left out for a pipeline that was not ready and waits for pipelines (it did not fire in the 46,026 run).
> [@hckrman101](https://github.com/hckrman101) opened this pull request on GitHub · 2026-11-12 17:55 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2865) > **Merged on GitHub** in https://git.magicbean.dev/MagicBeanDev/Hookshot/commit/3723fd0b49488bf4f05e693cdfc15bbc5b020c7a After #2760, programs are loaded when the game creates them (where the GPU has mesh shaders), and their pipelines come from the caches alone once `hookshot_pipelines.bin.built` says they are there. A `--prepare-shaders` run wrote that marker after building the listed pipelines in its own process. If the play that follows is not answered from that work, the session compiles its pipelines in play, with draws left out until each is ready. This makes the first start of the game after a preparation build the listed pipelines itself (before the title), and write the marker then: the preparation no longer writes it. One line in `precompile_built_write`. ## Measured RTX 3090, NVIDIA 620.70, Linux, a fresh folder (build, `--prepare-shaders`, then a new game), default options, played by hand for 1.5-3.5 minutes: | | main (86a9cda2 with main) | this change | |---|---|---| | graphics pipelines the loads at create asked for and found in no cache | 4,718 | 0 | | draws and dispatches left out | 46,026 | 40 | | waits for shaders or pipelines | 29 (3.5 s; single frames of 2.0 and 1.5 s) | 0 | | pipelines compiled in play | 373 | 10 | | compute pipelines in no cache | 666 | 490 | **How far this result goes, read this before merging:** - In both runs the preparation used a different NVIDIA driver shader cache folder (a test queue's private one) than the play that followed (the user's own, nearly empty: 2 MB). So the play process could not have the preparation's compiles in the driver's cache. That is the state after a driver update or a cleared driver cache, **not** a normal Builder preparation, where both share one cache. Whether a normal preparation on NVIDIA is answered in play on main is **not yet known**; it is being tested. On an RX 580 (RADV) a preparation followed by play was answered. - With this change the first start compiled all 25,337 listed pipelines in the play process in **166 s** (cold driver cache) before the title. With a driver cache that holds the preparation's work this build took 11-15 s in earlier runs. - The compute pipelines are not covered: 490 were still in no cache, and the 10 compiles and 40 left-out draws are most likely those. ## Tests None added; `tests/test_warm_bounded.py` and the other touched tests were not rerun on this commit. Built and played once, as above. CI decides. ## Follow-up (being prepared) - At a start in create mode, ask the caches for a sample of the listed pipelines and build before the title when they do not answer (a driver update, a cleared cache), instead of trusting the marker. - Compute pipelines in that build. - The safety net of #2760 counts waits for loads only: it should also count draws left out for a pipeline that was not ready and waits for pipelines (it did not fire in the 46,026 run). <!-- github-sync:item:2865 -->
RX_VK_LOAD=create takes its pipelines from the caches alone, once hookshot_pipelines.bin.built says they are there. A
--prepare-shaders run wrote that marker after building the listed pipelines into the pipeline cache in its own process.
Where the play that follows is not answered from that work (RTX 3090, the preparation and the play with different driver
shader caches: 4,718 graphics pipelines in no cache, 46,026 draws left out, 3.5 s of pipeline waits in one session), the
session compiled its pipelines in play. The preparation no longer writes the marker, so the first start of the game builds
the listed pipelines before the title and writes it: the same sequence then had 0 graphics pipelines in no cache, 40 draws
left out and no pipeline wait.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-sync closed this pull request 2026-11-12 19:03:00 +00:00
Commenting is not possible because the repository is archived.
No description provided.