GPU: pipeline library saves run one at a time #2326
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2328"
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 denkencar-sketch on 2026-11-25T10:42:36Z.
Summary
The worker's pipeline library save and the shutdown's could interleave their files: an older blob over a newer one, or beside another save's prebuilt list. Saves now run one at a time. A second commit makes the periodic save, which workers call after every pipeline, leave it to the save running instead of waiting (shutdown's save still waits).
Testing
Tests
a_save_waits_for_the_save_runninganda_periodic_save_does_not_wait_for_the_save_runningfail without the lock and withouttry_lockrespectively, and pass with this change. The wait in the first test is timing-based.cargo test --workspace --lockedpasses apart from known flakes:modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo, and so does a parallel-run flake invictory-gpu's lib tests (watch::anddescriptor::host::tests, 2 of 40 runs on pristinemain).A skipped periodic save leaves its dirty marks for the next save. It touches
save()like #2326 and #2327 do and conflicts with them only in adjacent test blocks inlibrary.rs. Not tried: a run in the game.AI-assisted.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:54:11Z.
Review: COMMENTED
Pipeline library saves run one at a time (SAVING mutex, try_lock for periodic, blocking for shutdown). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Same cluster; prevents blob/prebuilt interleaving.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T11:42:32Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090:cargo test -p victory-gpu pipeline::library::tests: 10/10 passed (includinga_periodic_save_does_not_wait_for_the_save_runninganda_save_waits_for_the_save_running).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:20:55Z.
Automated triage for the maintainers.
Verdict: merge candidate. Thanks for the rebase. At
a662de9,pipeline::library::save(crates/victory-gpu/src/pipeline/library.rs) holds aSAVINGmutex from theLASTcheck to the last file write. Shutdown'ssave(true)waits for it, and a worker'ssave(false)returns at once when another save is running.The race is real on
main.Serializeruns under the library state lock, but the threewrite_atomicallycalls run after that lock is released. Two saves can therefore finish their files in the wrong order, leaving an older blob or a prebuilt list beside the wrong bytes. A skipped periodic save leavesadded/USED_CHANGEDset, so the next save picks the changes up. The two tests check the waiting and non-waiting cases. The first relies on a 300 ms sleep, which is acceptable for a negative check.CI: passing (
check). Merges cleanly.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T16:38:44Z.
Review: APPROVED
Reviewed
a662de92591345f983324ffef25365d7b5bf8a46(merged cleanly onto63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP,VICTORY_D3D12_DEBUG=1).The
SAVINGguard covers the full save sequence (early list, prebuilt list, and library blob) with consistent lock ordering (SAVING->LAST->state->USED->WRITING), keeping periodic saves non-blocking on contention while shutdown waits for an active save to finish.Non-blocking notes for coordination / follow-up:
#2803already extendsLASTwith the same blocking/try_lockpolicy over the save window (so if both land, keeping a single outer lock avoids stacking two save mutexes), and#2327handles dirty-state restoration if a file replacement fails after clearing marks.a_save_waits_for_the_save_runningwith an explicit synchronization point (keeping a timeout only as a watchdog) would make the concurrency tests immune to scheduler jitter.Verification
cargo run -p xtask -- policy(191 files ok),cargo clippy(default &--all-features) clean, new linesrustfmt-clean.victory-gpupipeline::library::withVICTORY_D3D12_DEBUG=1: 13/13 passed on both RTX 5090 and WARP (at both PR head and merged onto63bcca43).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.