Run, GPU: save the pipeline cache on normal title exit #3044
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3046"
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 fuzeofficlal on 2026-11-26T05:13:48Z.
Problem
victory_gpu::pipeline::library::save(false)throttles disk writes to once every 20 seconds (SAVE_EVERY).lifecycle::end()flushes the cache viavictory_gpu::pipeline::save_pipeline_cache()on window-close / suspend exits, but when a title's main thread returns normally inapps/victory/src/run.rs(main.join()),runreturnsOk(code)without callingsave_pipeline_cache(). Any pipelines compiled or early-start keys recorded in the final save interval are lost on normal exit.Fix
victory_gpu::pipeline::save_pipeline_cache()inapps/victory/src/run.rsright aftermain.join()completes cleanly.LIBRARYincrates/victory-gpu/src/pipeline/library.rsand short-circuitsave()whenLIBRARYwas never initialized andUSED_CHANGEDis false, so flushing on exit for a title that never touched D3D12 does not lazily spin up a host D3D12 device.Verification
cargo test --locked -p victory-gpu --lib pipeline::library::tests::(11 passed)cargo test --locked -p victory(14 unit tests + 4 integration tests passed)cargo clippy --locked -p victory-gpu -p victory --all-targets -- -D warningscargo xtask policy(191 files ok)Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T05:25:28Z.
Review: APPROVED
Verified: the exit-time
save_pipeline_cache()would previously forcelibrary()to initialize just to discover there is nothing to write — theLIBRARY.get().is_none() && !USED_CHANGEDguard skips exactly the never-touched case, while a used-but-unsaved run still initializes and writes. Throttling and DIR-less early returns unchanged.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:56:23Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):victory_gpu::pipeline::save_pipeline_cache()on normal title exit inapps/victory/src/run.rsand short-circuitingsave()whenLIBRARYwas never initialized and!USED_CHANGEDcleanly preserves recently compiled pipelines and early-start keys without initializing D3D12 unnecessarily.cargo test -p victory-gpu pipeline::library::tests -- --test-threads=1: 11 passed, 0 failed.cargo test -p victory run::: all tests passed.cargo clippy -p victory-gpu -p victory --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T06:06:47Z.
Independent Windows x64 verification of
d1e9043b622f843887ea784f79e91805df1d5414against its exact parent63bcca43c6a00a758510398fa43096ce7e4f7df0.I ran
victory run --executewith a temporary import-free PE whose entry point returns 37. A temporary harness seeded the real cache before spawning the PE and logged pipeline-library and D3D12 host initialization. Separate processes used isolated cache directories, except for the deliberate reload. Every run returned 37.host-pipelines.binand the expected key toearly-pipelines.txt. A fresh process loaded the stored PSO and found the key without recreating the PSO.Built with
cargo build --locked -j 4 -p victory --features diagnostics. Device-creating runs confirmed Microsoft Basic Render Driver (vendor0x1414, device0x008c, software flag0x2) before creation withVICTORY_D3D12_WARP=1. The compute fixture used Windows SDK10.0.26100.0tooling with its x64dxil.dll.AI-assisted (Codex, gpt-6.2-sol).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:17:47Z.
Automated triage for the maintainers.
On
main, the pipeline cache is saved at the end of a run only fromlifecycle::end(crates/victory-hle/src/modules/lifecycle.rs). When the title's main thread returns normally,run::run(apps/victory/src/run.rs, a function undercfg(windows)) skips that, andlibrary::save(false)throttles writes to one every 20 s. Pipelines and early-start keys from the last interval are lost. The PR callssave_pipeline_cache()after a cleanjoin, in the same waylifecycle::endandprebuild.rsalready do.In
crates/victory-gpu/src/pipeline/library.rs,savenow returns early whenLIBRARYwas never initialized andUSED_CHANGEDis clear. Without that, the exit save would create a D3D12 device just to write nothing. If early keys were recorded, the library is still initialized and saved. I read it as correct. The independent Windows run above confirms the before and after behaviour. CI:checkpassing.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.