perf(gpu): lift slow-pipeline cap on warm library loads and boost waited-for workers #283

Manually merged
github merged 2 commits from github-bot/gh-283 into main 2026-11-29 08:22:02 +00:00 AGit
Owner

@⁠Mikey970 on GitHub · 2026-11-27 20:40 UTC · original
Mikey970:pr/pipeline-warm-boost → main · +204 −17 · 2 files · 2 commits · merged 2026-11-29 08:16 UTC

Problem

slow-pipelines.txt only grows over time: pipelines that once took >= 1 s to compile on a cold start stay on the slow list permanently. On subsequent warm launches where the D3D12 pipeline library loads those PSOs in milliseconds, slow_limit() still throttles them to workers / 4 at THREAD_PRIORITY_LOWEST. Hundreds of early cached pipelines spill into world entry, where recording threads stall up to VICTORY_PIPELINE_WAIT_MS (500 ms) waiting on starved lowest-priority workers.

Fix

  • Warm library slow-limit lift (VICTORY_PIPELINE_SLOW): Tracks whether the pipeline library opened from an existing saved blob (library::warm()). While a warm library is actively serving the run (at most 1 in 4 pipelines built fresh), the slow-list concurrency cap is lifted so cached PSOs load ahead of world entry. Cold starts, driver updates, and large translator invalidations keep the cold cap. VICTORY_PIPELINE_SLOW=1 forces the cold cap; =0 disables it as before.
  • Draw-wait priority boost (VICTORY_PIPELINE_BOOST, on by default; =0 disables): While a draw/dispatch is actively blocked waiting for a pipeline, temporarily raises the worker thread making it to THREAD_PRIORITY_NORMAL and restores its base priority when the wait ends or at the next pipeline.

Testing

  • Added unit tests the_slow_limit_is_lifted_with_a_warm_library and a_waiting_draw_raises_the_worker_making_its_pipeline; all 9 tests in pipeline::make::tests pass.
  • Verified in release runs: eliminated pipeline-wait stalls (pipeline_wait_ms = 0) on warm launches.
**@⁠Mikey970** on GitHub · 2026-11-27 20:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/283) `Mikey970:pr/pipeline-warm-boost` → `main` · +204 −17 · 2 files · 2 commits · merged 2026-11-29 08:16 UTC ## Problem `slow-pipelines.txt` only grows over time: pipelines that once took >= 1 s to compile on a cold start stay on the slow list permanently. On subsequent warm launches where the D3D12 pipeline library loads those PSOs in milliseconds, `slow_limit()` still throttles them to `workers / 4` at `THREAD_PRIORITY_LOWEST`. Hundreds of early cached pipelines spill into world entry, where recording threads stall up to `VICTORY_PIPELINE_WAIT_MS` (500 ms) waiting on starved lowest-priority workers. ## Fix - **Warm library slow-limit lift (`VICTORY_PIPELINE_SLOW`):** Tracks whether the pipeline library opened from an existing saved blob (`library::warm()`). While a warm library is actively serving the run (at most 1 in 4 pipelines built fresh), the slow-list concurrency cap is lifted so cached PSOs load ahead of world entry. Cold starts, driver updates, and large translator invalidations keep the cold cap. `VICTORY_PIPELINE_SLOW=1` forces the cold cap; `=0` disables it as before. - **Draw-wait priority boost (`VICTORY_PIPELINE_BOOST`, on by default; `=0` disables):** While a draw/dispatch is actively blocked waiting for a pipeline, temporarily raises the worker thread making it to `THREAD_PRIORITY_NORMAL` and restores its base priority when the wait ends or at the next pipeline. ## Testing - Added unit tests `the_slow_limit_is_lifted_with_a_warm_library` and `a_waiting_draw_raises_the_worker_making_its_pipeline`; all 9 tests in `pipeline::make::tests` pass. - Verified in release runs: eliminated pipeline-wait stalls (`pipeline_wait_ms = 0`) on warm launches.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:42:56 +00:00
Author
Owner

@⁠hazben on GitHub · 2026-11-28 09:56 UTC · original

A data point for #283 from the other side of world entry: pipeline makes in the middle of play, felt as "lag after a pause". RTX 4070 SUPER, 32 GB, DLSS Quality, frame generation off, main 64d4931 plus a local patch stack and a diagnostics build, async submit (depth 24). One play run of 3,939 s; a tester reported extreme input lag after the pause that ended at 3,292 s. I read the run to see whether any delay sits between the stick and the picture.

1. The stick-to-view delay is normal. Camera angle read every ~0.28 s against the right stick's onsets (windowed cross-correlation); onsets where the view moved before the stick (follow camera) are left out:

onsets median p25 / p75 max
before the pause 89 132 ms 79 / 200 964 ms
after the pause 35 154 ms 131 / 199 424 ms

By frame time at the onset (all 124): under 45 ms 148 ms (n=29), 45-65 ms 119 (57), 65-90 ms 161 (36), over 90 ms 251 (2). Limits: this reads the game's camera state, not the display after Present; the left stick is no probe (the follow camera answers 1-2.3 s late by itself). The swap chain has 2 buffers, flip-discard; the frame recorder's "begun minus presented" is 0 in all 190,358 frames to 3,333 s.

2. What the 11 lag presses have in common (a key press at each moment the tester felt it; window = press -3 s to +3 s):

  • 10 of the 11 are in heavy scenes: 5,000-13,000 draws, 55-135 ms median frames. The other one is the pause ending.
  • In 7 of 11, pipeline makes came 0.5-3 s before the press (47 in one window; 1 in two of them). In 5 of those 7 a frame of 447-905 ms came with them; four of the five are 447-569 ms, the size of the 500 ms wait budget in this PR's text. Unverified that it is that wait.
  • Heavy 6 s stretches after the pause: any pipeline make in 9 %, a frame over 400 ms in 1 %. The 19 stretches around the presses: 53 % and 32 %.
  • The 4 without a make are the pause end and three presses in steady 93-135 ms frames at 10-13k draws.
  • When the pause ended, the scene went from 117 to 7,214 draws per frame; the longest frame of the next 40 s was 1,294 ms.

3. The cache was warm at the start but not for these places. The line "shaders from the cache and translated so far": hits=3,461 misses=0 at 66 s; misses 12 at 369 s, 42 at 1,437 s, 170 at 2,628 s (hits stay at 3,477 from 1,437 s on). Every shader gets a "shader translated" line, from the cache or not: 3,647 lines to 2,628 s = 3,477 hits + 170 misses. After the pause (3,292-3,800 s) there are 47 more lines; 33 of them fall in the press windows, which are 19 % of that time. Likely mostly misses (hits had stopped growing); unverified, no count line after 2,628 s. So the hitch is the new shaders and pipelines of a new place, not a cold start.

4. No growth with uptime. The raw cost at 8-11.5k draws rose from 68 to 87 ms per frame over the hour. At the same place (within 30 m, draws within 25 %, 106 late/early pairs) the ratio is 1.02 (IQR 0.97-1.11); host copies stay at about 3,660 copies / 2,060 MB. The rise is the scene, not a leak.

Not measured: display latency after Present, the tester's display path, mouse input (13 events in the run, none after the pause).

**@⁠hazben** on GitHub · 2026-11-28 09:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/283#issuecomment-7237566282) A data point for #283 from the other side of world entry: pipeline makes in the middle of play, felt as "lag after a pause". RTX 4070 SUPER, 32 GB, DLSS Quality, frame generation off, main 64d4931 plus a local patch stack and a diagnostics build, async submit (depth 24). One play run of 3,939 s; a tester reported extreme input lag after the pause that ended at 3,292 s. I read the run to see whether any delay sits between the stick and the picture. **1. The stick-to-view delay is normal.** Camera angle read every ~0.28 s against the right stick's onsets (windowed cross-correlation); onsets where the view moved before the stick (follow camera) are left out: | | onsets | median | p25 / p75 | max | |---|---|---|---|---| | before the pause | 89 | 132 ms | 79 / 200 | 964 ms | | after the pause | 35 | 154 ms | 131 / 199 | 424 ms | By frame time at the onset (all 124): under 45 ms 148 ms (n=29), 45-65 ms 119 (57), 65-90 ms 161 (36), over 90 ms 251 (2). Limits: this reads the game's camera state, not the display after Present; the left stick is no probe (the follow camera answers 1-2.3 s late by itself). The swap chain has 2 buffers, flip-discard; the frame recorder's "begun minus presented" is 0 in all 190,358 frames to 3,333 s. **2. What the 11 lag presses have in common** (a key press at each moment the tester felt it; window = press -3 s to +3 s): - 10 of the 11 are in heavy scenes: 5,000-13,000 draws, 55-135 ms median frames. The other one is the pause ending. - In 7 of 11, pipeline makes came 0.5-3 s before the press (47 in one window; 1 in two of them). In 5 of those 7 a frame of 447-905 ms came with them; four of the five are 447-569 ms, the size of the 500 ms wait budget in this PR's text. Unverified that it is that wait. - Heavy 6 s stretches after the pause: any pipeline make in 9 %, a frame over 400 ms in 1 %. The 19 stretches around the presses: 53 % and 32 %. - The 4 without a make are the pause end and three presses in steady 93-135 ms frames at 10-13k draws. - When the pause ended, the scene went from 117 to 7,214 draws per frame; the longest frame of the next 40 s was 1,294 ms. **3. The cache was warm at the start but not for these places.** The line "shaders from the cache and translated so far": hits=3,461 misses=0 at 66 s; misses 12 at 369 s, 42 at 1,437 s, 170 at 2,628 s (hits stay at 3,477 from 1,437 s on). Every shader gets a "shader translated" line, from the cache or not: 3,647 lines to 2,628 s = 3,477 hits + 170 misses. After the pause (3,292-3,800 s) there are 47 more lines; 33 of them fall in the press windows, which are 19 % of that time. Likely mostly misses (hits had stopped growing); unverified, no count line after 2,628 s. So the hitch is the new shaders and pipelines of a new place, not a cold start. **4. No growth with uptime.** The raw cost at 8-11.5k draws rose from 68 to 87 ms per frame over the hour. At the same place (within 30 m, draws within 25 %, 106 late/early pairs) the ratio is 1.02 (IQR 0.97-1.11); host copies stay at about 3,660 copies / 2,060 MB. The rise is the scene, not a leak. Not measured: display latency after Present, the tester's display path, mouse input (13 events in the run, none after the pause).
github manually merged commit a6eb396663 into main 2026-11-29 08:22:02 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/trustno1-coder--VIctory-NVIDIA!283
No description provided.