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

Open
mrp1no wants to merge 2 commits from upstream-pr/1268 into main
mrp1no commented 2026-11-28 16:46:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mrp1no on 2026-11-28T16:46:57Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5542436070 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268). Originally posted by [mrp1no](https://github.com/mrp1no) on 2026-11-28T16:46:57Z. --- **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)
cxy0072019-sketch commented 2026-11-28 17:30:28 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cxy0072019-sketch on 2026-11-28T17:30:28Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7243069655 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7243069655). Originally posted by [cxy0072019-sketch](https://github.com/cxy0072019-sketch) on 2026-11-28T17:30:28Z. --- 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.
mrp1no commented 2026-11-28 18:37:50 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mrp1no on 2026-11-28T18:37:50Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7243936536 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7243936536). Originally posted by [mrp1no](https://github.com/mrp1no) on 2026-11-28T18:37:50Z. --- 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.
NotADonky43 commented 2026-11-29 05:32:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by NotADonky43 on 2026-11-29T05:32:31Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7251313904 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7251313904). Originally posted by [NotADonky43](https://github.com/NotADonky43) on 2026-11-29T05:32:31Z. --- 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.
trustno1-coder commented 2026-11-29 08:28:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-29T08:28:11Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7253124204 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7253124204). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-29T08:28:11Z. --- 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.
Marsietiss commented 2026-11-29 20:29:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Marsietiss on 2026-11-29T20:29:29Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7262121855 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1268#issuecomment-7262121855). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-11-29T20:29:29Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1268:upstream-pr/1268'
git switch 'upstream-pr/1268'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1268'
git switch 'upstream-pr/1268'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1268'
git switch 'upstream-pr/1268'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1268'
git switch 'main'
git merge --squash 'upstream-pr/1268'
git switch 'main'
git merge --ff-only 'upstream-pr/1268'
git switch 'main'
git merge 'upstream-pr/1268'
git push origin 'main'
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!1268
No description provided.