GPU: a full early pipeline list drops the oldest runs' keys #983
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/983"
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 Marvisak/VIctory. Originally posted by LICObr on 2026-11-24T14:39:08Z.
Problem
Used::listkeeps this run's keys first, then earlier runs' others, cut toEARLY_MAX(8,192). The earlier keys come from aHashSet, so once the list is full, the keys that make room are any earlier keys, not the oldest ones. A key the last run drew with can go while one unused for many runs stays. That key's pipeline is then not started early and compiles on first use.A smaller one:
savereadsUSEDdirectly, not throughused(). If a save runs before anything in this run read the list, it writes an empty list over the saved one.keep_early_listcovers the pre-build; the fix below covers every caller.Change
Used::beforekeeps each earlier key with its place in the list as loaded (HashMap<String, usize>). The list is already saved this run first, so sorting earlier keys by that place gives most recent first. A full list then drops the oldest runs' keys, and the order carries across saves.Used::read.savereads the list throughused().Verification
a_full_early_list_drops_the_oldest_runs_keys: it fills the list from a saved file, uses 10 new keys plus the oldest key again, and checks three things. The 10 keys that go are exactly the oldest ones not used again, the key used again stays, and the order holds after a save and read back. Against the currentmainbehaviour, this test fails.the_early_list_keeps_this_run_first(existing) still passes.cargo clippy -p victory-gpu --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings, with and without--all-features: clean.Not exercised in a game run: no game files were used.
Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T14:55:00Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
486b54e:cargo test -p victory-gpupasses, 52 passed / 0 failed. Workspace baseline on main (ffe310e) was green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T15:01:07Z.
We checked the save-before-first-use case through
save_pipeline_cache()on an RTX 4090 under Wine/vkd3d-proton 3.2. A temporary cache started with two legacy keys,aaaaandbbbb. After creating a compute PSO, the first save preserved both keys at run 0. Afterready()marked the new pipeline used, a second save placed its key first at run 1 and kept both older entries.Bypassing only the read-before-save step made the first save replace the list with an empty file. Both builds included #844’s empty-library fix so the Wine backend could create and save the host library. This comparison covers preservation and promotion through the save API. Game startup timing remains unmeasured.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T16:26:27Z.
Review: APPROVED
Tested
486b54eon Windows 11, RTX 5070, MSVC: builds,cargo test --workspace --no-fail-fast576 passed, 0 failed (on our fork main), with victory-shader single-threaded. Both newpipeline::librarytests pass.note_usedrefused new keys once the union of every run reachedEARLY_MAX, so the list stopped learning. Now keys are ranked by last run and cut on save. The test fills the list with 8,192 keys from two runs and shows exactly one key from the oldest run making room for a new one.savenow reads throughused(), which fixes the empty-overwrite when nothing had read the list yet.<run>parse and reads as run 0; a key containing a space still parses, because the first field must be a number.keysgrows pastEARLY_MAXuntil save cuts it. That's bounded by the pipelines a run makes, so it's fine.Merged into our fork's main.
AI-assisted (Claude Code).
[PR #983] GPU: the early pipeline list keeps the most recently used keysto [PR #983] GPU: a full early pipeline list drops the oldest runs' keysImported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:29:13Z.
Automated triage for the maintainers.
Merge candidate. This closes two gaps in the early pipeline list in
crates/victory-gpu/src/pipeline/library.rs:Used::beforenow keeps each earlier key's place in the loaded list.Used::listsorts earlier keys by that place, so a full list (EARLY_MAX) drops the oldest runs' keys rather than arbitraryHashSetentries. The order carries across saves, and lists saved by older builds still read.savereads the list throughused(), notUSEDdirectly. A save that runs before anything else reads the list no longer overwrites it with an empty one. @MichaelSmithAI reproduced that case throughsave_pipeline_cache().Checked:
used()takes only theUSEDlock, so calling it fromsaveadds no lock-order problem.wanted_earlymoves tocontains_keywith no change in behaviour. The new testa_full_early_list_drops_the_oldest_runs_keysasserts the intended eviction order, not just the current output. The PR merges cleanly with currentmain, including the concurrent-load changes to the same file.CI: no check runs on the head commit. A reviewer reports
cargo test -p victory-gpupassing on an RX 7700 XT.Generated by Claude Code