Run, GPU: save the pipeline cache on normal title exit #3046
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3046
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@fuzeofficlal on GitHub · 2026-11-26 05:13 UTC · original
fuzeofficlal:fix/run-save-pipeline-cache-on-exit→main· +9 −2 · 2 files · 1 commits · openProblem
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)@oni-swr on GitHub · 2026-11-26 06:06 UTC · original
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).
@Marvisak on GitHub · 2026-11-26 06:17 UTC · original
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.