GPU: skip host pipeline library serialisation when only early list changed #3188
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!3188
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@reeledMarek on GitHub · 2026-11-26 11:28 UTC · original
reeledMarek:fix/gpu-library-save-early-only→main· +142 −35 · 1 files · 2 commits · openSummary
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.@Dukestar69 on GitHub · 2026-11-26 11:48 UTC · original · approved these changes
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).
@steven-seagull27 on GitHub · 2026-11-26 12:04 UTC · original
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.
@oni-swr on GitHub · 2026-11-26 12:06 UTC · original
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).
@reeledMarek on GitHub · 2026-11-26 15:20 UTC · original
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.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.