Pipeline library: no rebuild at the end of a run shorter than 10 minutes (a preload was thrown away a minute later) #3459

Open
OGShotz wants to merge 1 commit from upstream-pr/3459 into main
OGShotz commented 2026-11-29 23:31:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by OGShotz on 2026-11-29T23:31:16Z.


What it changes

At the end of a run the pipeline library is rebuilt from the pipelines that run used, once it is larger than VICTORY_LIBRARY_KEEP_MB (compact). A run that ended at the menu was meant to leave it alone: COMPACT_LEAST asks for 1,000 used pipelines.

That count no longer tells a menu run apart. The early list's pipelines are started from the book at the title's first pipeline (make::prefetch), so they are live within a minute. On 2026-11-29 a run closed one minute after a preload, at the menu, had 4,477 live and rebuilt a 1.48 GB library of 14,663 pipelines into 241 MB of 3,662 (before=1484661916 after=241460424 kept=3662). The preload's work was gone.

A run now also needs 10 minutes (COMPACT_AFTER_MS, from host::now_ms) before the library is rebuilt. The "not rebuilt" line gives the run's length.

How it was tested

  • GPU and profile: RTX 2070 8 GB + Ryzen 7 3700X, Windows 11, Series S, DLSS Balanced, no frame generation, no ray tracing.
  • Before: the run above (a preload, then about one minute at the menu): the library went from 1.48 GB to 241 MB at exit.
  • After: not seen in a short run yet; the next run that started from a full library (1.24 GB) ended in an unrelated crash, so no rebuild ran. The decision itself is covered by only_large_libraries_of_runs_that_reached_the_world_are_rebuilt, which now also checks a run of 66 s with 4,477 pipelines (not rebuilt) and a run of exactly 10 minutes (rebuilt).
  • For shader changes, the wave sizes tested: no shader changes.
  • cargo test passed for the crates it touches: on this branch (main 716a0c99 + this commit), cargo test --release -p victory-gpu --lib library 16 passed. The whole victory-gpu lib suite: 913 passed, 2 failed, the same 2 that fail on main without this change (every_switch_of_the_translator_is_in_the_key, stale names in its lists, see #3210; places_written_after_sending_are_learned, which passes alone).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #2577 changes the same rebuild: it counts unique LIVE pipelines in compacts() and takes the library writer lock in compact(). That does not catch this case (the 4,477 were unique), and the two merge without conflict.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556334895 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3459). Originally posted by [OGShotz](https://github.com/OGShotz) on 2026-11-29T23:31:16Z. --- ## What it changes At the end of a run the pipeline library is rebuilt from the pipelines that run used, once it is larger than `VICTORY_LIBRARY_KEEP_MB` (`compact`). A run that ended at the menu was meant to leave it alone: `COMPACT_LEAST` asks for 1,000 used pipelines. That count no longer tells a menu run apart. The early list's pipelines are started from the book at the title's first pipeline (`make::prefetch`), so they are live within a minute. On 2026-11-29 a run closed one minute after a preload, at the menu, had 4,477 live and rebuilt a 1.48 GB library of 14,663 pipelines into 241 MB of 3,662 (`before=1484661916 after=241460424 kept=3662`). The preload's work was gone. A run now also needs 10 minutes (`COMPACT_AFTER_MS`, from `host::now_ms`) before the library is rebuilt. The "not rebuilt" line gives the run's length. ## How it was tested - GPU and profile: RTX 2070 8 GB + Ryzen 7 3700X, Windows 11, Series S, DLSS Balanced, no frame generation, no ray tracing. - Before: the run above (a preload, then about one minute at the menu): the library went from 1.48 GB to 241 MB at exit. - After: not seen in a short run yet; the next run that started from a full library (1.24 GB) ended in an unrelated crash, so no rebuild ran. The decision itself is covered by `only_large_libraries_of_runs_that_reached_the_world_are_rebuilt`, which now also checks a run of 66 s with 4,477 pipelines (not rebuilt) and a run of exactly 10 minutes (rebuilt). - For shader changes, the wave sizes tested: no shader changes. - `cargo test` passed for the crates it touches: on this branch (main 716a0c99 + this commit), `cargo test --release -p victory-gpu --lib library` 16 passed. The whole `victory-gpu` lib suite: 913 passed, 2 failed, the same 2 that fail on main without this change (`every_switch_of_the_translator_is_in_the_key`, stale names in its lists, see #3210; `places_written_after_sending_are_learned`, which passes alone). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #2577 changes the same rebuild: it counts unique LIVE pipelines in `compacts()` and takes the library writer lock in `compact()`. That does not catch this case (the 4,477 were unique), and the two merge without conflict. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrewpozdnakov7-jpg commented 2026-11-30 10:50:56 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-11-30T10:50:56Z.


I reproduced #3883 on release v2026.11.29.05 / main 41adb551 and repeated the same scenario with @OGShotz's 0b9d595 applied as 2e5d33d.

Native Windows WARP, diagnostics build. I populated a real D3D12 pipeline library with 5,000 generated names for one synthetic compute pipeline and set the limit to 1 MiB. A fresh process opened the file, loaded exactly 1,000 entries through library::pipeline, called library::finish within the first second, then deserialized the resulting file and checked every original name.

Build Bytes before Bytes after Entries loadable after exit
41adb551 3,201,760 641,760 1,000 / 5,000
41adb551 + this PR 3,201,760 3,201,760 5,000 / 5,000

The same assertion fails on main and passes with the PR. The existing pipeline::library tests passed 13/13 on both builds. The PR's boundary test still permits compaction at ten minutes when the original size and use thresholds are met.

@JSa25, if you can build with this PR, could you repeat the same short walk after preload --all at the default limit and share the final library line and file size? The WARP test covers the short-session path. A normal game run that reaches ten minutes can still discard entries it did not use.

The GitHub check stopped in workspace Clippy on the unused unwind_copy function in victory-loader. I reproduced that diagnostic previously on clean 41adb551. The CI test step was skipped.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7276163926 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3459#issuecomment-7276163926). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-30T10:50:56Z. --- I reproduced #3883 on release `v2026.11.29.05` / main `41adb551` and repeated the same scenario with @OGShotz's `0b9d595` applied as `2e5d33d`. Native Windows WARP, diagnostics build. I populated a real D3D12 pipeline library with 5,000 generated names for one synthetic compute pipeline and set the limit to 1 MiB. A fresh process opened the file, loaded exactly 1,000 entries through `library::pipeline`, called `library::finish` within the first second, then deserialized the resulting file and checked every original name. | Build | Bytes before | Bytes after | Entries loadable after exit | | --- | ---: | ---: | ---: | | `41adb551` | 3,201,760 | 641,760 | 1,000 / 5,000 | | `41adb551` + this PR | 3,201,760 | 3,201,760 | 5,000 / 5,000 | The same assertion fails on main and passes with the PR. The existing `pipeline::library` tests passed 13/13 on both builds. The PR's boundary test still permits compaction at ten minutes when the original size and use thresholds are met. @JSa25, if you can build with this PR, could you repeat the same short walk after `preload --all` at the default limit and share the final library line and file size? The WARP test covers the short-session path. A normal game run that reaches ten minutes can still discard entries it did not use. The [GitHub check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46323764654/job/141537701686) stopped in workspace Clippy on the unused `unwind_copy` function in `victory-loader`. I reproduced that diagnostic previously on clean `41adb551`. The CI test step was skipped. AI-assisted with OpenAI Codex.
OGShotz commented 2026-11-30 11:15:38 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by OGShotz on 2026-11-30T11:15:38Z.


Thanks @andrewpozdnakov7-jpg for reproducing #3883 and testing this so thoroughly. The 1,000-of-5,000 table on WARP shows the short-run loss clearly, and it's good to know the boundary test still allows compaction at ten minutes. A run from @JSa25 after preload --all at the default limit would be a great real-game check alongside it.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7276775184 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3459#issuecomment-7276775184). Originally posted by [OGShotz](https://github.com/OGShotz) on 2026-11-30T11:15:38Z. --- Thanks @andrewpozdnakov7-jpg for reproducing #3883 and testing this so thoroughly. The 1,000-of-5,000 table on WARP shows the short-run loss clearly, and it's good to know the boundary test still allows compaction at ten minutes. A run from @JSa25 after `preload --all` at the default limit would be a great real-game check alongside it.
andrewpozdnakov7-jpg commented 2026-11-30 15:45:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-11-30T15:45:19Z.


@OGShotz, I repeated the short-session check on v2026.11.30.01 (c71899d). This release writes the pipeline library to the adapter's own directory, so the fixture seeds and reopens that active file. WARP 1.0.22 used 5,000 generated entries, visited 1,000, and called finish in under a second.

Version Bytes before Bytes after Original entries still loadable
Release main 3,201,760 641,760 1,000 / 5,000
Release main + #3459 3,201,760 3,201,760 5,000 / 5,000

The library unit suite passed 20/20 on each revision. The patched suite includes the ten-minute boundary. Both local builds used the same temporary #4018 unit-test build fix.

Current release review branch contains only your change, with your Git author preserved. The staged asset check passed.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7283527142 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3459#issuecomment-7283527142). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-30T15:45:19Z. --- @OGShotz, I repeated the short-session check on `v2026.11.30.01` (`c71899d`). This release writes the pipeline library to the adapter's own directory, so the fixture seeds and reopens that active file. WARP 1.0.22 used 5,000 generated entries, visited 1,000, and called `finish` in under a second. | Version | Bytes before | Bytes after | Original entries still loadable | | --- | ---: | ---: | ---: | | Release main | 3,201,760 | 641,760 | 1,000 / 5,000 | | Release main + #3459 | 3,201,760 | 3,201,760 | 5,000 / 5,000 | The library unit suite passed 20/20 on each revision. The patched suite includes the ten-minute boundary. Both local builds used the same temporary [#4018](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4018) unit-test build fix. [Current release review branch](https://github.com/andrewpozdnakov7-jpg/VIctory-NVIDIA/tree/review/3459-preload-retention-301) contains only your change, with your Git author preserved. The staged asset check passed.
ajcorrea commented 2026-11-30 20:26:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ajcorrea on 2026-11-30T20:26:10Z.


+1 for this, from the user side.

Short runs right after a preload are exactly how testing goes: I just bisected a stutter regression (see #3733) with nine builds, each run 3–4 minutes on the same route. With the default VICTORY_LIBRARY_KEEP_MB=1024, a short run like that rewrites the library down to what it touched, and the next run builds the rest while playing, which is the very stutter being measured. One short test run quietly spoils the next one.

As a workaround I set VICTORY_LIBRARY_KEEP_MB=0 for the whole bisect: the library stayed at 1.07 GB across all nine runs, with 3,702 pipelines in early-pipelines.txt, and no run paid for the one before it.

RTX 3060 Ti 8 GB, Ryzen 7 7800X3D, 32 GB, Windows 11.

A minimum run length before rebuilding (your 10 minutes) looks like the right guard. Perhaps the run should also have to pass VICTORY_PRELOAD_USED_MIN pipelines, so a long session spent idle at the menu doesn't trigger a rebuild either.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7290910582 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3459#issuecomment-7290910582). Originally posted by [ajcorrea](https://github.com/ajcorrea) on 2026-11-30T20:26:10Z. --- +1 for this, from the user side. Short runs right after a preload are exactly how testing goes: I just bisected a stutter regression (see #3733) with nine builds, each run 3–4 minutes on the same route. With the default `VICTORY_LIBRARY_KEEP_MB=1024`, a short run like that rewrites the library down to what it touched, and the next run builds the rest while playing, which is the very stutter being measured. One short test run quietly spoils the next one. As a workaround I set `VICTORY_LIBRARY_KEEP_MB=0` for the whole bisect: the library stayed at 1.07 GB across all nine runs, with 3,702 pipelines in `early-pipelines.txt`, and no run paid for the one before it. RTX 3060 Ti 8 GB, Ryzen 7 7800X3D, 32 GB, Windows 11. A minimum run length before rebuilding (your 10 minutes) looks like the right guard. Perhaps the run should also have to pass `VICTORY_PRELOAD_USED_MIN` pipelines, so a long session spent idle at the menu doesn't trigger a rebuild either.
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/3459:upstream-pr/3459'
git switch 'upstream-pr/3459'

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