Pipeline library: a cold run saves it early (200 new pipelines, or 30 s in the world), not first after 180 s #3702
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3702"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T04:21:32Z.
Problem
A run that dies in its first minutes keeps none of the pipelines it made, and the next start is cold again.
save_while_busy()saves at most everyVICTORY_LIBRARY_SAVE_BUSY_S(180 s), and the first busy save of a run waits a full interval. The save when the queue runs dry never comes in such a run.VICTORY_LIBRARY_SAVE_MADE=N(#1679) is off by default, and only covers libraries under 64 MB at launch.the library did not load it: ... (0x80070057). A load answersE_INVALIDARGfor a name the library does not hold, which is the normal first time of a pipeline. #3050 read that line as "the pipeline library fails to load 72/72 entries".Fix
Early saves (
library.rs,save_while_busy). Two saves, each once a run, from the pipeline workers (the only callers ofsave_while_busy, threadsvictory-pipelines-N), never from the submitting thread:crate::world_since, the first frame of 500 draws), with at least one pipeline added.Gates, in
Early::due(a pure function, unit-tested):loads_running(), whateverVICTORY_LIBRARY_SAVE_AFTER_LOADSsays). The serialise waits for the load and every later load waits behind the serialise (the comment's 20.8 s save and 15 s freeze). The save stays due, and a later pipeline makes it. Loads are asked only of a save that is due, so the steady state takes no extra lock.save()'s own rules still apply: its interval (save_every, at least 20 s), the longer interval under memory pressure,VICTORY_LIBRARY_SAVE_QUIET, and another run's writer lock. An early save counts as made only once a save wrote the library (a newSAVEScounter). One that was refused stays due.After an early save, the busy saves come every
VICTORY_LIBRARY_SAVE_BUSY_Sfrom it, as before. The save when the queue runs dry and the one at exit are unchanged.VICTORY_LIBRARY_SAVE_EARLY=<pipelines>,<seconds>: default200,30. Either part0turns that save off;0alone turns both off, as before.Log:
host pipeline library saved early (VICTORY_LIBRARY_SAVE_EARLY=0: not) added=N by="pipelines added"|"time in the world".The trail (
not_loaded): a pipeline the library does not hold isnew: not in the library yet. Other refusals, and every one withVICTORY_LIBRARY_LOADS=never, read as before (the library did not load it: <error>). This is a separate commit; drop it if you want one change per PR.Verification
Windows 11, rustc 1.98.1 (the pinned toolchain), Ryzen 7 9800X3D. On
2a33b73a(rebased onto41adb551), with its own target directory (C:\gt-lib):cargo check -p victory-gpu --locked -j 6: passes (the log showsvictory-gpubuilt fromC:\g-libsave\crates\victory-gpu). None of the crate's 18 warnings is inlibrary.rs; they are existing dead code and unused names elsewhere (shader_cache.rs:14,host/font.rs:55,host.rs,resource.rs:3573,streamline.rs:1004and others).cargo test -p victory-gpu --lib --locked -j 6 -- library: 20 passed, 0 failed, 0 ignored. The new ones:the_early_saves_by_the_switch: unset or unreadable gives200,30;0(and0,0) none;50,50,10,0,10,50,0.each_early_save_comes_once: 199 pipelines none, 200 the first; made once; 30 s in the world the second, whether or not the first was made; the pipelines' first when both are due, then the world's; nothing added, none; either part 0.no_early_save_of_a_large_library_or_beside_a_load: none at 256 MB or for a warm 1.3 GB library; none while a load runs, and still due after it; loads asked only of a save that is due.a_pipeline_not_in_the_library_is_new:E_INVALIDARGis "new",E_OUTOFMEMORYis told as it came.cargo clippy -p victory-gpu --all-targets --locked -j 6and the same with--all-features: no warning on a touched line. The two inlibrary.rsare on main's lines:incompatible_msrvat 90 (try_lock) andmanual_is_multiple_ofat 776. Both runs finish with warnings only (victory-gpu lib 27 / 25, lib test 30 / 24, victory-shader 3), all outside the diff.NOT tested
loadedagainstmade(the T06 check, under 5 min of game);library.saving) unlessVICTORY_LIBRARY_STORE_LATERhands the pipelines out first (on by default).Serializeafter a removal is not known to work.save()'s own interval lets one through, andEARLY_DONE'sfetch_orlogs once.Overlap
gh pr list --state open --search: "library save", "pipeline library", "LIBRARY_SAVE", "save early", "cold library", "save_while_busy".VICTORY_LIBRARY_SAVE_MADE=N(off by default; the code is already on main). This branch keeps it as it is. The early saves come first insave_while_busy, so with both, the first early save is this one, thenSAVE_MADE's every N.VICTORY_LIBRARY_SAVE_AFTER_LOADS=1. The early saves never run beside a load, with or without it.compact). Same file, merges cleanly.compact()and the writer lock. Merges cleanly.AI use
Claude Code (Claude Opus 5.5) wrote the change and its unit tests, ran the checks listed above, and wrote this note. Nothing was run in game.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by icdmkg2 on 2026-11-30T21:57:42Z.
Tested on an RTX 5060 Laptop (8 GB), Ryzen 7 260, 31 GB RAM, Windows 11. Series S, DLSS Performance, release build. Each run was closed by force about 3 minutes after the first frame of 1,000 draws, which is the case this PR is about: no exit save, and well before the 180 s busy save.
Without the PR (
mainate1251c3), 5 runs on one cache directory. The library was saved once, about 30 s in, with ~30 pipelines, and never again. It stayed at about 0.7 MB, so every start was cold:With the PR merged onto the same
main, 3 runs from a fresh cache directory:added=375 by="pipelines added", thenby="time in the world")added=812)cargo test -p victory-gpu --lib -- pipeline::library: 24 passed.Frame rates from these runs aren't comparable. Run 3 still had frames of 1 to 13 s, and the memory lines put that on the PC's memory, not on the library: the process held 24.8 GB private and the PC had 1.2 to 2 GB free, so compiles went one at a time under the soft floor. That seems to be a separate problem from the one this PR fixes.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T03:56:17Z.
Thanks @icdmkg2. That's the case this PR is for, on an 8 GB laptop:
added=375) and then on time, the second start loaded 671 and made 888, and the third loaded 1,605 and made only 128, from a ~113 MB library.So a run that never reaches the exit save or the 180 s busy save keeps its pipelines.
Agreed on run 3's frames of 1-13 s. With 1.2-2 GB of the PC's memory free, compiles were held to one at a time under the soft floor. That's the memory side, not the library.
AI use: Claude Code (Claude Opus 5.5) read your results and wrote this.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:49:41Z.
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