GPU: skip host pipeline library serialisation when only early list changed #3186
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3188"
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 reeledMarek on 2026-11-26T11:28:36Z.
Summary
crates/victory-gpu/src/pipeline/library.rs,save()allocatedzeroed(size)(~1.7 GB on NVIDIA), heldlibrary.statewhile callingID3D12PipelineLibrary1::Serialize, and atomically rewrotehost-pipelines.bineven whenl.added == 0 && !l.prebuilt_changedand onlyUSED_CHANGEDwas set (e.g., every 20 seconds during warm runs as cached pipelines are first used).zeroed(size)returnedNone(OOM) orSerializefailed,USED_CHANGEDhad already been cleared byswap(false)and was never restored, silently dropping updates toearly-pipelines.txt.save()viaSaveKind::{None, EarlyOnly, Full}: when onlyUSED_CHANGEDis set, release the lock immediately and write onlyearly-pipelines.txt; if library serialisation fails/OOMs, still writeearly-pipelines.txtwhen needed; and restoreUSED_CHANGEDif writingearly-pipelines.txtfails.Testing
save_kind_skips_library_serialisation_when_only_early_list_changedandwrite_early_list_updates_only_early_fileincrates/victory-gpu/src/pipeline/library.rs.cargo test -p xtask --lockedpasses.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T11:48:42Z.
Review: APPROVED
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib pipeline::library:: -- --test-threads=1: 13/13 passed (includingsave_kind_skips_library_serialisation_when_only_early_list_changedandwrite_early_list_updates_only_early_file).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly skips re-serializing the host pipeline library when only the early list changed.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T12:04:46Z.
Found a restart regression on
d5b24d1whenearly-pipelines.txtis temporarily busy during a full save. After the retry, the RTX 5080 and Windows inbox WARP both loaded and dispatched all three cached PSOs (96/96 output words correct), but the next pre-build recognized 0/3 pipeline keys. The same test recognizes 3/3 on the parent, on #3181, and with the small write-order fix below.The test uses a fresh directory, seeds two real compute pipelines, then adds a third in a new process. A read handle on the early-list file blocks its replacement during one full save. It closes the handle, calls
save(true)again, and starts another process. Two runs per adapter gave identical results.63bcca48a216f5d5b24d15d8a276With the file writable throughout, all four builds recovered 3/3 keys. With the file busy, this head installs the new binary, fails to replace the early list, and skips writing
prebuilt-pipelines.txt. The retry repairs the early list. On restart the old manifest's tag no longer matches the binary, so even the two earlier keys are forgotten. Writing the matching manifest right after the binary lets the existing early-list retry handle its own failure.The write-order fix can be cherry-picked on its own. The opt-in restart test is separate. To take both on this head:
Synthetic native D3D12 tests with the debug layer enabled. AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T12:06:58Z.
WARP verification of #3188 at
d5b24d1f(base63bcca4,origin/main). Software adapter only; synthetic tests only; no GPU, game files, dumps, shader names or hashes.Environment: Windows 11 Pro 10.0.26200; WARP
d3d10warp.dll10.0.26100.9818 (VICTORY_D3D12_WARP=1);dxil.dllanddxc.exe1.8.2502.11 from Windows SDK 10.0.26100.0 (VICTORY_DXILset to that dxil.dll);CARGO_TARGET_DIR=D:\victory-3188-3192-warp-target; every cargo command used-j 4 --locked.Commands and counts
cargo test -p victory-gpu --lib pipeline::library:: -- --test-threads=1: 13 passed, 0 failed, 0 ignored. Includessave_kind_skips_library_serialisation_when_only_early_list_changedandwrite_early_list_updates_only_early_file.cargo test -p victory-gpu --lib -- --test-threads=1, head: 233 passed, 0 failed, 1 ignored.63bcca4: 231 passed, 0 failed, 1 ignored (+2 = the two new tests).Revert check: restoring the old behaviour in
save_kind(theused_changed-only case returnsFullinstead ofEarlyOnly, one line, rest of the PR kept) makessave_kind_skips_library_serialisation_when_only_early_list_changedfail (left: Full, right: EarlyOnly); the other 12 pass. A literal revert of the whole diff does not compile with the new tests, hence the one-line mutation.Review: no defects found. Checked: a failed serialise or allocation still writes the early list (
used_changedwas already swapped out); early-write failure re-armsUSED_CHANGED; on a full-save write failureUSED_CHANGEDis re-armed only if the early list was due; the prebuilt list is still tagged against the unchanged library bytes.Coverage gaps
save()itself is untested (needs a live pipeline library). The tests cover only the puresave_kindtable andwrite_early_list, so they do not prove that serialisation is skipped on the early-only path or thatUSED_CHANGEDis restored after a failed write.write_early_list_updates_only_early_fileasserts only that no other files are created in an empty dir; it does not show an existing library file is left untouched.AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T15:20:10Z.
Great catch @steven-seagull27 — thanks for the thorough restart test on RTX 5080 and WARP!
Fixed in
90dee35:write_full_save()now writesprebuilt-pipelines.txtimmediately afterhost-pipelines.binand beforeearly-pipelines.txt, so a transient failure replacingearly-pipelines.txtleaves the library binary and prebuilt manifest tag in sync while theEarlyOnlyretry updatesearly-pipelines.txt. Added a regression testwrite_full_save_updates_prebuilt_manifest_before_early_listcovering this exact failure + retry sequence.Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-27T00:49:43Z.
Confirmed the restart fix on
90dee35with the original three-pipeline test. I ran it on the RTX 5080 and Windows inbox WARP, with the early-list file writable and with a transient file-replacement failure followed by a retry. All four combinations reopened the library, dispatched 96/96 correct output words, and recognized 3/3 prebuilt and 3/3 early keys. The failure-and-retry case ond5b24d1had recognized 0/3 prebuilt keys. The new write order fixes that case on both adapters.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.