[pr-fix][startup][shaders] Read a pending pipeline library when promotion is blocked #232
Loading…
Reference in a new issue
No description provided.
Delete branch "andrewpozdnakov7-jpg/Darner:port/3747-read-pending-pipeline-library"
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?
Contributor role (optional)
What it changes
When a Windows reader holds the current library without delete sharing, promotion of the newer pending file can fail with access denied. Read the pending file in that case and leave it available for a later promotion. Keep the existing fallback if the pending file is empty or no longer present.
Restores locally saved VIctory-NVIDIA work from December 1, 2026. Previous review: CodeFloe #389. Adapted by andrewpozdnakov7-jpg (GitHub profile).
How it was tested
16ed5b8onf3840d7.6106095: akimfomin found that Blob::read returns Some(Blob::None) for a zero-byte pending file. With the primary held open on Windows, the previous PR returned 0 bytes, while main and this update returned the 19-byte primary in the focused fixture. The update also retained the nonempty-pending path and promotion after release. The fixture used the actual buffered Blob::read, read_scoped and load_cache logic. Added a regression for the empty pending file. cargo check --locked -p darner-gpu --lib --tests, xtask policy and git diff --check passed. A fresh test on the hardware that reported the regression would confirm this new head end to end.593668b: merge-tree with #275 succeeds. A Windows file-level fixture on the combined code preserved the busy primary with an empty pending file and returned the data of a valid pending file. The regression checks the primary bytes regardless of whether #275 has already cleaned up the empty file. Asset policy and whitespace checks passed.Checklist
Checked for overlap
The valid pending library works on hardware. I also found a regression in the empty-file fallback described in the PR. I held a real 58,063,156-byte primary
host-pipelines.binopen on Windows with read/write sharing, without delete sharing. Each test used an isolated copy, the matching translator marker and the same adapter.host-pipelines.nextat startupf3840d7)16ed5b8no host pipeline library yetand started an empty one16ed5b8All three reached the world and exited normally. The primary SHA-256 stayed unchanged. In the empty-file PR case, the game wrote a new 97,035,640-byte pending library while the old primary was still held.
Blob::readrepresents an existing zero-byte file asOk(Some(Blob::None)). In the blocked-rename branch,Some(blob)therefore reports success for the empty file. Returning the promotion error forSome(Blob::None)as well asNonewould letload_cacheuse its existing read-only fallback for the valid primary. A regression case can reuse the existing held-reader fixture with a zero-length pending file.Windows 11, RTX 4070 Ti SUPER, driver 617.14. Both nonempty files were real libraries from this adapter. Tested with Codex assistance.
I tested a one-line fix on top of
16ed5b8. In read_scoped’s failed rename branch, handle the empty Blob before accepting a pending library:The existing load_cache error path then opens the primary read-only. I rebuilt the full executable and repeated both hardware cases with the same input file hashes and Windows sharing flags as my previous comment:
A separate Windows file-level fixture compiled the PR’s and the patched cache-reading code, with mapped reads disabled. It also checked a held primary with no pending file and a promotable valid pending file: behavior stayed the same in both controls. This change covers a zero-byte pending file when promotion fails; I did not test a nonempty corrupt library.
I checked the next startup after the held-reader test on
6106095cee265a8c6977bf15d3bb07e3877b03ccand onf3840d73. The Windows file-level fixture used a 16-byte primary and a deliberately empty pending file. With a reader holding the primary without delete sharing, promotion returned Windows error 5 and the first load returned the original 16 bytes. I then dropped both the returned blob and the reader and reopened the same directory. On both revisions the empty pending file replaced the primary. The second load returned zero bytes, the primary on disk was zero bytes, and the pending file was gone.With a nonempty pending file, the second load returned its contents and promoted it correctly. Mapped and buffered reads gave the same results. The second-start behavior also occurs on main. This fixture seeds the empty file explicitly and does not establish how often it occurs in gameplay.
Thanks for checking the second startup, @superhero-520. #275 now cleans up the empty pending file under the writer lease. I checked the combined code on Windows. With the primary held open, empty pending data leaves the primary intact and a valid pending file is still read.
593668bkeeps this PR's regression focused on the bytes returned and preserved. That allows the same test to cover both the current fallback and the cleanup from #275. The two branches merge cleanly.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.