Pipelines: the early list started from the book at the title's first pipeline (builds on #1114) #1268

Open
github-bot wants to merge 2 commits from github-bot/gh-1268 into main AGit
Owner

@⁠mrp1no on GitHub · 2026-11-28 16:46 UTC · original
mrp1no:pipeline-prefetch → main · +262 −26 · 6 files · 2 commits · open

Builds on #1114 (its commit is the first one here); only the last commit is new. Without #1114 there is nothing to gain: the pipelines with static samplers are compiled at every start, and those compiles set the pace. Measured: 1,301 made, the queue empty 205 s after the world's first frame, as without this.

What happens

The early list (early-pipelines.txt: the pipelines earlier runs drew with) is started when the title creates each pipeline. The title creates about 1,400 of them at its start, and about 900 more only when it loads a save, a few seconds before the world's first frame. Those 900 are loaded from the library then. While the title's threads run, a load takes 0.1-0.2 s on the lowest-priority workers.

Measured with #1114 alone on an RTX 3060 (driver 621.40), i7-11700K, 32 GB, Series S, 720p:

  • 150 pipelines were still queued at the world's first frame.
  • The world came in at 3-15 fps.
  • The queue emptied 43-60 s after that frame.

What this changes

  • Prefetch at the title's first pipeline. The early list's pipelines are described from known-pipelines.bin (the book VICTORY_PIPELINE_BOOK=1 keeps; play turns it on) and started at once, on a thread of their own: 2,383 described in 0.2-0.3 s. They load during the logos and the menu.
  • One pending pipeline per key. When the title creates one of them, make::adopt gives it the same pending pipeline, so each is loaded once. Only keys on the early list are shared; every other pipeline gets its own, as now.
  • VICTORY_PIPELINE_PREFETCH=0: as before.
  • The library's save line also says how long a load and a make took on average (load_ms_each, make_ms_each).

Measured (same PC, same save, warm library)

Start Queued at the world's first frame Queue empty after it
#1114 alone about 150 43-60 s
#1114 + this, 3 starts 2 / 96 / 19 7 / 41 / 21 s

It varies with how soon the save is loaded after the menu (Enter was pressed by a script within seconds).

Tests

  • pipeline::make::tests::a_pipeline_made_ready_is_the_one_the_title_gets (new): a key on the early list gives one pending pipeline; any other key gives each its own.
  • cargo test -p victory-gpu --lib -- pipeline::: 28 passed.
  • cargo clippy -p victory-gpu --all-targets: only the shadow.rs warning that main has.

🤖 Generated with Claude Code

**@⁠mrp1no** on GitHub · 2026-11-28 16:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268) `mrp1no:pipeline-prefetch` → `main` · +262 −26 · 6 files · 2 commits · open **Builds on #1114** (its commit is the first one here); only the last commit is new. Without #1114 there is nothing to gain: the pipelines with static samplers are compiled at every start, and those compiles set the pace. Measured: 1,301 made, the queue empty 205 s after the world's first frame, as without this. ## What happens The early list (`early-pipelines.txt`: the pipelines earlier runs drew with) is started when the title *creates* each pipeline. The title creates about 1,400 of them at its start, and about 900 more only when it loads a save, a few seconds before the world's first frame. Those 900 are loaded from the library then. While the title's threads run, a load takes 0.1-0.2 s on the lowest-priority workers. Measured with #1114 alone on an RTX 3060 (driver 621.40), i7-11700K, 32 GB, Series S, 720p: - 150 pipelines were still queued at the world's first frame. - The world came in at 3-15 fps. - The queue emptied 43-60 s after that frame. ## What this changes - **Prefetch at the title's first pipeline.** The early list's pipelines are described from `known-pipelines.bin` (the book `VICTORY_PIPELINE_BOOK=1` keeps; `play` turns it on) and started at once, on a thread of their own: 2,383 described in 0.2-0.3 s. They load during the logos and the menu. - **One pending pipeline per key.** When the title creates one of them, `make::adopt` gives it the same pending pipeline, so each is loaded once. Only keys on the early list are shared; every other pipeline gets its own, as now. - `VICTORY_PIPELINE_PREFETCH=0`: as before. - The library's save line also says how long a load and a make took on average (`load_ms_each`, `make_ms_each`). ## Measured (same PC, same save, warm library) | Start | Queued at the world's first frame | Queue empty after it | |---|---|---| | #1114 alone | about 150 | 43-60 s | | #1114 + this, 3 starts | 2 / 96 / 19 | 7 / 41 / 21 s | It varies with how soon the save is loaded after the menu (Enter was pressed by a script within seconds). ## Tests - `pipeline::make::tests::a_pipeline_made_ready_is_the_one_the_title_gets` (new): a key on the early list gives one pending pipeline; any other key gives each its own. - `cargo test -p victory-gpu --lib -- pipeline::`: 28 passed. - `cargo clippy -p victory-gpu --all-targets`: only the `shadow.rs` warning that main has. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pipelines with static samplers never went into the library (7fa0e95): a
pipeline loaded in another process read through the samplers at its
places in that process's driver table. Since the samplers of the list
are made first in one order (`samplers::prime`), those places are the
same in every process. On an RTX 3060 (driver 621.40) the driver's own
cache did not find these pipelines either: about 1,100 were made at
every start, 2.2 s each (median), 4.5 minutes at 3.5 fps in the world.

- A pipeline whose static samplers were all made by `prime` is loaded
  from and stored in the library, under a name that holds their places.
  Samplers met later in a run may come after the layer's own (composite,
  tiles): pipelines with them are made as before, and kept from the next
  start on. VICTORY_LIBRARY_STATIC_SAMPLERS=0 keeps none (as before),
  =1 keeps all (as before 7fa0e95).
- A pipeline listed as slow that comes in under SLOW_MS (loaded from the
  library) leaves slow-pipelines.txt: listed, it waited behind the
  quarter of the workers slow ones may have at every start.

lut3d_probe on the RTX 3060: stored and loaded with the same ten samplers
made first, 64 of 64 samples filtered; loaded after ten others, 0 of 64
(the fault 7fa0e95 avoids).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At the title's first pipeline, the early list's pipelines (those earlier
runs drew with) are described from known-pipelines.bin and started at once;
when the title creates one of them it gets the same pending pipeline
(make::adopt), so each is loaded once. The title creates about 900 of them
only when it loads a save, seconds before the world's first frame.
VICTORY_PIPELINE_PREFETCH=0: started only at the title's creation, as before.
The library's save line says how long a load and a make took on average.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 16:47:19 +00:00
Author
Owner

@⁠cxy0072019-sketch on GitHub · 2026-11-28 17:30 UTC · original

I ran a paired startup check on an RTX 5070 Ti (621.24) with an i5-14600KF, Series S mode, and 1080p output. Both runs used the same executable with #1114, identical copies of a recorded pipeline library and story save, separate driver cache directories, DLSS Quality, and 3× frame generation. The startup input script was the same.

Startup measure Prefetch off Prefetch on
First meter sample with at least 3,000 draws, after launch 69.24 s 68.81 s
Pending pipelines at that sample 702 677
Time from that sample to the first of three successive zero-pending samples 127.25 s 152.34 s

The enabled run logged wanted=2664 described=2627 started=2615 ms=244. I did not reproduce a faster queue drain in this pair. The meter reports roughly every five seconds, and the first qualifying samples had different draw counts (6,315 and 8,595), so this is one startup observation on this configuration. Both queues were empty by the later doorway test. The enabled run needed an extra reposition at the handle, which makes the two doorway FPS samples unsuitable for estimating the effect of prefetch.

**@⁠cxy0072019-sketch** on GitHub · 2026-11-28 17:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7243069655) I ran a paired startup check on an RTX 5070 Ti (621.24) with an i5-14600KF, Series S mode, and 1080p output. Both runs used the same executable with #1114, identical copies of a recorded pipeline library and story save, separate driver cache directories, DLSS Quality, and 3× frame generation. The startup input script was the same. | Startup measure | Prefetch off | Prefetch on | | --- | ---: | ---: | | First meter sample with at least 3,000 draws, after launch | 69.24 s | 68.81 s | | Pending pipelines at that sample | 702 | 677 | | Time from that sample to the first of three successive zero-pending samples | 127.25 s | 152.34 s | The enabled run logged `wanted=2664 described=2627 started=2615 ms=244`. I did not reproduce a faster queue drain in this pair. The meter reports roughly every five seconds, and the first qualifying samples had different draw counts (6,315 and 8,595), so this is one startup observation on this configuration. Both queues were empty by the later doorway test. The enabled run needed an extra reposition at the handle, which makes the two doorway FPS samples unsuitable for estimating the effect of prefetch.
Author
Owner

@⁠mrp1no on GitHub · 2026-11-28 18:37 UTC · original

Thanks for the paired run. Your setup is the case where this cannot help, and I should have said so more plainly in the description.

With separate, fresh driver caches, about 700 pipelines were still pending at the first 3,000-draw sample in both runs. That queue is set by compiles, not loads:

  • Prefetch only starts work earlier. A compile still takes its seconds, and once both runs are in the world the workers have the same queue to get through.
  • Here, with a warm library, 2 / 96 / 19 were pending at the world's first frame over three starts, against about 150 without prefetch.

The library's save line now tells the two cases apart. Could you look at host pipeline library saved ... made=… loaded=… load_ms_each=… make_ms_each=… near the end of each log?

  • Mostly made with make_ms_each of a second or more: the drain is compile-bound, and the same with or without this.
  • Mostly loaded at tens of milliseconds each: that is the case this targets.

A second start on the same driver caches, with the library from the first, would show it.

**@⁠mrp1no** on GitHub · 2026-11-28 18:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7243936536) Thanks for the paired run. Your setup is the case where this cannot help, and I should have said so more plainly in the description. With separate, fresh driver caches, about 700 pipelines were still pending at the first 3,000-draw sample in both runs. That queue is set by compiles, not loads: - Prefetch only starts work earlier. A compile still takes its seconds, and once both runs are in the world the workers have the same queue to get through. - Here, with a warm library, 2 / 96 / 19 were pending at the world's first frame over three starts, against about 150 without prefetch. The library's save line now tells the two cases apart. Could you look at `host pipeline library saved ... made=… loaded=… load_ms_each=… make_ms_each=…` near the end of each log? - Mostly `made` with `make_ms_each` of a second or more: the drain is compile-bound, and the same with or without this. - Mostly `loaded` at tens of milliseconds each: that is the case this targets. A second start on the same driver caches, with the library from the first, would show it.
github-bot force-pushed github-bot/gh-1268 from 72658a4434 to 4a18c322cc 2026-11-29 03:33:37 +00:00 Compare
Author
Owner

@⁠NotADonky43 on GitHub · 2026-11-29 05:32 UTC · original

Independent evidence on early recipe coverage, not a test of this PR or #1114. RTX 5070 Ti, cumulative 901559a4, Series X opening, same precompiled shader seed (25,728 entries) and 110,956,160-byte native library. Followed the exact recordings delaying queued presents. One 2.58 s gap overlapped 2.44 s of a required pipeline wait; its one native creation took 2.81 s. It correctly bypassed the cross-process library for static samplers. Other slow keys really missed library lookup. Nine keys on the blocking recordings were all absent from the 1,550-entry early list; eight were present in independent prior compatible run histories. Changing only the private early list to the 1,787-key union, those eight built in both treatment openings, with no recorded >=2 ms first-use wait on the cohort in either. Total >=2 ms worker waits were 18.21 vs 0.50 and 6.63 vs 3.50 summed seconds (not wall time). Median reported p95 was 74.4 vs 64.3 and 59.65 vs 60.1 ms; different shots, warmed launch order base/union/base/union. Long opening gaps remained. Does not justify loading unsafe static sampler PSOs across processes or disabling required waits. It suggests preserving lightweight actual-use history independently of the heavyweight native-library save is worth investigating, particularly for sessions that close under pressure before another save. No game-derived keys, shaders or caches attached.

**@⁠NotADonky43** on GitHub · 2026-11-29 05:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7251313904) Independent evidence on early recipe coverage, **not a test of this PR or #1114**. RTX 5070 Ti, cumulative 901559a4, Series X opening, same precompiled shader seed (25,728 entries) and 110,956,160-byte native library. Followed the exact recordings delaying queued presents. One 2.58 s gap overlapped 2.44 s of a required pipeline wait; its one native creation took 2.81 s. It correctly bypassed the cross-process library for static samplers. Other slow keys really missed library lookup. Nine keys on the blocking recordings were all absent from the 1,550-entry early list; eight were present in independent prior compatible run histories. Changing **only** the private early list to the 1,787-key union, those eight built in both treatment openings, with no recorded >=2 ms first-use wait on the cohort in either. Total >=2 ms worker waits were 18.21 vs 0.50 and 6.63 vs 3.50 summed seconds (not wall time). Median reported p95 was 74.4 vs 64.3 and 59.65 vs 60.1 ms; different shots, warmed launch order base/union/base/union. Long opening gaps remained. Does not justify loading unsafe static sampler PSOs across processes or disabling required waits. It suggests preserving lightweight actual-use history independently of the heavyweight native-library save is worth investigating, particularly for sessions that close under pressure before another save. No game-derived keys, shaders or caches attached.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-29 08:28 UTC · original

Thank you! An earlier version of this pull request was merged into main with its original commits and is part of v2026.11.29.01, where you are credited. GitHub does not show it as merged because new commits were pushed here after that merge. It stays open so those newer commits can be looked at next.

**@⁠trustno1-coder** on GitHub · 2026-11-29 08:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7253124204) Thank you! An earlier version of this pull request was merged into main with its original commits and is part of [v2026.11.29.01](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.29.01), where you are credited. GitHub does not show it as merged because new commits were pushed here after that merge. It stays open so those newer commits can be looked at next.
Author
Owner

@⁠Marsietiss on GitHub · 2026-11-29 20:29 UTC · original

Hi, a note from a fork. We took the idea of this PR (start the early list at the title's first pipeline, on its own thread) and built our own version of it. It is on by default in our pre-release: https://github.com/Marsietiss/Mangrove/releases/tag/v0.3.0-dev.1

One limit we found: on an empty cache the prefetch starts nothing, because it needs a book with the shaders, so a true first start does not get it from this alone. Whether a player's own book helps on later starts is not measured yet.

What helped a first start most was the rest of the batch: more workers, a slow lane, compute and base pipelines first, a seeded early list, and holding the first world frames briefly. The seeded list idea comes from ScarlettPort #154 and #254 (ZigZagBoi1/ScarlettPort); the rest is ours.

Dropped draws on a first start, one run each, RTX 5080 + Ryzen 9 9950X3D, Series S mode, fresh exe name (cold driver cache), empty pipeline cache, empty save, not a ranking:

  • no speedups: 76,472 (waits up to about 45 s, heads and faces missing)
  • first batch: 4,914
  • 0.3 check without books: 8,456
  • cold first start of the 0.3 code: 9,374 (cut short)
  • with a local pipeline book (players do not have one): 797

So roughly 8-15x fewer dropped draws on a first start. Thanks for the idea.

**@⁠Marsietiss** on GitHub · 2026-11-29 20:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7262121855) Hi, a note from a fork. We took the idea of this PR (start the early list at the title's first pipeline, on its own thread) and built our own version of it. It is on by default in our pre-release: https://github.com/Marsietiss/Mangrove/releases/tag/v0.3.0-dev.1 One limit we found: on an empty cache the prefetch starts nothing, because it needs a book with the shaders, so a true first start does not get it from this alone. Whether a player's own book helps on later starts is not measured yet. What helped a first start most was the rest of the batch: more workers, a slow lane, compute and base pipelines first, a seeded early list, and holding the first world frames briefly. The seeded list idea comes from ScarlettPort #154 and #254 (ZigZagBoi1/ScarlettPort); the rest is ours. Dropped draws on a first start, one run each, RTX 5080 + Ryzen 9 9950X3D, Series S mode, fresh exe name (cold driver cache), empty pipeline cache, empty save, not a ranking: - no speedups: 76,472 (waits up to about 45 s, heads and faces missing) - first batch: 4,914 - 0.3 check without books: 8,456 - cold first start of the 0.3 code: 9,374 (cut short) - with a local pipeline book (players do not have one): 797 So roughly 8-15x fewer dropped draws on a first start. Thanks for the idea.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline/known.rs
  • crates/victory-gpu/src/pipeline/library.rs
  • crates/victory-gpu/src/pipeline/make.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1268/head:github-bot/gh-1268'
git switch 'github-bot/gh-1268'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1268'
git switch 'github-bot/gh-1268'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1268'
git switch 'github-bot/gh-1268'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1268'
git switch 'main'
git merge --squash 'github-bot/gh-1268'
git switch 'main'
git merge --ff-only 'github-bot/gh-1268'
git switch 'main'
git merge 'github-bot/gh-1268'
git push origin 'main'
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!1268
No description provided.