GPU: pipeline library saves run one at a time #2328
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!2328
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@denkencar-sketch on GitHub · 2026-11-25 10:42 UTC · original
denkencar-sketch:fix/plib-001→main· +60 −0 · 1 files · 2 commits · openSummary
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.
@Marvisak on GitHub · 2026-11-25 15:20 UTC · original · edited 2026-11-26 03:24 UTC
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
@catminou4 on GitHub · 2026-11-25 10:54 UTC · original · reviewed
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.
@DenRakEiw on GitHub · 2026-11-25 11:42 UTC · original · approved these changes
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).
@fuzeofficlal on GitHub · 2026-11-26 16:38 UTC · original · approved these changes
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.