perf(vk): warm listed compute pipelines on Most #1567

Merged
HumanBean merged 1 commit from HumanBean/Longshot:perf/listed-compute-preparation into main 2026-11-18 08:32:43 +00:00
Owner

Type: perf · Risk: medium · Tested on: CachyOS Linux, RTX 3090 · Needs: Windows and AMD gameplay coverage

TL;DR

A fresh installation using Most now asks the graphics driver to build compute pipelines seen in gameplay. In the first cold comparison, the shader-program phase fell from 226.8 seconds to 128.7 seconds. Both runs translated the full seed and retained every compute shader variant.

Breakdown

  • Who it helps: Players preparing shaders on a new install with the default Most setting.
  • What was wrong: The driver compiled thousands of compute variants for programs absent from the gameplay lists.
  • What changes: Both compute warming passes use the shipped and locally learned programs.
  • What does not change: The translator still produces the full seed and all its texture variants.
  • How it was checked: The real game executable ran with empty Longshot and NVIDIA caches on an RTX 3090.
  • What is still open: End-to-end cold repetitions and cross-vendor gameplay coverage.
  • Risk: Medium. An unlisted compute program can pay driver compilation time at its first dispatch.

Why

Most already builds graphics pipelines based on gameplay observations. A first preparation nevertheless asked the driver for 9,927 compute pipelines. The narrower selection already has precedent on Mesa Intel in #426.

What changed

  • The seed warm and the later pipeline warm in gpu/vk/vk_draw.cpp share the same compute selection. Every translated texture variant of a selected program is warmed.
  • The existing switch overrides the default. An empty gameplay list falls back to the full set. All preserves broad driver warming outside the existing Mesa Intel exception.
  • The play process records which compute set it warmed. The Builder checks that record before reusing it for a different list or an upgrade to All. Legacy two-word markers are still readable.
  • Updated the source-based checks for inline and separate warming, selection precedence, list changes and upgrading Most to All.

Measurements

Verdict: The first cold run saved 98.1 s (43.3%) in the shader-program phase. Total cold preparation took 516.7 s on main and 453.7 s on the change (63.0 s, 12.2% faster). The queue flagged system CPU pressure on the changed run. Treat this pair as preliminary while the interleaved repetitions run.

Hardware: AMD Ryzen 9 7900X, 32 GB RAM, GeForce RTX 3090, NVIDIA 620.70.06, CachyOS Linux.

Scene: Builder shader preparation for a fresh install, offscreen, before the title.

Method: One cold probe per side. Separate empty application and driver caches, same local game seed and shipped state list, same base packs, exclusive timing queue and 12 usable CPU threads. Wall time is the shell timer around the game, excluding queue time. The graphics and final compute pass took 288.8 s on main and 323.2 s on the changed run.

How to reproduce: In a private runtime with empty game and driver caches, run ./longshot --prepare-shaders --compile-shaders most under scripts/job_queue.py run <name> --mode timing. Compare the vk: prepared summaries.

Before: main @ 7daafa7a After: this PR @ 1deb9770
Entire cold preparation, wall time 516.7 s 453.7 s
Noted graphics pipelines built 32,655 32,655
Shader-program phase, cold probe 226.8 s 128.7 s
Compute pipelines warmed during translation 9,927 3,656
Compute variants translated 9,927 9,927
Seed programs / failures 38,809 / 0 38,809 / 0

Flags and settings

Flag What it is Before this PR After this PR Effect Helps / untested Recommendation
RX_VK_COMPILE_SHADERS=most Builder's default level All compute programs warmed on a fresh NVIDIA install Listed compute programs warmed 6,271 fewer driver compiles in the seed pass here Tested on Linux NVIDIA Keep Most as the default
RX_VK_PRECOMPILE_COMPUTES Compute selection override Warming during translation ignored it outside the separate warm pass Both warm passes honor it all restores full compute coverage Policy and list selection checked locally Leave unset for the chosen level

Testing

Tested: The game's actual shader preparation on NVIDIA/Linux. Focused tests exercise both warming paths, overrides and marker compatibility. The initial full suite reported 35 failures on both the branch and main. Rechecking with the build toolchain and Vulkan headers.

Not tested: Windows, AMD, Intel hardware and first-use latency for an unlisted dispatch.

Must be tested:

  • Windows or Linux AMD and Windows NVIDIA: prepare from empty caches on Most, load a save, then visit areas outside the tour and check for first-dispatch stalls.

Risks

What could break: A compute program missing from the shipped and learned lists must create its driver pipeline on first dispatch. Its translated shader remains available.

Turning it off: Set RX_VK_PRECOMPILE_COMPUTES=all when preparing and launching.

Compatibility: Existing translated program caches and graphics pipeline notes remain readable. A Builder rechecks older warm markers when their compute coverage is unknown.

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).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • 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; the README for a menu row) and shipped at their recommended value.
  • A file in docs/tested/ for each new measured run (format in docs/tested-configurations.md).
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
**Type:** perf · **Risk:** medium · **Tested on:** CachyOS Linux, RTX 3090 · **Needs:** Windows and AMD gameplay coverage ## TL;DR A fresh installation using **Most** now asks the graphics driver to build compute pipelines seen in gameplay. In the first cold comparison, the shader-program phase fell from 226.8 seconds to 128.7 seconds. Both runs translated the full seed and retained every compute shader variant. ## Breakdown - **Who it helps:** Players preparing shaders on a new install with the default Most setting. - **What was wrong:** The driver compiled thousands of compute variants for programs absent from the gameplay lists. - **What changes:** Both compute warming passes use the shipped and locally learned programs. - **What does not change:** The translator still produces the full seed and all its texture variants. - **How it was checked:** The real game executable ran with empty Longshot and NVIDIA caches on an RTX 3090. - **What is still open:** End-to-end cold repetitions and cross-vendor gameplay coverage. - **Risk:** Medium. An unlisted compute program can pay driver compilation time at its first dispatch. ## Why Most already builds graphics pipelines based on gameplay observations. A first preparation nevertheless asked the driver for 9,927 compute pipelines. The narrower selection already has precedent on Mesa Intel in #426. ## What changed - The seed warm and the later pipeline warm in `gpu/vk/vk_draw.cpp` share the same compute selection. Every translated texture variant of a selected program is warmed. - The existing switch overrides the default. An empty gameplay list falls back to the full set. All preserves broad driver warming outside the existing Mesa Intel exception. - The play process records which compute set it warmed. The Builder checks that record before reusing it for a different list or an upgrade to All. Legacy two-word markers are still readable. - Updated the source-based checks for inline and separate warming, selection precedence, list changes and upgrading Most to All. ## Measurements **Verdict:** The first cold run saved 98.1 s (43.3%) in the shader-program phase. Total cold preparation took 516.7 s on main and 453.7 s on the change (63.0 s, 12.2% faster). The queue flagged system CPU pressure on the changed run. Treat this pair as preliminary while the interleaved repetitions run. Hardware: AMD Ryzen 9 7900X, 32 GB RAM, GeForce RTX 3090, NVIDIA 620.70.06, CachyOS Linux. Scene: Builder shader preparation for a fresh install, offscreen, before the title. Method: One cold probe per side. Separate empty application and driver caches, same local game seed and shipped state list, same base packs, exclusive timing queue and 12 usable CPU threads. Wall time is the shell timer around the game, excluding queue time. The graphics and final compute pass took 288.8 s on main and 323.2 s on the changed run. How to reproduce: In a private runtime with empty game and driver caches, run `./longshot --prepare-shaders --compile-shaders most` under `scripts/job_queue.py run <name> --mode timing`. Compare the `vk: prepared` summaries. | | Before: main @ 7daafa7a | After: this PR @ 1deb9770 | |---|---:|---:| | Entire cold preparation, wall time | 516.7 s | 453.7 s | | Noted graphics pipelines built | 32,655 | 32,655 | | Shader-program phase, cold probe | 226.8 s | 128.7 s | | Compute pipelines warmed during translation | 9,927 | 3,656 | | Compute variants translated | 9,927 | 9,927 | | Seed programs / failures | 38,809 / 0 | 38,809 / 0 | ### Flags and settings | Flag | What it is | Before this PR | After this PR | Effect | Helps / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_COMPILE_SHADERS=most` | Builder's default level | All compute programs warmed on a fresh NVIDIA install | Listed compute programs warmed | 6,271 fewer driver compiles in the seed pass here | Tested on Linux NVIDIA | Keep Most as the default | | `RX_VK_PRECOMPILE_COMPUTES` | Compute selection override | Warming during translation ignored it outside the separate warm pass | Both warm passes honor it | `all` restores full compute coverage | Policy and list selection checked locally | Leave unset for the chosen level | ## Testing **Tested:** The game's actual shader preparation on NVIDIA/Linux. Focused tests exercise both warming paths, overrides and marker compatibility. The initial full suite reported 35 failures on both the branch and main. Rechecking with the build toolchain and Vulkan headers. **Not tested:** Windows, AMD, Intel hardware and first-use latency for an unlisted dispatch. **Must be tested:** - Windows or Linux AMD and Windows NVIDIA: prepare from empty caches on Most, load a save, then visit areas outside the tour and check for first-dispatch stalls. ## Risks **What could break:** A compute program missing from the shipped and learned lists must create its driver pipeline on first dispatch. Its translated shader remains available. **Turning it off:** Set `RX_VK_PRECOMPILE_COMPUTES=all` when preparing and launching. **Compatibility:** Existing translated program caches and graphics pipeline notes remain readable. A Builder rechecks older warm markers when their compute coverage is unknown. ## 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). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [ ] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [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. - [ ] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [ ] A file in `docs/tested/` for each new measured run (format in `docs/tested-configurations.md`). - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated.
perf(vk): warm listed compute pipelines on Most while translating the full seed
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 11s
PR description / Description follows the template (pull_request_target) Failing after 5s
1deb9770fd
Assisted-by: OpenAI Codex
Co-Authored-By: OpenAI Codex <[email protected]>
Author
Owner

Tested in game: CachyOS Linux, RTX 3090, NVIDIA 620.70.06: ran the game executable with --prepare-shaders --compile-shaders most from empty Longshot and driver caches. The changed shader-program phase finished in 128.7 s, translating 38,809 programs with zero failures and retaining all 9,927 compute variants.

Tested in game: CachyOS Linux, RTX 3090, NVIDIA 620.70.06: ran the game executable with --prepare-shaders --compile-shaders most from empty Longshot and driver caches. The changed shader-program phase finished in 128.7 s, translating 38,809 programs with zero failures and retaining all 9,927 compute variants.
Author
Owner

Both cold probes reached @@done shaders and built 32,655 noted graphics pipelines. Total wall time was 516.7 s on main and 453.7 s on the change. The timing queue flagged CPU pressure during the changed run, so the description labels this first pair preliminary.

Both cold probes reached @@done shaders and built 32,655 noted graphics pipelines. Total wall time was 516.7 s on main and 453.7 s on the change. The timing queue flagged CPU pressure during the changed run, so the description labels this first pair preliminary.
HumanBean changed title from WIP: perf(vk): warm listed compute pipelines on Most to perf(vk): warm listed compute pipelines on Most 2026-11-18 08:32:38 +00:00
HumanBean deleted branch perf/listed-compute-preparation 2026-11-18 08:32:43 +00:00
Contributor

Data points from a Steam Deck OLED and an RTX 5090. Both are single passes on seeded or warm driver caches, so they're observations, not a measured cold-install speedup.

Steam Deck OLED / RADV, main 430eef4f, Most

  • Prepare: 4 min 53 s wall time.
    • Its shader-program summary was 278.1 s, with 3,622 compute pipelines.
    • The later noted-pipeline/compute cache pass reports 3,622 pipelines from 2,189 compute programs in 6.3 s (compute 1.1 s).
  • The comparable 79d4a143 log: 9,689 computes from 4,059 programs, a 287.1 s shader-program phase and a 10.2 s cache pass.
  • Both started from a seeded 735 MB Mesa driver cache, and both logs report 69 failed shader-program entries. The two logged phase timings aren't summed or treated as the complete build time.
  • First game launch after the prepare:
    • 101.0 s in shader start-up, of which ~89 s was load at create, building the mesh-fallback compute pipelines.
    • Later starts logged 8.9 s, once the resulting pipeline cache had been written.
    • The 79d4a143 control also spent ~89 s in load at create (110.6 s total), so that fallback build was already there before this PR. That does NOT establish that this PR has no start-up or first-dispatch regression.
  • Memory: sampled process RSS on the first 430eef4f launch peaked at 11,208 MiB (about 10.9 GiB). That isn't unique physical or GPU memory.
  • First-dispatch safety is still unqualified:
    • The Field benchmark checks refused measured windows on both revisions because background work and program-census activity occurred. The responsible job wasn't identified, and no complete admitted Field comparison pair was obtained.
    • Kokiri was a settled first measured window after each launch, not a systematic first-dispatch test.
    • Warm driver caches and the absence of sub-threshold compile log lines can't rule out compile stalls on unlisted computes.

Windows / RTX 5090, Most

  • The logs list 3,656 computes from 2,199 programs, against 9,927 from 4,128 before. Both still translated 9,927 compute variants.
  • The shader-program phase logged 53.7 vs 64.3 s, and the separate cache pass 13.4 vs 16.4 s.
  • These were single, unlike passes with unequally warmed shared driver caches and different concurrent load. So only the observed counts and times are reported, not an end-to-end cold speedup or an isolated timing gain for this PR.
Data points from a Steam Deck OLED and an RTX 5090. Both are single passes on seeded or warm driver caches, so they're observations, not a measured cold-install speedup. **Steam Deck OLED / RADV, main `430eef4f`, Most** - **Prepare:** 4 min 53 s wall time. - Its shader-program summary was 278.1 s, with 3,622 compute pipelines. - The later noted-pipeline/compute cache pass reports 3,622 pipelines from 2,189 compute programs in 6.3 s (compute 1.1 s). - **The comparable `79d4a143` log:** 9,689 computes from 4,059 programs, a 287.1 s shader-program phase and a 10.2 s cache pass. - **Both** started from a seeded 735 MB Mesa driver cache, and both logs report 69 failed shader-program entries. The two logged phase timings aren't summed or treated as the complete build time. - **First game launch after the prepare:** - 101.0 s in shader start-up, of which ~89 s was load at create, building the mesh-fallback compute pipelines. - Later starts logged 8.9 s, once the resulting pipeline cache had been written. - The `79d4a143` control also spent ~89 s in load at create (110.6 s total), so that fallback build was already there before this PR. That does NOT establish that this PR has no start-up or first-dispatch regression. - **Memory:** sampled process RSS on the first `430eef4f` launch peaked at 11,208 MiB (about 10.9 GiB). That isn't unique physical or GPU memory. - **First-dispatch safety is still unqualified:** - The Field benchmark checks refused measured windows on both revisions because background work and program-census activity occurred. The responsible job wasn't identified, and no complete admitted Field comparison pair was obtained. - Kokiri was a settled first measured window after each launch, not a systematic first-dispatch test. - Warm driver caches and the absence of sub-threshold compile log lines can't rule out compile stalls on unlisted computes. **Windows / RTX 5090, Most** - The logs list 3,656 computes from 2,199 programs, against 9,927 from 4,128 before. Both still translated 9,927 compute variants. - The shader-program phase logged 53.7 vs 64.3 s, and the separate cache pass 13.4 vs 16.4 s. - These were single, unlike passes with unequally warmed shared driver caches and different concurrent load. So only the observed counts and times are reported, not an end-to-end cold speedup or an isolated timing gain for this PR.
Contributor

Follow-up on the Field admission refusals: the recurring “1 jobs queued” pattern aligns with the renderer’s scheduled glibc heap check/trim (mallinfo2/malloc_trim), which also exists on 544229a2; window alignment explains why it was sampled in some runs and not others. It is not evidence of a newly translated Field shader. Our original admission decisions and exclusions are unchanged; separate program-census refusals remain, so there is still no admitted Field comparison pair.

Follow-up on the Field admission refusals: the recurring “1 jobs queued” pattern aligns with the renderer’s scheduled glibc heap check/trim (`mallinfo2`/`malloc_trim`), which also exists on `544229a2`; window alignment explains why it was sampled in some runs and not others. It is not evidence of a newly translated Field shader. Our original admission decisions and exclusions are unchanged; separate program-census refusals remain, so there is still no admitted Field comparison pair.
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!1567
No description provided.