Skip to content

Retry transient Windows pipeline-cache replacement failures - #1332

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
mrb-eel:fix/retry-windows-pipeline-cache-publish
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
mrb-eel:fix/retry-windows-pipeline-cache-publish

Conversation

@mrb-eel

@mrb-eel mrb-eel commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Claim. A Windows checker may briefly prevent another checker from publishing a completed cache while it reads the previous checkpoint. The atomic replacement from #535 leaves the old file intact, but the blocked process still exits with a permission error.

Retry just the final rename on Windows sharing or permission errors, for up to 200 ms. The same complete staging file is reused and errors still follow the existing cleanup path. A lock held beyond the retry window still reports failure and preserves the prior checkpoint.

Tested

  • Windows 11 build 26200, NVIDIA RTX 4070 SUPER, driver 616.92. Built with GCC 16.1.

  • Four batches of eight overlapping checkers against four synthetic shaders and one shared cache. Main at c0ac5fd returned 14 permission failures out of 32 runs. With this change, all 32 runs succeeded.

  • Reloaded the resulting checkpoint with Khronos validation and cache feedback: all four pipelines were cache hits.

  • The existing pipeline_cache_file_test and pipeline_cache_snapshot_test passed. The filesystem test includes a permanently held reader and checks that the old bytes survive.

  • Rebased onto f85582e, which includes 675e35b, after the old Windows CI job failed only in d3d12_predicated_copy. Tested the rebased build through CMake/Ninja, MSVC and CTest with no Vulkan ICD exposed. The predicated-copy test now reports a skip, and both cache checkpoint tests pass.

No game data used. AI-assisted implementation and testing.

@whattheflop whattheflop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted independent verification of e432faea314b57cc84044357e0bfb5aa3a95ec7a against its direct parent c0ac5fd6518b3ba9fa66765b8b07099990dadd74.

Windows 11 25H2 (26200.9974), NTFS, MSVC x64 19.38.33145.0, RelWithDebInfo. Both existing CTests (pipeline_cache_file and pipeline_cache_snapshot) passed on both commits. A scratch-only CPU harness called the unmodified write_pipeline_cache_file with generated binary bytes and a real CreateFileW(GENERIC_READ, FILE_SHARE_READ) reader.

Reader PR head Direct parent
Released about 90 ms after the helper started 10/10 published the exact new bytes after release. In all 10 trials, staging was present at the expected size while the reader still saw the old bytes. 10/10 returned Win32 access denied (5) before release and preserved the exact old bytes.
Held for at least 350 ms from helper start 10/10 returned error 5 while the reader was held and preserved the exact old bytes. 10/10 returned error 5 while the reader was held and preserved the exact old bytes.

All 40 trials checked the final bytes, verified that no staging file remained, and confirmed that an unrelated cache.bin.partial was untouched.

Observed in-process helper-call wall time, min-max across 10 calls per cell, including staging, rename and any retries or cleanup. With early release, head 88.634-92.030 ms and parent 0.588-0.808 ms. With the long hold, head 240.038-248.264 ms and parent 0.378-0.484 ms. The eight 25 ms sleeps specify 200 ms of requested delay. The held case measured a longer elapsed helper call on this host. This was a CPU-only check of the filesystem behavior alongside the GPU results in the PR description.

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51, llvm-mc 23.1.6): pass. ctest: all pass on the RTX 4080 SUPER (65–66). The Intel UHD 770 failures are the known ones (vk_binary_occlusion fixed by #1321, d3d12_vulkan_device fixed by merged #1285, d3d12_descriptor min-LOD, d3d12_copy_xfmt).

@mrb-eel
mrb-eel force-pushed the fix/retry-windows-pipeline-cache-publish branch from e432fae to 127ab6a Compare November 22, 2026 10:49
@Rainmaker33

Copy link
Copy Markdown

Tested e432fae on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

The PR's diff applied cleanly to main f85582e. VS 2022, Vulkan SDK 1.4.363.0. Runtime built with scripts\build_runtime.ps1 (CMake, RelWithDebInfo).

  • pipeline_cache_file (ctest): passed.
  • ctest: 66/67 pass. process_cmdline fails the same way on main here (code page 1253, RT-84).
  • I didn't force a transient replacement failure (for example antivirus holding the file), so the retry path itself wasn't exercised.

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
@ItsNotRexed
ItsNotRexed merged commit 10c21bd into ItsNotRexed:main Nov 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants