Pipelines made at first use: what a frame waits on goes first and its worker is raised, siblings made ahead, held-back library saves follow #4255

Closed
Lyrnc wants to merge 3 commits from upstream-pr/4255 into main
Lyrnc commented 2026-11-30 17:51:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T17:51:29Z.


Problem

Pipelines made at first use are the big drops players feel at camera cuts, character switches and shootouts.

  • A first use holds the frame while its pipeline is made:
    • a draw since v2026.11.30.02 (VICTORY_PIPELINE_WAIT_ALL, on): up to 10 s a frame, as a pass over the screen; before that, 500 ms;
    • a dispatch: up to 3 s a frame, and the build it blocks on has no limit.
  • A pipeline the library holds loads in about 11 ms. A driver compile takes 580-720 ms on average (#2580's measurement on an RTX 4090), and seconds for RT programs.
  • In one player's sessions on an RTX 5080 (2,399 s in the world), 45 seconds have a single frame of 380-620 ms (the old 500 ms budget). 42 of them have pipeline creations or first binds in the same second (the base rate in other seconds is about 16 %). In those seconds the recording threads spend 400-650 ms of thread time a frame (140-190 otherwise), while the card is idle.
  • With RT on, the same mechanism gives hitches of 2.8-5.3 s, each with pipeline creations in that second (the RT passes are compute).
  • Since WAIT_ALL, main takes "a hitch once (the library has the pipeline the next run)" over "a picture with things missing". So what is left to shorten is each hitch and the number of them, and "the next run has it" has to hold.

Root cause

  1. The queue does not know what a frame is blocked on. Requests are made in the order asked, so a pipeline a frame waits on sits behind the requests of earlier frames. #283's boost raises its worker only once a worker has taken it.
  2. A dispatch blocks on a worker at the lowest priority. When a worker has already taken the compute pipeline a dispatch asks for, the dispatch's thread waits on the build's lock (p.make() in ready()). The boost is never applied on that path, so the build runs at THREAD_PRIORITY_LOWEST behind a title that keeps every core busy.
  3. A material's other states are made one at a time. The title creates a material's pipelines with their other states (another pass, blend or target) long before it draws with them. They are started early only if an earlier run drew with them (library::wanted_early). So a cut to something new brings each of them in turn, each its own hitch.
  4. A burst's pipelines can wait minutes for a save. The workers save the library when their queue runs dry, at most once an interval: 20 s, about 100 s at 1.3 GB, 6 min at 4.78 GB. A cutscene's pipelines made inside the interval wait for the end of the next burst. A run that ends without its save at exit (a crash, a device loss) loses them, and the next run has the same hitches at the same cutscene.
  5. With VICTORY_PIPELINE_WAIT_ALL=0, the wait does not know whether it can win. A dropped draw is drawn again next frame, but the frame was held up to 500 ms first, and the next frame waited again for the rest of the compile.

Fix

Three commits.

  1. #3819 (Remag501), cherry-picked: VICTORY_PIPELINE_WAIT_ONCE_MS. A pipeline is waited for at most its cap in the whole run, counted over all frames (Pending::waited_ms). Off by default, as in #3819. Its reservation goes through main's reserve_wait (#2414).

  2. The waited-on first and raised, siblings made ahead (make.rs):

    • Waited-on first (Queue::expedite; VICTORY_PIPELINE_WAITED_FIRST=0: as before). When a draw or dispatch begins waiting on a pipeline that is requested but not taken yet:
      • a request moves to a blocked list, which workers take right after the passes over the screen. The workers that take only what draws wait on (VICTORY_PIPELINE_ASKED_WORKERS) take it too;
      • one waited for as a pass over the screen (with WAIT_ALL, every draw) moves to the front of the screen list, so passes over the screen still go first. VICTORY_PIPELINE_NOW_FIRST (off) had the same reason: a cold library's requests waited 10-175 s behind the requests of scenes the title had left.
      • It moves once per queuing (Pending::expedited, cleared when it is queued again after a deferral).
    • A dispatch that blocks on a worker raises it. The inline compute path in ready() counts as a waiter and boosts the worker that has the build, as wait() already does. The dispatch still waits for the build. Nothing that waited before is dropped now.
    • Siblings made ahead (warm_siblings; VICTORY_PIPELINE_SIBLINGS=n, default 8; 0: none):
      • Every graphics pipeline the title creates is noted in its family (FAMILIES): its shaders' stages and hashes without the state (Pending::family, from the key's hasher before the state goes in). The notes are weak references.
      • When a draw first asks for a pipeline that is new to the early list (library::note_used now says so) and not made, up to 8 of its family are queued. Those are the title's pipelines of the same shaders with another key, not queued, made, left out or paused.
      • Siblings go in a list of their own after the requests, the early list and the slow list. At most a quarter of the workers make them at once (sibling_limit), and keep_free applies.
      • A draw that asks for a sibling before a worker took it promotes it to a request. The stale entry is swept like the early lists'.
      • None follow a pipeline the book knew, so a warm run's world entry queues none. Compute pipelines have no siblings.
      • Log: pipelines queued ahead with a sibling's first draw at powers of two (queued, asked for later, found made). The same counts are on the host pipelines all made line.
    • With VICTORY_PIPELINE_WAIT_ALL=0 only:
      • draws that have a fallback (has_fallback: graphics, not passes over the screen, first-scene producers or skinned meshes waited for as one) wait 100 ms once in the run (VICTORY_PIPELINE_DRAW_ONCE_MS, #3819's cap for them alone; 0: as before), then are dropped while the pipeline compiles;
      • the worker making it keeps the title's priority until it is made, at most 2 workers at once (keep_up; VICTORY_PIPELINE_BOOST_KEEP, 0: as before).
      • With WAIT_ALL on (main's default), no draw has a fallback, and neither applies: main's choice of waiting over pop-in (the trees that went missing) stands. Dispatches and passes over the screen are never capped by it. #2580 shortened those too and was reverted for the black shadows of a dropped one-shot dispatch.
  3. Held-back saves follow (library.rs, follow_up; VICTORY_LIBRARY_SAVE_FOLLOW=0: as before):

    • When save(false) is held back by its interval or by VICTORY_LIBRARY_SAVE_QUIET while pipelines are not saved yet (added > 0), a thread victory-pipelines-save-due saves once the interval is over.
    • It does not save while pipelines are queued, because the save when the workers run dry follows then. While a library load is in the driver, it tries again a second later.
    • Still at most one save an interval. The save at exit and the one when the queue runs dry are unchanged.
    • Pipelines stored by store_waiting after a save get a follow-up one interval later.
    • This complements #3702 (early saves on a cold run), which is not included here.

Verification

Windows 11, rustc 1.98.1 (the pinned toolchain), Ryzen 7 9800X3D, target directory of its own.

On 59c13224, in a build slot, with its own target directory:

  • cargo check -p victory-gpu --locked -j 4: passes. The crate's one warning is on main's lines (shadow.rs:7197, ranged never used).
  • cargo test -p victory-gpu --lib --locked -j 4 -- pipeline::make pipeline::library: 73 passed, 0 failed, 0 ignored. This includes #3819's three tests and these new ones:
    • the_draw_once_wait_is_on_by_default: the cap's value is 100 ms unless set; 0 turns it off.
    • only_draws_with_a_fallback_have_the_draw_cap:
      • a plain draw has a fallback only with WAIT_ALL off;
      • passes over the screen, dispatches and skinned meshes waited for as passes never have one;
      • once_cap_for combines it with #3819's switch.
    • a_capped_draw_waits_once_then_drops: a pipeline nobody finishes is waited for its 100 ms in one frame. The next frame does not wait at all, under whichever budget it waits with.
    • a_pipeline_a_frame_waits_on_goes_first:
      • a waited-on request moves to the blocked list once and is taken first;
      • one already taken, or one not requested, does not move;
      • it can move again after being queued afresh;
      • the workers for passes over the screen alone do not take it, and the workers for what draws wait on do;
      • a pass over the screen moves to the front of its own list.
    • workers_stay_raised_for_dropped_draws_a_few_at_a_time:
      • places are taken up to the limit and given back once;
      • none when the switch is 0, when every draw waits, when the pipeline is made or put off, for a pass over the screen, or for a dispatch.
    • a_dispatch_waiting_on_a_worker_raises_it: a real thread at THREAD_PRIORITY_LOWEST holds the build. A dispatch (ready() on a compute pipeline) blocks on it, and the worker reads THREAD_PRIORITY_NORMAL while the dispatch waits. The dispatch gets the worker's result, and the waiter count is back at 0.
    • siblings_are_the_same_shaders_in_another_state:
      • the same shaders give the same family and other states give other keys;
      • not counted as siblings: the pipeline itself, its same-key twin, ones already queued, left out or dropped;
      • the count is limited.
    • siblings_wait_behind_the_rest_and_are_taken_once:
      • siblings come after the requests and the early list, and the workers for what draws wait on never take them;
      • none is taken while the siblings' share of workers is busy;
      • one asked for by a draw is promoted, and its stale entry is never taken again.
    • a_new_first_use_queues_its_siblings: with adopt(), note_used() and first_use(), a first use new to the book queues its sibling. Another family stays unqueued.
    • library: a_save_is_held_back_for_the_rest_of_its_interval, the_earlier_follow_up_save_wins, a_used_key_is_new_once.
  • cargo clippy -p victory-gpu --all-targets --locked -j 4: no warning in make.rs or library.rs. The two it gives are on main's lines: shadow.rs:7197, and host.rs:5092 (manual_is_multiple_of).
  • The three branches of tonight (this one, perf/warm-waited and #3347's rework) merge with each other without conflicts (git merge-tree).

NOT tested

  • No game run. No log of this branch exists. Not seen:
    • how much shorter a cut's hitches get from the waited-on going first and the raised worker;
    • how many siblings a family has in this title, how many of them are ever drawn (the found_made count), and the CPU and library growth they cost. They also keep the workers busy longer, so the save when the queue runs dry comes later;
    • the follow-up save's timing and length on a 1-5 GB library in play;
    • with WAIT_ALL=0: pop-in at cuts, and 2 workers kept at normal priority beside the title's threads.
  • The defaults (8 siblings, a quarter of the workers for them, 100 ms and 2 kept workers with WAIT_ALL=0) are picked, not measured.

Bench steps:

Not run. To run the bench:

  1. Builds.
    • Arm A: main 84bd61e2 plus #3703 (the long-frame line).
    • Arm B: this branch plus #3703. #3703 conflicts in make.rs with both: put its feeds in wait() / wait_capped() and the inline compute make.
    • Release builds, the bench's usual settings, our usual profile (Series X 1440p, DLSS Quality). RT off first.
  2. A cold library for each run.
    • Empty the adapter's pipeline folder before each run: host-pipelines.bin, early-pipelines.txt, slow-pipelines.txt, warm-done.txt.
    • Keep cache\shaders, so translation is not what differs.
    • Then a second pair with the library warm from a run of another route, to see a warm run at new cutscenes.
  3. Route. The restored save, then the cutscene/shootout route (QUEUE item 6): walk, camera cuts and a character switch, a shootout with police arriving. Five minutes, 2 + 2 runs per arm.
  4. Counting pipeline-wait long frames.
    • From #3703's long frame N ms ... pipeline waits P (graphics G; compute C; screen S ...) lines, count frames with N ≥ 250 ms and P ≥ N/2. Count them all, and by the largest part.
    • Sum their excess: N minus the run's median frame.
    • Count a pass over the screen was waited for lines; with WAIT_ALL, every draw waits as one.
    • Pass: fewer and shorter pipeline-wait long frames on B. Expect the most at a cold start and at cuts.
  5. New lines on B.
    • pipelines queued ahead with a sibling's first draw gives queued, asked for and found made. The siblings' hit rate is found made / queued; their cost is the extra made against A.
    • host pipelines all made: siblings_*, boosted, waited_out.
    • the save its interval held back.
  6. Each part alone, on B, one run each:
    • VICTORY_PIPELINE_WAITED_FIRST=0;
    • VICTORY_PIPELINE_SIBLINGS=0;
    • VICTORY_PIPELINE_BOOST=0 (all raising off, #283's too);
    • VICTORY_LIBRARY_SAVE_FOLLOW=0.
  7. VICTORY_PIPELINE_WAIT_ALL=0 on both arms (the old 500 ms budget). On B this brings in the 100 ms cap and the kept boost.
    • Count frames in the 380-620 ms band.
    • Pop-in: draws dropped for pipelines not made yet, and how many consecutive frames each key is dropped.
    • Screenshots at the cut, where the trees of main's clip are.
  8. RT on (VICTORY_BVH_BUILDER=1), one pair from a cold library.
    • Frames over 1 s in the first 5 min and after, and the compute part of the pipeline waits.
    • Only the raising and the waited-on-first touch dispatches. Expect shorter compute stalls, and no dispatch dropped that main would not drop.
  9. The #2580 check. Cold cache, frames at 240, 290 and 330 s at a shadowed spot (the maintainer's check). Nothing here shortens a dispatch's wait, so it should match main.
  10. Saves.
    • On B, end the process from Task Manager 60-90 s after a cutscene that brought new pipelines, then start again.
    • The next run should load that cutscene's pipelines: loaded against made, no hitch there.
    • On A they are lost when the save interval had not passed.

Overlap

Searched with gh pr list --state open --search: "pipeline wait", "pipeline priority", "pipeline queue", "warm pipelines", "preload", "sibling", "pipeline family", "first use", "compile grace", "boost", "stutter pipeline", "hitch". Merges were checked with git merge-tree against main 84bd61e2 and against this branch.

  • #3819 (Remag501, open): the once-a-run cap, off by default. It is this branch's first commit, with its author, conflict-resolved onto main: #3819 itself conflicts with main since #2414's reserve_wait. If #3819 merges first, drop that commit; the next two apply on top.
  • #2580 (Kajcsi): merged into .30.01's merge list, then reverted (3fa588eb) for black shadowed surfaces after a cold run.
    • Its graphics half (a draw stops waiting when the driver's compile begins) comes back here only in a softer form, and only with WAIT_ALL=0: 100 ms once for draws that have a fallback, through library loads and translations. Main's WAIT_ALL now goes the other way. Its compile_begins hook is not taken.
    • Its compute half (a dispatch waits 50 ms into a compile, then is dropped) does not come back: dispatches wait exactly as on main, only faster (raised and first in the queue).
    • Its offline warm --waited part is in a separate branch, perf/warm-waited (Kajcsi as author).
  • #283 (Mikey970, merged): the boost of a worker a draw waits on. Built on: the boost now also covers a dispatch blocked on a worker's build, and stays on (two workers at most) after the short wait of a draw that has a fallback.
  • #2188, #2414, #2469 (merged in .30.01): a wait ends when the build is put off; a late draw cannot reopen the next frame's budget. Kept as they are.
  • 66124155 (main, v2026.11.30.02): VICTORY_PIPELINE_WAIT_ALL, every draw waits for its pipeline as a pass over the screen (up to 10 s a frame), because dropped draws took stands of trees away for a second. This branch keeps that default. The 100 ms cap for draws with a fallback applies only with WAIT_ALL=0, and the waited-on-first move works in the screen list that WAIT_ALL puts every draw in.
  • #3788 (ours, open): a pass over the screen holds frames for its 10 s once in all. Complementary: this branch leaves passes over the screen alone. Both change wait(). #3788 already conflicts with main in make.rs, and with this branch in the same place.
  • #3702 (ours, open): early library saves on a cold run (200 pipelines or 30 s). Complementary to the follow-up save here, which covers warm runs whose bursts fall inside the save interval. #3702 already conflicts with main in library.rs (it is on 41adb551), not newly with this branch.
  • #3700 (stasadance, open): a dispatch waits for a compute pipeline a worker is making at most the frame's compute wait. Merges cleanly with main and conflicts with this branch in one hunk of ready(). To resolve, keep the boost around #3700's wait_made.
    • Note: #3700 drops a dispatch after up to 3 s, the same risk class as #2580's revert.
  • #3398 (Revono), #3677 (CDworks-Design), #3474 (nyxctura), #3426 (dexifried), #3703 (ours, the long-frame line): all already conflict with main in make.rs (on 41adb551). This branch adds no new conflicting files for them.
    • #3703 feeds its pipeline-wait counters in wait() and the inline compute make. A rebase onto this branch puts its feed around the new waiters code.
  • #1748 (101Leafy): VICTORY_PIPELINE_ASKED_WORKERS is already on main. Those workers take the new blocked list too.
  • #3744 (stasadance, open): menu warm-up, a different place (the menus). #3581 (BaRian29, open): every pipeline made ahead from the launcher. #1989 (NotADonky43, open): first-use history saved separately. #3974 (danielsteman, open): masked twins booked. None touches the queue or the waits; #1989 merges cleanly.
  • No open PR found that queues a pipeline's siblings (same shaders, other state), that moves a waited-on request to the front of the queue, or that saves a held-back library save later.

AI use

Claude Code (Claude Opus 5.5) wrote the change and its unit tests, resolved the cherry-pick of #3819 onto main, ran the checks listed above, and wrote this note. Nothing was run in game.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5570702954 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4255). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T17:51:29Z. --- ## Problem Pipelines made at first use are the big drops players feel at camera cuts, character switches and shootouts. - A first use holds the frame while its pipeline is made: - a draw since v2026.11.30.02 (`VICTORY_PIPELINE_WAIT_ALL`, on): up to 10 s a frame, as a pass over the screen; before that, 500 ms; - a dispatch: up to 3 s a frame, and the build it blocks on has no limit. - A pipeline the library holds loads in about 11 ms. A driver compile takes 580-720 ms on average (#2580's measurement on an RTX 4090), and seconds for RT programs. - In one player's sessions on an RTX 5080 (2,399 s in the world), 45 seconds have a single frame of 380-620 ms (the old 500 ms budget). 42 of them have pipeline creations or first binds in the same second (the base rate in other seconds is about 16 %). In those seconds the recording threads spend 400-650 ms of thread time a frame (140-190 otherwise), while the card is idle. - With RT on, the same mechanism gives hitches of 2.8-5.3 s, each with pipeline creations in that second (the RT passes are compute). - Since `WAIT_ALL`, main takes "a hitch once (the library has the pipeline the next run)" over "a picture with things missing". So what is left to shorten is each hitch and the number of them, and "the next run has it" has to hold. ## Root cause 1. **The queue does not know what a frame is blocked on.** Requests are made in the order asked, so a pipeline a frame waits on sits behind the requests of earlier frames. #283's boost raises its worker only once a worker has taken it. 2. **A dispatch blocks on a worker at the lowest priority.** When a worker has already taken the compute pipeline a dispatch asks for, the dispatch's thread waits on the build's lock (`p.make()` in `ready()`). The boost is never applied on that path, so the build runs at `THREAD_PRIORITY_LOWEST` behind a title that keeps every core busy. 3. **A material's other states are made one at a time.** The title creates a material's pipelines with their other states (another pass, blend or target) long before it draws with them. They are started early only if an earlier run drew with them (`library::wanted_early`). So a cut to something new brings each of them in turn, each its own hitch. 4. **A burst's pipelines can wait minutes for a save.** The workers save the library when their queue runs dry, at most once an interval: 20 s, about 100 s at 1.3 GB, 6 min at 4.78 GB. A cutscene's pipelines made inside the interval wait for the end of the next burst. A run that ends without its save at exit (a crash, a device loss) loses them, and the next run has the same hitches at the same cutscene. 5. **With `VICTORY_PIPELINE_WAIT_ALL=0`, the wait does not know whether it can win.** A dropped draw is drawn again next frame, but the frame was held up to 500 ms first, and the next frame waited again for the rest of the compile. ## Fix Three commits. 1. **#3819 (Remag501), cherry-picked**: `VICTORY_PIPELINE_WAIT_ONCE_MS`. A pipeline is waited for at most its cap in the whole run, counted over all frames (`Pending::waited_ms`). Off by default, as in #3819. Its reservation goes through main's `reserve_wait` (#2414). 2. **The waited-on first and raised, siblings made ahead** (`make.rs`): - **Waited-on first** (`Queue::expedite`; `VICTORY_PIPELINE_WAITED_FIRST=0`: as before). When a draw or dispatch begins waiting on a pipeline that is requested but not taken yet: - a request moves to a `blocked` list, which workers take right after the passes over the screen. The workers that take only what draws wait on (`VICTORY_PIPELINE_ASKED_WORKERS`) take it too; - one waited for as a pass over the screen (with `WAIT_ALL`, every draw) moves to the front of the screen list, so passes over the screen still go first. `VICTORY_PIPELINE_NOW_FIRST` (off) had the same reason: a cold library's requests waited 10-175 s behind the requests of scenes the title had left. - It moves once per queuing (`Pending::expedited`, cleared when it is queued again after a deferral). - **A dispatch that blocks on a worker raises it.** The inline compute path in `ready()` counts as a waiter and boosts the worker that has the build, as `wait()` already does. The dispatch still waits for the build. Nothing that waited before is dropped now. - **Siblings made ahead** (`warm_siblings`; `VICTORY_PIPELINE_SIBLINGS=n`, default 8; `0`: none): - Every graphics pipeline the title creates is noted in its family (`FAMILIES`): its shaders' stages and hashes without the state (`Pending::family`, from the key's hasher before the state goes in). The notes are weak references. - When a draw first asks for a pipeline that is new to the early list (`library::note_used` now says so) and not made, up to 8 of its family are queued. Those are the title's pipelines of the same shaders with another key, not queued, made, left out or paused. - Siblings go in a list of their own after the requests, the early list and the slow list. At most a quarter of the workers make them at once (`sibling_limit`), and `keep_free` applies. - A draw that asks for a sibling before a worker took it promotes it to a request. The stale entry is swept like the early lists'. - None follow a pipeline the book knew, so a warm run's world entry queues none. Compute pipelines have no siblings. - Log: `pipelines queued ahead with a sibling's first draw` at powers of two (queued, asked for later, found made). The same counts are on the `host pipelines all made` line. - **With `VICTORY_PIPELINE_WAIT_ALL=0` only**: - draws that have a fallback (`has_fallback`: graphics, not passes over the screen, first-scene producers or skinned meshes waited for as one) wait 100 ms once in the run (`VICTORY_PIPELINE_DRAW_ONCE_MS`, #3819's cap for them alone; `0`: as before), then are dropped while the pipeline compiles; - the worker making it keeps the title's priority until it is made, at most 2 workers at once (`keep_up`; `VICTORY_PIPELINE_BOOST_KEEP`, `0`: as before). - With `WAIT_ALL` on (main's default), no draw has a fallback, and neither applies: main's choice of waiting over pop-in (the trees that went missing) stands. Dispatches and passes over the screen are never capped by it. #2580 shortened those too and was reverted for the black shadows of a dropped one-shot dispatch. 3. **Held-back saves follow** (`library.rs`, `follow_up`; `VICTORY_LIBRARY_SAVE_FOLLOW=0`: as before): - When `save(false)` is held back by its interval or by `VICTORY_LIBRARY_SAVE_QUIET` while pipelines are not saved yet (`added > 0`), a thread `victory-pipelines-save-due` saves once the interval is over. - It does not save while pipelines are queued, because the save when the workers run dry follows then. While a library load is in the driver, it tries again a second later. - Still at most one save an interval. The save at exit and the one when the queue runs dry are unchanged. - Pipelines stored by `store_waiting` after a save get a follow-up one interval later. - This complements #3702 (early saves on a cold run), which is not included here. ## Verification Windows 11, rustc 1.98.1 (the pinned toolchain), Ryzen 7 9800X3D, target directory of its own. On 59c13224, in a build slot, with its own target directory: - `cargo check -p victory-gpu --locked -j 4`: passes. The crate's one warning is on main's lines (`shadow.rs:7197`, `ranged` never used). - `cargo test -p victory-gpu --lib --locked -j 4 -- pipeline::make pipeline::library`: **73 passed, 0 failed**, 0 ignored. This includes #3819's three tests and these new ones: - `the_draw_once_wait_is_on_by_default`: the cap's value is 100 ms unless set; `0` turns it off. - `only_draws_with_a_fallback_have_the_draw_cap`: - a plain draw has a fallback only with `WAIT_ALL` off; - passes over the screen, dispatches and skinned meshes waited for as passes never have one; - `once_cap_for` combines it with #3819's switch. - `a_capped_draw_waits_once_then_drops`: a pipeline nobody finishes is waited for its 100 ms in one frame. The next frame does not wait at all, under whichever budget it waits with. - `a_pipeline_a_frame_waits_on_goes_first`: - a waited-on request moves to the `blocked` list once and is taken first; - one already taken, or one not requested, does not move; - it can move again after being queued afresh; - the workers for passes over the screen alone do not take it, and the workers for what draws wait on do; - a pass over the screen moves to the front of its own list. - `workers_stay_raised_for_dropped_draws_a_few_at_a_time`: - places are taken up to the limit and given back once; - none when the switch is `0`, when every draw waits, when the pipeline is made or put off, for a pass over the screen, or for a dispatch. - `a_dispatch_waiting_on_a_worker_raises_it`: a real thread at `THREAD_PRIORITY_LOWEST` holds the build. A dispatch (`ready()` on a compute pipeline) blocks on it, and the worker reads `THREAD_PRIORITY_NORMAL` while the dispatch waits. The dispatch gets the worker's result, and the waiter count is back at 0. - `siblings_are_the_same_shaders_in_another_state`: - the same shaders give the same family and other states give other keys; - not counted as siblings: the pipeline itself, its same-key twin, ones already queued, left out or dropped; - the count is limited. - `siblings_wait_behind_the_rest_and_are_taken_once`: - siblings come after the requests and the early list, and the workers for what draws wait on never take them; - none is taken while the siblings' share of workers is busy; - one asked for by a draw is promoted, and its stale entry is never taken again. - `a_new_first_use_queues_its_siblings`: with `adopt()`, `note_used()` and `first_use()`, a first use new to the book queues its sibling. Another family stays unqueued. - library: `a_save_is_held_back_for_the_rest_of_its_interval`, `the_earlier_follow_up_save_wins`, `a_used_key_is_new_once`. - `cargo clippy -p victory-gpu --all-targets --locked -j 4`: no warning in `make.rs` or `library.rs`. The two it gives are on main's lines: `shadow.rs:7197`, and `host.rs:5092` (`manual_is_multiple_of`). - The three branches of tonight (this one, `perf/warm-waited` and #3347's rework) merge with each other without conflicts (`git merge-tree`). ## NOT tested - **No game run.** No log of this branch exists. Not seen: - how much shorter a cut's hitches get from the waited-on going first and the raised worker; - how many siblings a family has in this title, how many of them are ever drawn (the `found_made` count), and the CPU and library growth they cost. They also keep the workers busy longer, so the save when the queue runs dry comes later; - the follow-up save's timing and length on a 1-5 GB library in play; - with `WAIT_ALL=0`: pop-in at cuts, and 2 workers kept at normal priority beside the title's threads. - The defaults (8 siblings, a quarter of the workers for them, 100 ms and 2 kept workers with `WAIT_ALL=0`) are picked, not measured. **Bench steps:** Not run. To run the bench: 1. **Builds.** - Arm A: main 84bd61e2 plus #3703 (the long-frame line). - Arm B: this branch plus #3703. #3703 conflicts in `make.rs` with both: put its feeds in `wait()` / `wait_capped()` and the inline compute make. - Release builds, the bench's usual settings, our usual profile (Series X 1440p, DLSS Quality). RT off first. 2. **A cold library for each run.** - Empty the adapter's pipeline folder before each run: `host-pipelines.bin`, `early-pipelines.txt`, `slow-pipelines.txt`, `warm-done.txt`. - Keep `cache\shaders`, so translation is not what differs. - Then a second pair with the library warm from a run of another route, to see a warm run at new cutscenes. 3. **Route.** The restored save, then the cutscene/shootout route (QUEUE item 6): walk, camera cuts and a character switch, a shootout with police arriving. Five minutes, 2 + 2 runs per arm. 4. **Counting pipeline-wait long frames.** - From #3703's `long frame N ms ... pipeline waits P (graphics G; compute C; screen S ...)` lines, count frames with N ≥ 250 ms and P ≥ N/2. Count them all, and by the largest part. - Sum their excess: N minus the run's median frame. - Count `a pass over the screen was waited for` lines; with `WAIT_ALL`, every draw waits as one. - Pass: fewer and shorter pipeline-wait long frames on B. Expect the most at a cold start and at cuts. 5. **New lines on B.** - `pipelines queued ahead with a sibling's first draw` gives queued, asked for and found made. The siblings' hit rate is found made / queued; their cost is the extra `made` against A. - `host pipelines all made`: siblings_*, boosted, waited_out. - `the save its interval held back`. 6. **Each part alone, on B, one run each:** - `VICTORY_PIPELINE_WAITED_FIRST=0`; - `VICTORY_PIPELINE_SIBLINGS=0`; - `VICTORY_PIPELINE_BOOST=0` (all raising off, #283's too); - `VICTORY_LIBRARY_SAVE_FOLLOW=0`. 7. **`VICTORY_PIPELINE_WAIT_ALL=0` on both arms** (the old 500 ms budget). On B this brings in the 100 ms cap and the kept boost. - Count frames in the 380-620 ms band. - Pop-in: `draws dropped for pipelines not made yet`, and how many consecutive frames each key is dropped. - Screenshots at the cut, where the trees of main's clip are. 8. **RT on** (`VICTORY_BVH_BUILDER=1`), one pair from a cold library. - Frames over 1 s in the first 5 min and after, and the compute part of the pipeline waits. - Only the raising and the waited-on-first touch dispatches. Expect shorter compute stalls, and no dispatch dropped that main would not drop. 9. **The #2580 check.** Cold cache, frames at 240, 290 and 330 s at a shadowed spot (the maintainer's check). Nothing here shortens a dispatch's wait, so it should match main. 10. **Saves.** - On B, end the process from Task Manager 60-90 s after a cutscene that brought new pipelines, then start again. - The next run should load that cutscene's pipelines: `loaded` against `made`, no hitch there. - On A they are lost when the save interval had not passed. ## Overlap Searched with `gh pr list --state open --search`: "pipeline wait", "pipeline priority", "pipeline queue", "warm pipelines", "preload", "sibling", "pipeline family", "first use", "compile grace", "boost", "stutter pipeline", "hitch". Merges were checked with `git merge-tree` against main 84bd61e2 and against this branch. - **#3819** (Remag501, open): the once-a-run cap, off by default. It is this branch's first commit, with its author, conflict-resolved onto main: #3819 itself conflicts with main since #2414's `reserve_wait`. If #3819 merges first, drop that commit; the next two apply on top. - **#2580** (Kajcsi): merged into .30.01's merge list, then reverted (3fa588eb) for black shadowed surfaces after a cold run. - Its graphics half (a draw stops waiting when the driver's compile begins) comes back here only in a softer form, and only with `WAIT_ALL=0`: 100 ms once for draws that have a fallback, through library loads and translations. Main's `WAIT_ALL` now goes the other way. Its `compile_begins` hook is not taken. - Its compute half (a dispatch waits 50 ms into a compile, then is dropped) does **not** come back: dispatches wait exactly as on main, only faster (raised and first in the queue). - Its offline `warm --waited` part is in a separate branch, `perf/warm-waited` (Kajcsi as author). - **#283** (Mikey970, merged): the boost of a worker a draw waits on. Built on: the boost now also covers a dispatch blocked on a worker's build, and stays on (two workers at most) after the short wait of a draw that has a fallback. - **#2188, #2414, #2469** (merged in .30.01): a wait ends when the build is put off; a late draw cannot reopen the next frame's budget. Kept as they are. - **66124155** (main, v2026.11.30.02): `VICTORY_PIPELINE_WAIT_ALL`, every draw waits for its pipeline as a pass over the screen (up to 10 s a frame), because dropped draws took stands of trees away for a second. This branch keeps that default. The 100 ms cap for draws with a fallback applies only with `WAIT_ALL=0`, and the waited-on-first move works in the screen list that `WAIT_ALL` puts every draw in. - **#3788** (ours, open): a pass over the screen holds frames for its 10 s once in all. Complementary: this branch leaves passes over the screen alone. Both change `wait()`. #3788 already conflicts with main in `make.rs`, and with this branch in the same place. - **#3702** (ours, open): early library saves on a cold run (200 pipelines or 30 s). Complementary to the follow-up save here, which covers warm runs whose bursts fall inside the save interval. #3702 already conflicts with main in `library.rs` (it is on 41adb551), not newly with this branch. - **#3700** (stasadance, open): a dispatch waits for a compute pipeline a worker is making at most the frame's compute wait. Merges cleanly with main and **conflicts with this branch** in one hunk of `ready()`. To resolve, keep the boost around #3700's `wait_made`. - Note: #3700 drops a dispatch after up to 3 s, the same risk class as #2580's revert. - **#3398** (Revono), **#3677** (CDworks-Design), **#3474** (nyxctura), **#3426** (dexifried), **#3703** (ours, the long-frame line): all already conflict with main in `make.rs` (on 41adb551). This branch adds no new conflicting files for them. - #3703 feeds its pipeline-wait counters in `wait()` and the inline compute make. A rebase onto this branch puts its feed around the new waiters code. - **#1748** (101Leafy): `VICTORY_PIPELINE_ASKED_WORKERS` is already on main. Those workers take the new `blocked` list too. - **#3744** (stasadance, open): menu warm-up, a different place (the menus). **#3581** (BaRian29, open): every pipeline made ahead from the launcher. **#1989** (NotADonky43, open): first-use history saved separately. **#3974** (danielsteman, open): masked twins booked. None touches the queue or the waits; #1989 merges cleanly. - No open PR found that queues a pipeline's siblings (same shaders, other state), that moves a waited-on request to the front of the queue, or that saves a held-back library save later. ## AI use Claude Code (Claude Opus 5.5) wrote the change and its unit tests, resolved the cherry-pick of #3819 onto main, ran the checks listed above, and wrote this note. Nothing was run in game. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
IRennie74 commented 2026-11-30 18:23:08 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-11-30T18:23:08Z.


The waited-on-first queue and raising the worker a dispatch blocks on both look like clear wins: nothing is dropped that main would not drop. My concern is with siblings being on by default (VICTORY_PIPELINE_SIBLINGS, 8), since the PR says those defaults are "picked, not measured".

  • Compile memory. On a Ryzen 5 5600X + RTX 3060 12 GB + 32 GB (Series S), compiles do hit memory limits in play:

    • the memory guard puts compiles off (a wait on one of those used to last up to 10 s before the make.rs fix);
    • the driver refused pipelines for memory, and they had to be made again (refused.rs).

    Eight speculative siblings per new first use add driver compiles in exactly the bursts (cuts, new areas) where those limits are reached. keep_free helps with the workers, but not with the driver's memory.

  • CPU. On that 6-core the CPU is close to saturation in the world (the title about 3 cores, list threads 1.7). sibling_limit gives 2 of 9 workers to guesses. They run below the title, but they still take the cores that the boosted, waited-on build and our submitting thread compete for.

  • Library growth. Every sibling that is made goes into the library and is saved with it. The PR already notes 100 s save intervals at 1.3 GB and 6 min at 4.78 GB.

Could siblings ship with 0 as the default (or behind asked_for!) until a run reports found_made / queued from the new line? The rest of the PR does not depend on them.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7287771489 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4255#issuecomment-7287771489). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-11-30T18:23:08Z. --- The waited-on-first queue and raising the worker a dispatch blocks on both look like clear wins: nothing is dropped that main would not drop. My concern is with siblings being on by default (`VICTORY_PIPELINE_SIBLINGS`, 8), since the PR says those defaults are "picked, not measured". - **Compile memory.** On a Ryzen 5 5600X + RTX 3060 12 GB + 32 GB (Series S), compiles do hit memory limits in play: - the memory guard puts compiles off (a wait on one of those used to last up to 10 s before the `make.rs` fix); - the driver refused pipelines for memory, and they had to be made again (`refused.rs`). Eight speculative siblings per new first use add driver compiles in exactly the bursts (cuts, new areas) where those limits are reached. `keep_free` helps with the workers, but not with the driver's memory. - **CPU.** On that 6-core the CPU is close to saturation in the world (the title about 3 cores, list threads 1.7). `sibling_limit` gives 2 of 9 workers to guesses. They run below the title, but they still take the cores that the boosted, waited-on build and our submitting thread compete for. - **Library growth.** Every sibling that is made goes into the library and is saved with it. The PR already notes 100 s save intervals at 1.3 GB and 6 min at 4.78 GB. Could siblings ship with `0` as the default (or behind `asked_for!`) until a run reports `found_made / queued` from the new line? The rest of the PR does not depend on them.
trustno1-coder commented 2026-12-01 18:44:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:44:58Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321467890 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4255#issuecomment-7321467890). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:44:58Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!4255
No description provided.