GPU: a save that fails gives its changes back for the next one #2327
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!2327
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2327"
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-003→main· +56 −8 · 1 files · 1 commits · openSummary
save()cleared the dirty marks before the library was serialised and written, so a save that failed at shutdown left nothing to save next time. The marks are now taken, and given back when the save fails. Open PR #2232 restores onlyprebuilt_changed; this restores the added count,prebuilt_changedandUSED_CHANGED.Testing
Test
a_failed_save_leaves_its_changes_to_the_nextfails if the restore drops the added count and passes with this change. It testsDirtytake and restore, not theErrarms ofsave().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 save that keeps failing now retries every 20 s with a warning each time. It touches
save()like #2326 and #2328 do and conflicts with them only in adjacent test blocks inlibrary.rs. Not tried: a run in the game.AI-assisted.
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 10:48 UTC · original
I tested both list writes through
library::save(true)on Windows/WARP at940d32fand your exact head2ba6697. Each case runs in a fresh process. I blockedprebuilt-pipelines.txtin one case andearly-pipelines.txtin the other by making the destination a directory. After the library blob was written, I removed the directory and calledsave(true)again without recording another key.940d32fleft both files missing after the retry. The early case had only a used key pending.2ba6697recovered both keys. The prebuilt list also matched the tag for the saved library blob.The test-only commit
a4b65acis available directly on your head. The library suite passed 10 tests. The full GPU suite on app-local WARP passed 148 project tests with 2 ignored, and strict GPU Clippy and the staged asset check passed. This confirms the failure path from #2232 and also covers an early-list-only retry. If you fold the test into your commit, please addCo-authored-by: andrewpozdnakov7-jpg <[email protected]>.@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. Rebased at
e4edac7, which merges cleanly intomain. Insave()(crates/victory-gpu/src/pipeline/library.rs) the dirty marks (added,prebuilt_changed,USED_CHANGED) are now taken into aDirtyvalue and restored on each failure path: no buffer,Serializeerror, and a failed file write (the lock is taken again for that). Onmainthe marks are cleared before the write, andUSED_CHANGEDis cleared even when the no-memory path returns early, so a failed periodic save loses its changes until something else changes.restoreadds to marks set meanwhile rather than overwriting them, which is right. The test coversDirty::take/restoreonly, as the PR body says. The fix only helps the periodic saves; a failed final save at shutdown has no later save to retry.For the maintainer: #2232 has since been closed, and #2328 (one save at a time) also touches
save(), so whichever lands second will need a small rebase.CI: passing (
check).Generated by Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 22:43 UTC · original
I ported your change across the current
pipeline/library.rsconflict. The handoff branch has your original Git author on0323bc9and the two-file fixture on3969fc7. The port keeps the separate load handle, the ordered early list, and the fallible serialization buffer. An allocation failure now restores the same pending marks as a serialization or file write failure.On app-local WARP, the same fixture left both cache list files missing after the second save on
f3578e3. At3969fc7, both files were recovered without recording another key, and the prebuilt list matched the serialized library's tag. The GPU suite passed 245 tests with one ignored. Strict GPU Clippy in both configurations and the asset policy passed. The tested branch is based onf3578e3and also merges cleanly with the newer219878a.You can cherry-pick the two commits in that order. Please retain the Git authors. If you fold the fixture into the fix, please include
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.@pawrenity on GitHub · 2026-11-26 04:33 UTC · original
For triage: on
main63bcca4,pipeline/library.rssave()still clearsadded/prebuilt_changedin theOk(bytes)arm, before the files are written, and clearsUSED_CHANGEDin the "anything to save?" check. TheErrarm only warns. So a failed write loses those changes until something else marks the library dirty, as this PR describes. #72 fixes the same thing foraddedandUSED_CHANGED, but it predates the prebuilt list and does not coverprebuilt_changed. This PR covers all three flags and the serialise and allocation failure paths, so #72 looks superseded by it. This is from reading the code; I did not run either PR.AI-assisted (Claude Code).
@catminou4 on GitHub · 2026-11-25 10:54 UTC · original · reviewed
A save that fails gives its changes back for the next one (Dirty::take reset on error). 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; atomic-ish retry semantics look right.
@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: 9/9 passed (includinga_failed_save_leaves_its_changes_to_the_next).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 13:31 UTC · original
@denkencar-sketch I moved the end-to-end retry probe to your current
e4edac7.226b59cis a single test-only commit on that exact head.The fixture blocks each list file in a fresh process, calls production
save(true), removes the block and callssave(true)again without recording another key. On63bcca43, bothprebuilt-pipelines.txtandearly-pipelines.txtwere still missing after the retry. On your head, both were recovered. The test also verifies that the prebuilt list has the tag of the saved D3D12 library.App-local WARP passed all 13 library tests on your head with the probe. Strict all-feature GPU Clippy passed. If you take the test, please retain its Git author, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit. AI-assisted with Codex.@fuzeofficlal on GitHub · 2026-11-26 14:42 UTC · original · approved these changes
Dirty::takeandDirty::restore(crates/victory-gpu/src/pipeline/library.rs:317-405) preserve concurrent increments accurately across OOM (try_reserve_exact), D3D12Serialize, and filesystem error paths without losing newerUSED_CHANGED,added, orprebuilt_changedupdates.Non-blocking follow-up / coordination notes:
main,LAST(L306-316) only guards the throttle timestamp rather than serializing the full save through file publication, and anEARLY_FILEerror skipsPREBUILT_FILEvia.and_then;#2803addresses full-save serialization and independentEARLY_FILEhandling, so keeping both semantics together when reconciling#2327/#2803/#2129will cover all save paths cleanly.rustfmt --checkflags the new lines atlibrary.rs:386andlibrary.rs:579(>100 columns).Local verification at
e4edac7d(and cleanly merged ontoorigin/mainata610d5f5):xtask policy(191 files ok),cargo clippy -p victory-gpu --all-targets(defaultand--all-features, 0 warnings), andpipeline::libraryunderVICTORY_D3D12_DEBUG=1passed on both RTX 5090 (12/12) and WARP (12/12). Approving.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.