perf(gpu): lift slow-pipeline cap on warm library loads and boost waited-for workers #283
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/283"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Mikey970 on 2026-11-27T20:40:36Z.
Problem
slow-pipelines.txtonly 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 toworkers / 4atTHREAD_PRIORITY_LOWEST. Hundreds of early cached pipelines spill into world entry, where recording threads stall up toVICTORY_PIPELINE_WAIT_MS(500 ms) waiting on starved lowest-priority workers.Fix
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=1forces the cold cap;=0disables it as before.VICTORY_PIPELINE_BOOST, on by default;=0disables): While a draw/dispatch is actively blocked waiting for a pipeline, temporarily raises the worker thread making it toTHREAD_PRIORITY_NORMALand restores its base priority when the wait ends or at the next pipeline.Testing
the_slow_limit_is_lifted_with_a_warm_libraryanda_waiting_draw_raises_the_worker_making_its_pipeline; all 9 tests inpipeline::make::testspass.pipeline_wait_ms = 0) on warm launches.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T09:12:13Z.
I tried the same idea on an RTX 5070 Ti (16 pipeline workers) and ran into one thing worth guarding against: how many workers end up at normal priority at once.
My first version marked a pipeline when a draw first waited for it, and the worker that made it ran at
THREAD_PRIORITY_NORMALuntil the pipeline was done, not just while the draw waited. In a play run a burst of new pipelines had 46 to 82 being made at once, so all 16 workers could sit at the title's priority beside its own threads. That run also had audio dropouts. The log has no audio warnings, so I can't prove they were connected, but it was the obvious suspect.The fix I settled on is a small cap on the number of workers raised at once (4 by default,
VICTORY_PIPELINE_HURRY=<n>,0for none):This PR is less exposed than my first version: it lowers the worker when the wait ends, and with the shared wait budget (
VICTORY_PIPELINE_WAIT_SHARED, on by default) usually only one draw waits at a time. Passes over the screen have their own budget and can wait alongside it, though, and withVICTORY_PIPELINE_WAIT_SHARED=0every recording thread can wait at once. A cap like the one above would bound that for little code. Inboost(p, true)it would mean taking a place first and skipping the raise if none is free, and giving the place back inboost(p, false).I haven't measured the cap in play yet, so take it as a suggestion rather than a measured result.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by hazben on 2026-11-28T09:56:34Z.
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
64d4931plus 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:
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):
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).