Pipeline library: the newer save takes the old one's place even while the run before still holds it #3747
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3747
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3747"
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?
@stasadance on GitHub · 2026-11-30 05:53 UTC · original
stasadance:fix/library-next-under-wine→main· +19 −1 · 1 files · 1 commits · openWhat it changes
Under Wine, renaming a file over one that is still mapped is refused. When the previous run's driver teardown still holds the old pipeline library while the next run starts, the newer library saved beside it (
.next) never took its place: the start mapped the old file and the previous run's new pipelines were lost (in one case a run that had translated 3,031 new shaders).The start now asks again for up to 20 s, and if the old file still can't be replaced, reads the newer library from beside it instead of mapping the old one. A save that does get renamed over the library removes any older one left beside it.
How it was tested
host-pipelines.nextwas 684,866,400 B beside the older 682,804,088 B library; the next start logged "the host pipeline library saved last could not take the old one's place" and mapped the older one.host-pipelines.next1,273,989,232 B beside the older 1,273,936,760 B library; the next start loaded the library at 1,273,989,232 B, the newer one.cargo testpassed for the crates it touches: nativecargo testcannot buildvictory-gpuon a Linux host (same on main), so no;cargo xwin clippyfor the Windows target adds no warning over current main.Checked for overlap
@Dukestar69 on GitHub · 2026-11-30 06:11 UTC · original · approved these changes
Tested locally merged onto
main(41adb551).crates/victory-gpu/src/pipeline/library.rs.cargo test -p victory-gpu --lib pipeline::library::passed (13 passed; 0 failed, includingthe_library_file_is_mapped_and_replaced,concurrent_write_atomically_never_fails_or_truncates, anda_replaced_library_file_still_reads_from_the_disk) with 0 new warnings.Clean fix allowing newer pipeline library saves to replace older mapped files cleanly on Windows. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-30 07:19 UTC · original
I tested the native Windows file-selection path on current release/main
41adb551, then with #37470571cedapplied asd3d4cfb. The test uses tiny generated files and the realBlob::ofandreplace_libraryfunctions. A read handle on the old file excludes delete sharing, and Windows confirmed the replacement was denied in each blocked case.41adb551.nextand chooses it after 0.76 s.nextin memory after 20.18 s, leaving the old file in place.nextis presentThe identical Windows fixture failed all three checks on main and passed all three with the PR. That verifies the denied-rename paths separately from the earlier normal-path library tests. These timings cover cache selection with generated bytes, before driver deserialization.
AI-assisted with OpenAI Codex.
@stasadance on GitHub · 2026-12-01 02:13 UTC · original
Merged current main (
e1251c3) into this branch (0d18b8a). Main's newreplace_libraryalready writes a newer save toNEXT_FILEinstead of renaming over the library, so that half of this PR is gone and main's version is kept. What's left is the Wine part:read_scopedretried theNEXT_FILE→ library rename only once. Now it retries every 250 ms for up to 20 s, and if Wine still refuses, it readsNEXT_FILEinto memory and uses it instead of falling back to the old library with saving off. The diff against main is now that one block inpipeline/library.rs. Windows-target clippy builds with no new warnings. The in-game run in the description was on the pre-merge branch.0d18b8ad25to3419ebd048@andrewpozdnakov7-jpg on GitHub · 2026-12-01 12:07 UTC · original
On
3419ebd0, the promotion loop keeps the library writer lock while it sleeps, potentially blocking a parallel save for the whole 20-second wait.f1559d739e903fcf334f709dd23a27dc45b9971a acquires the lock for each rename and releases it between attempts. A competing run can update or promote the pending save during the wait. If the pending name goes away because another run promoted it, the reader continues with the primary file. Review commit
I exercised the exact lock and promotion code on Windows with small synthetic library files. A regular file handle prevented the first replacement. The original loop blocked the competing save and loaded the earlier pending bytes. The patch let the other writer save and then promoted and loaded the newest bytes. The staged policy passed. The file-sharing fixture used native Windows, so a Proton retest of this commit would confirm the reported environment.
Please keep the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change in.AI-assisted with OpenAI Codex.
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.