In-game hitches are pipelines re-created from blobs on title threads (~1,450 per scene); LARP_PIPELINE_WAIT_MS=8 removes the ≥500 ms ones (RX 7700 XT, Linux/RADV) #51

Open
opened 2026-12-05 23:40:52 +00:00 by github-bot · 0 comments
Owner

@⁠Raptorbk45 on GitHub · 2026-12-05 23:36 UTC · original

Summary

In-game hitches that look like "shader compilation" are not compilations: they are graphics pipelines being re-created from their on-disk blob, one at a time, on the title's own threads. With a warm cache each scene re-creates about 1,450 pipelines at ~1.6–2 ms each (longest 16 ms), ~2.4–3 s in total. They pile up mainly at world entry (550–830 re-creations inside the same 5 s window as a 400–900 ms freeze) and at scene cuts (frames of 90–115 ms). Meanwhile the 9 pipeline workers that built everything in the menu sit idle.

Cause, as read in crates/larp-gpu/src/pipeline/make.rs: in the menu every graphics pipeline is built only to write its blob and is then released (the "disk-backed PSO release"). The first draw that uses a released pipeline re-creates it from the blob (CreateGraphicsPipelineState with CachedPSO) on the drawing thread, and since the build knows the title's watchdog, draws wait for every pipeline. Nothing remembers between sessions which pipelines were drawn, so every session pays it again.

LARP_PIPELINE_WAIT_MS=8 (already in the tree, off by default) removes almost all of it with no visible missing draws.

Setup

  • RX 7700 XT 12 GB (RDNA 3, gfx1101), Ryzen 5 5600X, CachyOS, Hyprland.
  • Linux: Proton-CachyOS + vkd3d-proton + RADV (Mesa). Built from source from stable 257438a (amd-4.2) plus part of gamingwithhomie/larp#183 (faces/jaw/FP16 wave sums only, no pipeline changes).
  • Series S preset, ray tracing on (larp default).
  • Scene: the scripted intro from world entry, 180 s (prison → police → title → beach → boat). Automated runner, same inputs every run.
  • Warm caches only (every compared run has the same listed= count and cache_uuid); cold runs discarded.

Measurement

To count this I added a small diagnostic behind an env var (LARP_HITCH_MS=<ms>, no effect when unset): every 5 s it prints pipeline requests on title threads split into created from blob / compiled / waited for a worker (count, total ms, longest), plus one line per request and per frame (present to present) ≥ <ms>. Happy to open a PR with it if useful.

run frames ≥100 / ≥250 / ≥500 ms worst frames ≥100 ms that coincide with requests on title threads fps median
base 1 (VKD3D_DEBUG=fixme) 4 / 2 / 1 507 ms blob 4 blob 1451 (2835 ms), wait 110 (277 ms) 46.6
base 2 6 / 1 / 0 494 ms blob 5, none 1 blob 1562 (3002 ms), wait 124 (332 ms) 39.9
base 3 3 / 2 / 1 881 ms blob 3 blob 1447 (2652 ms), wait 127 (291 ms) 45.6
base 4 5 / 2 / 1 750 ms blob 3, none 2 blob 1470 (2999 ms), wait 114 (312 ms) 46.2
LARP_PIPELINE_WAIT_MS=8 4 / 0 / 0 230 ms wait 3, none 1 blob 5 (8 ms), wait 352 (1144 ms) 44.4
LARP_PIPELINE_WAIT_MS=8 2 / 1 / 0 290 ms wait 2 blob 6 (18 ms), wait 371 (1050 ms) 46.1
  • No pipeline was compiled on a title thread in any run; no creation took ≥ 1 s.
  • vkd3d-proton "Compiling a fallback pipeline late!" with VKD3D_DEBUG=fixme: 0 (late variant compiles are not the cause).
  • LARP_CARD_TIMES=1 at the world-entry freeze: GPU 40–48 % busy, graphics queue 5.8 ms per frame. The GPU is idle; the freeze is CPU work (the re-creations).
  • With WAIT_MS=8 the remaining 230–290 ms worst frame is at world entry and is the rest of the load, not re-creations. Comparing internal captures of equivalent frames (world entry, prison, police, beach, title card) I could not see missing draws; skipped draws stayed at 0 except three windows with 1–10 per frame.
  • Cold caches amplify it a lot: the first run after a cache wipe or a driver change (cache_uuid changes when Mesa is rebuilt or another ICD is used) had freezes of 1–3 s.
  • Unrelated to pipelines: in heavy scenes the frame (~23 ms) is longer than the GPU time (~16.5 ms, ~81 % busy); title threads use ~7.5 of 12 CPU threads and ExecuteCommandLists takes ~7.4 ms per frame, so these scenes are CPU-bound.

Suggestions

  1. Consider LARP_PIPELINE_WAIT_MS=8 (or similar) as the default, at least on AMD/Linux. These numbers are from one machine; worth measuring elsewhere.
  2. Re-create ahead of time the pipelines that previous sessions drew: record the key of every pipeline first requested in game (like created::note_quad already does for quad variants) to a list with a seen-count, and at start-up re-create those from their blobs on the idle workers during the menu / "render phases" wait without releasing them, with a RAM cap. Estimate: ~1,500 pipelines per scene × ~2 ms / 9 workers ≈ 0.3 s more menu time, ~0.2 GB RAM per scene (0.4–0.75 GB for a 3,000–6,000 pipeline session, at the ~123 KB per pipeline the code comments cite). I'm implementing this locally and can report back / open a PR.
  3. Unrelated but seen while measuring: a run killed with SIGTERM loses the blob writer's queue (74,330 blobs on disk vs ~82,000 pipelines made), and the next start spends ~2 min rebuilding them in the menu; that is also when "2 being made" stayed for ~60 s.
**@⁠Raptorbk45** on GitHub · 2026-12-05 23:36 UTC · [original](https://github.com/iceboerg00/larp-amd/issues/51) ## Summary In-game hitches that look like "shader compilation" are not compilations: they are **graphics pipelines being re-created from their on-disk blob, one at a time, on the title's own threads**. With a warm cache each scene re-creates about **1,450 pipelines at ~1.6–2 ms each (longest 16 ms), ~2.4–3 s in total**. They pile up mainly at **world entry** (550–830 re-creations inside the same 5 s window as a **400–900 ms freeze**) and at **scene cuts** (frames of 90–115 ms). Meanwhile the 9 pipeline workers that built everything in the menu sit idle. Cause, as read in `crates/larp-gpu/src/pipeline/make.rs`: in the menu every graphics pipeline is built only to write its blob and is then released (the "disk-backed PSO release"). The first draw that uses a released pipeline re-creates it from the blob (`CreateGraphicsPipelineState` with `CachedPSO`) on the drawing thread, and since the build knows the title's watchdog, draws wait for every pipeline. Nothing remembers between sessions which pipelines were drawn, so **every session pays it again**. `LARP_PIPELINE_WAIT_MS=8` (already in the tree, off by default) removes almost all of it with no visible missing draws. ## Setup - RX 7700 XT 12 GB (RDNA 3, gfx1101), Ryzen 5 5600X, CachyOS, Hyprland. - Linux: Proton-CachyOS + vkd3d-proton + RADV (Mesa). Built from source from `stable` `257438a` (amd-4.2) plus part of gamingwithhomie/larp#183 (faces/jaw/FP16 wave sums only, no pipeline changes). - Series S preset, ray tracing on (larp default). - Scene: the scripted intro from world entry, 180 s (prison → police → title → beach → boat). Automated runner, same inputs every run. - Warm caches only (every compared run has the same `listed=` count and `cache_uuid`); cold runs discarded. ## Measurement To count this I added a small diagnostic behind an env var (`LARP_HITCH_MS=<ms>`, no effect when unset): every 5 s it prints pipeline requests on title threads split into *created from blob* / *compiled* / *waited for a worker* (count, total ms, longest), plus one line per request and per frame (present to present) ≥ `<ms>`. Happy to open a PR with it if useful. | run | frames ≥100 / ≥250 / ≥500 ms | worst | frames ≥100 ms that coincide with | requests on title threads | fps median | |---|---|---|---|---|---| | base 1 (`VKD3D_DEBUG=fixme`) | 4 / 2 / 1 | 507 ms | blob 4 | blob 1451 (2835 ms), wait 110 (277 ms) | 46.6 | | base 2 | 6 / 1 / 0 | 494 ms | blob 5, none 1 | blob 1562 (3002 ms), wait 124 (332 ms) | 39.9 | | base 3 | 3 / 2 / 1 | 881 ms | blob 3 | blob 1447 (2652 ms), wait 127 (291 ms) | 45.6 | | base 4 | 5 / 2 / 1 | 750 ms | blob 3, none 2 | blob 1470 (2999 ms), wait 114 (312 ms) | 46.2 | | **`LARP_PIPELINE_WAIT_MS=8`** | 4 / **0 / 0** | **230 ms** | wait 3, none 1 | blob **5 (8 ms)**, wait 352 (1144 ms) | 44.4 | | **`LARP_PIPELINE_WAIT_MS=8`** | 2 / **1 / 0** | **290 ms** | wait 2 | blob **6 (18 ms)**, wait 371 (1050 ms) | 46.1 | - No pipeline was compiled on a title thread in any run; no creation took ≥ 1 s. - vkd3d-proton "Compiling a fallback pipeline late!" with `VKD3D_DEBUG=fixme`: **0** (late variant compiles are not the cause). - `LARP_CARD_TIMES=1` at the world-entry freeze: GPU 40–48 % busy, graphics queue 5.8 ms per frame. The GPU is idle; the freeze is CPU work (the re-creations). - With `WAIT_MS=8` the remaining 230–290 ms worst frame is at world entry and is the rest of the load, not re-creations. Comparing internal captures of equivalent frames (world entry, prison, police, beach, title card) I could not see missing draws; skipped draws stayed at 0 except three windows with 1–10 per frame. - Cold caches amplify it a lot: the first run after a cache wipe or a driver change (`cache_uuid` changes when Mesa is rebuilt or another ICD is used) had freezes of 1–3 s. - Unrelated to pipelines: in heavy scenes the frame (~23 ms) is longer than the GPU time (~16.5 ms, ~81 % busy); title threads use ~7.5 of 12 CPU threads and `ExecuteCommandLists` takes ~7.4 ms per frame, so these scenes are CPU-bound. ## Suggestions 1. **Consider `LARP_PIPELINE_WAIT_MS=8` (or similar) as the default**, at least on AMD/Linux. These numbers are from one machine; worth measuring elsewhere. 2. **Re-create ahead of time the pipelines that previous sessions drew**: record the key of every pipeline first requested in game (like `created::note_quad` already does for quad variants) to a list with a seen-count, and at start-up re-create those from their blobs on the idle workers during the menu / "render phases" wait without releasing them, with a RAM cap. Estimate: ~1,500 pipelines per scene × ~2 ms / 9 workers ≈ 0.3 s more menu time, ~0.2 GB RAM per scene (0.4–0.75 GB for a 3,000–6,000 pipeline session, at the ~123 KB per pipeline the code comments cite). I'm implementing this locally and can report back / open a PR. 3. Unrelated but seen while measuring: a run killed with SIGTERM loses the blob writer's queue (74,330 blobs on disk vs ~82,000 pipelines made), and the next start spends ~2 min rebuilding them in the menu; that is also when "2 being made" stayed for ~60 s.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 23:40:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
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
github/iceboerg00--larp-amd#51
No description provided.