Persist first-use pipeline history without serializing the driver library #1989

Open
NotADonky43 wants to merge 1 commit from upstream-pr/1989 into main
NotADonky43 commented 2026-11-29 05:56:34 +00:00 (Migrated from github.com)

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


Fixes #1982. A burst of new actual-use keys starts one background writer. It coalesces observations for one second, merges with the on-disk set under a cross-process lock, and atomically replaces only early-pipelines.txt. Clean processes (including warm workers) do not publish. Failures leave a pending retry; a forced save also flushes pending hints. No changes to sampler safety, dispatch ordering, shader translation, or the pressured native-library save interval. Abrupt termination before the first checkpoint can still lose uncheckpointed observations. Native test covers locked-file retry, racing observation, preservation of existing keys, and no-op clean flush. Real Windows RTX 5070 Ti test on cumulative 8388c62b: seeded a private run with 1627 hints, observed 1629 before closing at the checkpoint. Native library SHA256 unchanged. A second process loaded the 1629-key list. Normal cumulative start with 1787 hints reached six heavy rendering windows. No title data or cache contents attached. Related performance evidence in #1268; this PR verifies persistence, not a new FPS gain.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5548076058 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1989). Originally posted by [NotADonky43](https://github.com/NotADonky43) on 2026-11-29T05:56:34Z. --- Fixes #1982. A burst of new actual-use keys starts one background writer. It coalesces observations for one second, merges with the on-disk set under a cross-process lock, and atomically replaces only early-pipelines.txt. Clean processes (including warm workers) do not publish. Failures leave a pending retry; a forced save also flushes pending hints. No changes to sampler safety, dispatch ordering, shader translation, or the pressured native-library save interval. Abrupt termination before the first checkpoint can still lose uncheckpointed observations. Native test covers locked-file retry, racing observation, preservation of existing keys, and no-op clean flush. Real Windows RTX 5070 Ti test on cumulative 8388c62b: seeded a private run with 1627 hints, observed 1629 before closing at the checkpoint. Native library SHA256 unchanged. A second process loaded the 1629-key list. Normal cumulative start with 1787 hints reached six heavy rendering windows. No title data or cache contents attached. Related performance evidence in #1268; this PR verifies persistence, not a new FPS gain.
Nazzgy commented 2026-11-29 11:22:33 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Nazzgy on 2026-11-29T11:22:33Z.


Independent reproduction on the unpatched 829188e Series S build under low Windows commit headroom. Two full PSO keys kept recurring in draw-drop records late in gameplay. Both were already in known-pipelines.bin, and both were missing from the early list and completed warm-up set. The run repeatedly took around half a second per frame while new compiles were being deferred.

A useful end-to-end case for this PR is a late PSO request that reaches the memory guard, followed by an exit before the next library save. Check that its exact key is already in early-pipelines.txt, the subsequent warm-up stores it, and the next game loads that library. Also check the rendered 3D scene before comparing FPS. A white or dark world can still present successfully with a visible HUD and FPS counter.

Targeted warm-up follow-up on the same 829188e executable and checkpoint with the same Series S window settings. A private copy of the library stored all 12 observed keys and loaded on the following run. The two recurring keys stopped appearing in draw-drop logs. From 120 to 180 seconds after the first DLSS upscale, one-second reports containing a frame of at least 480 ms went from 51 of 51 to 1 of 57. The draw counts differed in that interval, so this comparison characterizes the stall pattern in these runs. It documents why retaining late PSO keys matters for the next warm-up.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7255068443 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1989#issuecomment-7255068443). Originally posted by [Nazzgy](https://github.com/Nazzgy) on 2026-11-29T11:22:33Z. --- Independent reproduction on the unpatched 829188e Series S build under low Windows commit headroom. Two full PSO keys kept recurring in draw-drop records late in gameplay. Both were already in known-pipelines.bin, and both were missing from the early list and completed warm-up set. The run repeatedly took around half a second per frame while new compiles were being deferred. A useful end-to-end case for this PR is a late PSO request that reaches the memory guard, followed by an exit before the next library save. Check that its exact key is already in early-pipelines.txt, the subsequent warm-up stores it, and the next game loads that library. Also check the rendered 3D scene before comparing FPS. A white or dark world can still present successfully with a visible HUD and FPS counter. Targeted warm-up follow-up on the same 829188e executable and checkpoint with the same Series S window settings. A private copy of the library stored all 12 observed keys and loaded on the following run. The two recurring keys stopped appearing in draw-drop logs. From 120 to 180 seconds after the first DLSS upscale, one-second reports containing a frame of at least 480 ms went from 51 of 51 to 1 of 57. The draw counts differed in that interval, so this comparison characterizes the stall pattern in these runs. It documents why retaining late PSO keys matters for the next warm-up.
ArturoWolff commented 2026-11-29 11:28:26 +00:00 (Migrated from github.com)

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


Corroborating Nazzgy's late-PSO history result on Linux/Proton, with two retained runs of unmodified 829188e9 (RTX 4060 8 GB, 16 GB RAM, GE-Proton 11-14). Both used the same ordinary starting profile and effective rendering settings, including requested RT, full write-back and DLSS/FG off. The second seeded the first run's ordinary application caches, not its driver cache. Both reached a defective opening cinematic, not rendered gameplay; the guard remained enabled.

I compared the exact distinct keys in the normal capped draws dropped for pipelines not made yet records with each retired run's early-pipelines.txt and slow-pipelines.txt, without changing either list.

Retained observation Cold Application-cache seeded
Drop-log records 12 20
Distinct reported pipeline keys 106 140
Distinct retained early keys 10 11
Distinct retained slow keys 1 1
Reported drop keys absent from both lists 106 140
Of those, reported in at least two drop-log records 23 46
Drop-log records after the last successful library save 12 / 12 20 / 20

The receiving baseline's ready already records demand before the PSO is ready; note_used marks new keys dirty. But the persisted early list still depends on the successful native-library/slow-list writes. This is consistent with the late-history gap in #1982 and explains why a nonempty but incomplete early list is not evidence of useful prewarm coverage.

The log exposes at most 16 distinct keys per emitted record, and not every frame is logged. These are lower bounds, not the full requested set or a count of driver allocation failures. I have not established that every missing key has a persisted recipe, tested this PR, or obtained a matched prewarm/gameplay improvement. I agree with the proposed request-after-save regression: verify persistence of late requested keys independently, then distinguish described recipes, successful native PSO creation/storage, loads on the next clean start, and actual scene progress. This also seems useful for the separate RT preparation/restart work in #2148. No raw keys, shader bytes or cache contents attached.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7255135441 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1989#issuecomment-7255135441). Originally posted by [ArturoWolff](https://github.com/ArturoWolff) on 2026-11-29T11:28:26Z. --- Corroborating Nazzgy's late-PSO history result on Linux/Proton, with two retained runs of unmodified `829188e9` (RTX 4060 8 GB, 16 GB RAM, GE-Proton 11-14). Both used the same ordinary starting profile and effective rendering settings, including requested RT, full write-back and DLSS/FG off. The second seeded the first run's ordinary application caches, not its driver cache. Both reached a defective opening cinematic, not rendered gameplay; the guard remained enabled. I compared the exact distinct keys in the normal capped `draws dropped for pipelines not made yet` records with each retired run's `early-pipelines.txt` and `slow-pipelines.txt`, without changing either list. | Retained observation | Cold | Application-cache seeded | | --- | ---: | ---: | | Drop-log records | 12 | 20 | | Distinct reported pipeline keys | 106 | 140 | | Distinct retained early keys | 10 | 11 | | Distinct retained slow keys | 1 | 1 | | Reported drop keys absent from **both** lists | 106 | 140 | | Of those, reported in at least two drop-log records | 23 | 46 | | Drop-log records after the last successful library save | 12 / 12 | 20 / 20 | The receiving baseline's [`ready`](https://github.com/trustno1-coder/VIctory-NVIDIA/blob/829188e969ffd2907e5867c5d9aca29bd91cb1b6/crates/victory-gpu/src/pipeline/make.rs#L575-L588) already records demand before the PSO is ready; [`note_used`](https://github.com/trustno1-coder/VIctory-NVIDIA/blob/829188e969ffd2907e5867c5d9aca29bd91cb1b6/crates/victory-gpu/src/pipeline/library.rs#L1456-L1463) marks new keys dirty. But the [persisted early list](https://github.com/trustno1-coder/VIctory-NVIDIA/blob/829188e969ffd2907e5867c5d9aca29bd91cb1b6/crates/victory-gpu/src/pipeline/library.rs#L1128-L1144) still depends on the successful native-library/slow-list writes. This is consistent with the late-history gap in #1982 and explains why a nonempty but incomplete early list is not evidence of useful prewarm coverage. The log exposes at most 16 distinct keys per emitted record, and not every frame is logged. These are lower bounds, not the full requested set or a count of driver allocation failures. I have not established that every missing key has a persisted recipe, tested this PR, or obtained a matched prewarm/gameplay improvement. I agree with the proposed request-after-save regression: verify persistence of late requested keys independently, then distinguish described recipes, successful native PSO creation/storage, loads on the next clean start, and actual scene progress. This also seems useful for the separate [RT preparation/restart work in #2148](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2148#issuecomment-7254926703). No raw keys, shader bytes or cache contents attached. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
andrewpozdnakov7-jpg commented 2026-12-01 10:40:04 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T10:40:04Z.


I cherry-picked your fd1732f5 onto current main 5fabb46e, preserving your Git authorship. The two conflicts were in library.rs, where main now orders periodic and shutdown saves and uses the adapter-scoped save_library. The rebased commit keeps that flow and checkpoints early-pipelines.txt separately. The new early_history.rs is byte-for-byte identical to your patch. Rebased commit 7dc512d2056b1a5785dfc8f2b3fa22e0a83fbb43

On Windows/MSVC with Rust 1.98.1, the exact checkpoint_retries_without_losing_old_or_concurrently_observed_keys regression passed. It covers a sharing conflict, existing entries and an observation racing the checkpoint. cargo xtask policy --staged passed for the two changed files.

The branch is ready for your review and for use in this PR if you agree with the conflict resolution.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7308529196 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1989#issuecomment-7308529196). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-12-01T10:40:04Z. --- I cherry-picked your `fd1732f5` onto current `main` `5fabb46e`, preserving your Git authorship. The two conflicts were in `library.rs`, where `main` now orders periodic and shutdown saves and uses the adapter-scoped `save_library`. The rebased commit keeps that flow and checkpoints `early-pipelines.txt` separately. The new `early_history.rs` is byte-for-byte identical to your patch. [Rebased commit `7dc512d2056b1a5785dfc8f2b3fa22e0a83fbb43`](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/commit/7dc512d2056b1a5785dfc8f2b3fa22e0a83fbb43) On Windows/MSVC with Rust 1.98.1, the exact `checkpoint_retries_without_losing_old_or_concurrently_observed_keys` regression passed. It covers a sharing conflict, existing entries and an observation racing the checkpoint. `cargo xtask policy --staged` passed for the two changed files. The branch is ready for your review and for use in this PR if you agree with the conflict resolution. AI-assisted with OpenAI Codex.
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/1989:upstream-pr/1989'
git switch 'upstream-pr/1989'

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