Skip to content

RT-601: fix Windows pipeline-cache checkpoint creation - #8143

Open
melon0918 wants to merge 1 commit into
ItsNotRexed:mainfrom
melon0918:fix/rt601-bvh-startup
Open

melon0918 wants to merge 1 commit into
ItsNotRexed:mainfrom
melon0918:fix/rt601-bvh-startup

Conversation

@melon0918

Copy link
Copy Markdown

Claimed in the coordination issue as RT-601.

What and why

On native Windows, the static-CRT build of vk_pipeline_check exited with 0xC0000409 inside _wfopen(staged, L"wbx") when asked to save a cache checkpoint, even with a single hand-written compute shader. This prevents the BVH prewarm from producing a cache for the runtime.

Open the Windows staging file with explicit exclusive-create and binary flags, then attach the stdio stream. Keep collision handling, atomic replacement and the existing cleanup behavior. The file regression test now uses the same CRT as the checker, so it exercises the failing configuration.

Tested

  • Native Windows 10, clang-cl 23.1.6 with the Windows SDK 10.0.26100, Radeon RX 7900 XT with AMD driver 25.5.1 (32.0.21001.9024). The checkpoint writer, snapshot, checker CLI and checker stack CTests all passed.
  • In a local integration checkout that also contained vk_pipeline_check: enable maintenance8 with the runtime so offline BVH cache seeds hit #7474 and vk_pipeline_check: match the runtime's device so its cache hits on AMD, with a test (RT-575) #7501, the synthetic seed test reported a runtime application-cache hit. Prewarming the 52 locally translated and validated BVH modules produced 52 pipelines with zero failures, and the constructor harness made all 53 pipeline calls with and without a seed. Observed constructor times were 46.7 s without a seed versus 1.47 s and 0.09 s with the seed. These are local harness timings. Full retail boot still stops earlier in a separate startup path.
  • Ran the full translator semantic suite (447 files, 5,956 tests). test_image_atomics_guard and test_image_store_d16 failed with identical failing cases on the unmodified upstream base.

AI-assisted: yes (Codex)

Checklist

  • No game data, keys or decryption, including in logs or reports quoted here.
  • Translator contract entry: N/A.

@LukeOsland1

Copy link
Copy Markdown

The original checkpoint failure did not reproduce with native MSVC 19.51.36248.0 on this Windows PC. I compared parent dde82f27e994337094afc476ded0b1426f6e87e2 with head 04a8b9c93b7bb5967eae391f09185097a8433273. Both RelWithDebInfo checker builds use the static CRT. I used one hand-written compute shader, a separate initially absent cache per adapter and revision, then repeated each run with its saved cache and --jobs 1 --cache-feedback. I selected each driver through VK_DRIVER_FILES and checked the adapter printed by the checker.

Adapter (Windows driver) Saved cache Parent cold / warm application-cache hits Head cold / warm application-cache hits
RTX 4070 Ti SUPER (32.0.16.1088) 5,697 bytes 0 / 1 0 / 1
AMD Radeon(TM) Graphics (32.0.21042.62) 2,192 bytes 0 / 1 0 / 1

All eight invocations exited 0 and created one compute pipeline each, with zero failures and skips. Both cold saves and warm replacements succeeded on both revisions. Per adapter, all four saved files were SHA-256 identical. This confirms the updated writer preserves cache contents and driver-reported warm hits on this MSVC configuration. The clang-cl parent failure remains specific to the configurations where it was observed. Full boot and constructor timings were outside this comparison.

AI-assisted independent verification. Claim

@justrealyme

Copy link
Copy Markdown

Tested 04a8b9c on NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 build 26300, VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo: pass.

Built pipeline_cache_file_test and ran ctest -R ^pipeline_cache_file$: Passed (0.6 s).

Synthetic inputs only, no game files. AI-assisted (Claude Code).

@loyrox loyrox left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested 04a8b9c on NVIDIA GeForce RTX 3060 (driver 621.14 / 32.0.16.2114, Vulkan 1.4.357), Windows 11 10.0.26200, MSVC 19.51.36260 (VS 2026), CMake 4.2, RelWithDebInfo, -DLEONIDA_VULKAN_HEADERS_FETCH=ON: pass.

  • Clean build, no errors. pipeline_cache_file (now on the static CRT), vk_pipeline_check_cli and vk_pipeline_check_stack pass.
  • Full ctest: 235/237, identical to main dde82f2 on the same machine. The two failures are the same on main and unrelated to this PR: d3d12_vulkan_device line 6574 tiles == 1 and d3d12_depth_resolve (refused resolves report "destination changed"), both already listed in #8426.

One data point on the root cause: I could not reproduce the 0xC0000409 with MSVC. A standalone program built with MSVC 19.51 and /MT that calls _wfopen(path, L"wbx") creates the file, and a second call on the same path returns NULL with errno 17 (EEXIST), no abort. So the crash may depend on the clang-cl build from the description rather than on the static CRT alone. The _wsopen_s + _wfdopen path works on MSVC as well, so this does not block the change.

@Kerwinss

Copy link
Copy Markdown

Tested 04a8b9c on Windows 11 Pro 10.0.26300, MSVC 14.51 (VS Build Tools 2026), Windows SDK 10.0.26100, NVIDIA GeForce RTX 4060 / 621.24, Khronos Vulkan headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON (no glslangValidator): pass, no regression.

Merged onto main dde82f2 (clean), full runtime build, ctest -C RelWithDebInfo -j6: 235/237. The two failures are the ones main has on this GPU: d3d12_depth_resolve (#7985) and d3d12_vulkan_device:6574 (claimed by iTzAlvar). pipeline_cache_file passes.

I couldn't reproduce the premise on this toolset. A minimal C program built with cl /MT (static CRT) and /MD on MSVC 14.51 / UCRT 10.0.26100 opens a new file with _wfopen(L"...", L"wbx"). A second wbx open of the existing file returns NULL with errno == EEXIST (17), with no invalid-parameter termination in either CRT. So the old wbx path works here, and the termination may be specific to an older toolset or UCRT. Which one showed it? The new _wsopen_s(_O_CREAT | _O_EXCL) path is fine either way.

AI-assisted (Claude Code). No game files.

@Ekabusto

Copy link
Copy Markdown

Tested 04a8b9c93 on Windows 11 10.0.26300, AMD Radeon RX 9070 XT (driver 26.11.2), MSVC 19.44: pass.

  • ctest -R "pipeline_cache|vk_pipeline": 4/4 passed (pipeline_cache_file, vk_pipeline_check_cli,
    vk_pipeline_check_stack, pipeline_cache_snapshot).
  • Like @LukeOsland1, I couldn't reproduce the original checkpoint failure: pipeline_cache_file and
    pipeline_cache_snapshot also pass on main here. So this run shows no regression on AMD + MSVC 19.44, not the fix.

AI-assisted: yes (Claude ran the build and tests; results checked by me).

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.

6 participants