Skip to content

vk_pipeline_check: enable maintenance8 with the runtime so offline BVH cache seeds hit - #7474

Closed
LukeOsland1 wants to merge 2 commits into
ProjectLeonida:mainfrom
LukeOsland1:codex/bvh-cache-maintenance8
Closed

LukeOsland1 wants to merge 2 commits into
ProjectLeonida:mainfrom
LukeOsland1:codex/bvh-cache-maintenance8

Conversation

@LukeOsland1

Copy link
Copy Markdown
Contributor

The offline checker can successfully seed every BVH pipeline and the runtime can accept the cache file, yet the driver can report zero application-cache hits. On Windows with an RTX 4070 Ti SUPER (610.88), this happened for all 52 distinct Xbox 1.0.2.1 builder pipelines.

The runtime enables maintenance8 when the device supports it. The checker previously requested it only if a selected module declared that requirement. None of these 52 modules did. In a single-module control I varied device features and isolated maintenance8; enabling that feature was sufficient to turn a miss into a hit. This patch uses the existing device-extension and feature query for every batch. The existing per-module requirement check is preserved for devices without the feature.

Coordination claim · Original RX 9070 XT boot finding

Runtime measurements

Compared the stock checker at 37f2151 with this change. Both created all 52 pipelines from the same locally translated, wave64-emulated BVH modules. I ran the actual builder constructor through the Vulkan D3D12 device in bvh_builder_test (#5680 at ac440c30 with #7360 at 32232957 applied for the runtime-saved control). Local instrumentation recorded monotonic time and Vulkan's whole-pipeline creation feedback around each runtime vkCreateComputePipelines call. Each constructor made 53 successful calls for 52 distinct modules. Hits count only the first request for each module.

Starting application cache Hits / distinct pipelines in each run Median total time, 53 Vulkan calls Median LoadInstances call
Empty 0/52 203.8 ms 60.1 ms
Seed from stock checker 0/52 243.8 ms 70.2 ms
Seed from patched checker 52/52 17.6 ms 5.0 ms
Seed saved by the runtime 52/52 17.9 ms 5.1 ms

Three fresh processes per row, interleaved order, valid feedback on all 52 distinct requests. Driver-managed caches were left intact. These are warmed-driver measurements of pipeline creation, not boot times. The reported AMD boot stop still needs a repeat on the affected card with a newly generated seed.

Checks

Windows 11 build 26300, NVIDIA RTX 4070 Ti SUPER, driver 610.88, MSVC x64. All 52 modules passed spirv-val. Both checker unit suites passed (21 tests), as did the CMake CLI test. The patch changes only the offline checker; #5680 and #7360 supplied the measurement setup. AI-assisted with Codex. All game-derived inputs, caches and per-module logs stayed local.

@sennecools

Copy link
Copy Markdown
Contributor

AMD repeat of this, as the description asks for. Tested acc4812c2 applied to main 0433058a1: no conflict with the AMD side, and on AMD it is not enough alone.

Setup: Windows 11, MSVC (VS 2022 Build Tools), RX 9070 XT (driver 32.0.32029.2010) and the Radeon gfx1036 iGPU. Check: the pipeline_cache_seed ctest from #7501 (one synthetic compute shader, no game files): the checker writes a cache, the same pipeline is then created on the runtime's device from it, and the creation feedback has to report an application-cache hit.

Checker RX 9070 XT gfx1036
main miss not run
this PR alone miss not run
#7501 alone hit hit
this PR + #7501 hit hit

On this driver the key holds robustBufferAccess, scalarBlockLayout and robustImageAccess (each alone turns a hit into a miss), which #7501 turns off in the checker. maintenance8 does not change the AMD key: the runtime had it on and the checker off in the "#7501 alone" row. The two diffs touch different hunks and apply together cleanly, so I listed this PR as a dependency of #7501 for NVIDIA cards.

One more thing that matters for the build's seed on AMD and may be worth a look on NVIDIA: the AMD driver also keys on the executable's file name (not its folder). You got 52/52 from a vk_pipeline_check.exe seed, so 610.88 evidently does not.

AI-assisted.

@venetanji

Copy link
Copy Markdown
Contributor

Independent RTX 3080 Ti result on Arch Linux, Wine 11.20, NVIDIA 615.78.08 and clang-cl 23.1.3/xwin. I ran the same private RT-5 integration binary and the same 52 locally prepared builder shaders twice, with an empty driver cache directory for each run. I changed only the checker-generated application cache. The stock checker was built from main 042c5f378; the other included this PR at acc4812c2. Both Windows checkers had the same temporary exclusive-file-open fix needed to publish the cache under static UCRT.

These are startup outcomes. I did not measure Vulkan creation-feedback hits inside the retail process. Offline, the patched Windows checker reused its own seed for 52/52 hits. No game files or traces attached. AI-assisted.

@ikurta92-png

Copy link
Copy Markdown

Tested 2029116f3 (= acc4812c2 + upstream main 99d799a64) on NVIDIA GeForce RTX 3060 (Ampere, GA106), driver 617.42, Vulkan 1.4.351, Windows 11 Pro 10.0.26300, MSVC 19.51 (VS 2026), Vulkan SDK 1.4.363.1, RelWithDebInfo: pass, and the NVIDIA cache-key effect reproduces with synthetic shaders only.

The diff against the merged upstream main is only runtime/test/vk_pipeline_check.cpp (+6/-7). Baseline checker: main f6a00fc4d.

Method (no game files). 16 synthetic GLSL compute shaders (64 threads, a 144-byte push-constant block, LDS, a barrier; no descriptors, so none of them asks for maintenance8), compiled with glslangValidator, all passing spirv-val, with a hand-written index.json (stage: cs, subgroup_size: null). Each checker seeds its own cache; every load below starts from a fresh copy of that seed and runs with --cache-feedback. 3 runs per row, identical each time:

Seed written by Loaded by cs cache feedback
main main 16/16 hits
main this PR 0/16 hits
this PR this PR 16/16 hits
this PR main 0/16 hits

So on Ampere with 617.42, as on the Ada/610.88 card in the description, the driver keys application-cache entries on whether maintenance8 is enabled on the device, even for modules that don't use it. The runtime enables it whenever the device reports it (runtime/shims/d3d12_vulkan_device.cpp:9198-9206, :9347), so the PR's checker now writes seeds the runtime can hit, where the stock checker's can't.

Executable name and folder (the question in @sennecools' AMD comment): loading the PR's seed with the same binary copied as renamed_checker.exe in the same folder, and as vk_pipeline_check.exe in another folder, gave 16/16 hits in all 3 runs each. On this NVIDIA driver the key holds neither the file name nor the folder.

Unit tests (PR worktree, LEONIDA_VK_PIPELINE_CHECK set to the RelWithDebInfo binary): tests/test_vk_pipeline_check_index.py 11/11, tests/test_vk_pipeline_check_isolate.py 10/10.

Not covered: the runtime side. I didn't load a seed in gta6rt or a D3D12-layer test and didn't measure hits there; the checker-to-checker matrix only shows what the driver keys on. I also didn't check the AMD keys from #7501 (robustBufferAccess, scalarBlockLayout, robustImageAccess) on NVIDIA.

AI-assisted (Claude Code). Synthetic shaders only; nothing game-derived was used or attached.

@Valentinlqx

Copy link
Copy Markdown

Tested 2029116f3 (same code as acc4812c2) on NVIDIA GeForce RTX 4060 (Ada, desktop), driver 617.14, Vulkan 1.4.351, subgroup 32..32, Windows 11 Pro 26200: pass. This is an NVIDIA check on a second card and a newer driver than the description's 4070 Ti SUPER / 610.88.

Setup: main acccd0f1e + #7501 (c8a102d0c), then this PR on top. Both merged clean. MSVC 19.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.0. No game files. Implicit Vulkan layers (overlays) were off for the runs (VK_LOADER_LAYERS_DISABLE=~implicit~).

Tree ctest -R pipeline_cache_seed, 3 runs each
main + #7501 FAIL 3/3: "does not hit on the runtime's device (NVIDIA GeForce RTX 4060), which does hit a cache it wrote itself"
main + #7501 + this PR pass 3/3: "hits on the runtime's device (NVIDIA GeForce RTX 4060)"

On the combined tree, these also pass: pipeline_cache_file, vk_pipeline_check_cli, vk_pipeline_check_stack, pipeline_cache_snapshot, tests/test_vk_pipeline_check_index.py (11 OK) and tests/test_vk_pipeline_check_isolate.py (10 OK).

AI-assisted (Claude Code).

@djasdh

djasdh commented Nov 23, 2026

Copy link
Copy Markdown

Tested 2029116f3 on AMD Radeon RX 6900 XT (RDNA2, gfx1030, RADV NAVI21), Mesa 26.3.1, Vulkan 1.4.363, Arch Linux, llvm-mc 23.1.5, SPIRV-Tools 1.4.363.0, Python 3.14.10.

Rebuilt runtime/build/linux from scratch on this head (CMake 4.5, GCC 16.2.1) before running.

GPU suite (full) — 224/241 passed, 16 skipped, 1 failed (ms_wave_info_s3, same as main)
Translator suite — 447 files, 5956 tests, 2 files failed

Two semantic files fail on this head: test_image_atomics_guard and test_image_store_d16. Both also fail on main (dde82f27e) on this machine with the same counts, so this branch does not introduce them — they are the stale-after-#4473/#6805 pair already tracked in #7284. ms_wave_info_s3 fails in the full GPU suite on main here as well (it passes with --filter ms_wave_info_s3; reported in #6497).

Counts and error classes only; no game data. AI-assisted.

@Kalmarv

Kalmarv commented Nov 23, 2026

Copy link
Copy Markdown

Independently checked head 2029116 on Windows 11, NVIDIA RTX 5070 Ti, driver 610.74, MSVC 19.44, Vulkan-Headers 1.4.363.

No blocking issue found in the change. The checker now enables maintenance8 whenever supported, matching the runtime's policy. The existing per-module requirement check remains in place.

Validation:

  • Target-only vk_pipeline_check build succeeded.
  • CLI, stack, large-module gate and pipeline-summary CTests: 4/4 passed.
  • test_vk_pipeline_check_index.py: 11/11 passed.
  • test_vk_pipeline_check_isolate.py: 10/10 passed.
  • Synthetic cache-feedback matrix with eight hand-assembled compute modules, fresh processes, repeated with a second module set: main->main 8/8 hits; main->PR 0/8; PR->main 0/8; PR->PR 8/8. Initial seeding runs had 0/8 hits. Main checker was built from 99d799a.

This independently reproduces cache incompatibility between the two checker configurations on this NVIDIA driver. It does not establish a retail boot improvement: no game inputs, runtime cache-reader run, AMD hardware, or timing measurements were used.

AI-assisted review and synthetic testing with Claude Code; results reviewed by the coordinating agent.

@danekbiglike

Copy link
Copy Markdown

RTX 3090 cache measurement on Windows, using the 52 BVH compute programs from my local copy. This is the checker from this PR on top of ASTROWwwW:ladder@ffc6f6da, LLVM 21.1.8, SPIRV-Tools 2026.4 and wave64 emulation.

Experiment Driver feedback and retail observation
Baseline checker produced a 5,674,578-byte seed The runtime read the file. The title stopped around 32 seconds into startup at its first BVH pipeline.
Checker from this PR loaded that seed and built all 52 0 hits, 52 misses. The resulting seed was 11,349,216 bytes.
Same checker reread the resulting seed 52 hits, 0 misses. Total compute compile time was 0.04 s with three workers.
Retail runtime loaded the updated seed Got past BVH initialization and reached device slot 41, with 1,656 traced D3D12 calls.

Driver feedback was collected with vk_pipeline_check --cache-feedback. The retail comparison also included the shader-library loader from #7529. The checker hit counts are directly measured. Reproduction notes.

AI-assisted with OpenAI Codex.

@JuniorBoschet

Copy link
Copy Markdown

Measured on another NVIDIA card: this fixes the cache miss for me.

On: Windows 11, MSVC, NVIDIA GeForce RTX 3060, driver 32.0.16.2124, Vulkan SDK 1.4.363.0, retail 1.0.2.1. Runtime from #8134's head with only this PR's commit (acc4812c2) cherry-picked on top (the full branch conflicts with that base in unrelated files). The 52 XboxBvhBuilder programs translated with --wave64-emulate into <work>/shaders/spirv/bvh.

  • Without this commit: vk_pipeline_check <bvh dir> pipeline_cache.bin writes a 5.6 MB cache and its own second run takes the slowest program from it in 0.2 s, but gta6rt (with LEONIDA_D3D12=vulkan, which logs "loaded 5671353 bytes from pipeline_cache.bin") still compiles that program in the driver: a stack snapshot 25 s into the boot has the BVH builder's worker inside nvgpucomp64 under PipelineState::create_compute, and the title's ~30 s watchdog fires. Uncached, that one program takes 30.9 s on this GPU (88 s for all 52, the other 51 average 1.7 s).
  • With this commit: the regenerated cache hits in the runtime. All BVH builder compute pipelines together take 444 ms in create_compute (a local timing probe around vkCreateComputePipelines), the watchdog does not fire, and the boot carries on to the next stop (an XMemAllocatePhysicalPages of 99,776 pages that the host refuses with error 1450, which is unrelated to this PR).

(AI-assisted run and write-up, Claude Code.)

@SirKingg

Copy link
Copy Markdown
Contributor

Independent Windows Sandbox experiment on an NVIDIA GeForce RTX 4070 Ti (driver 610.88), with a temporary boot integration and a private, Python-decoded BVH-only shader set (52 modules passed spirv-val; semantic equivalence was not established):

  • Stock checker: 52/52 cache hits when the checker reloaded its own seed, and the runtime logged that it loaded the seed, but runtime slot-62 call 32 took 20.95 s; a title-thread null write occurred at 32.23 s during call 36.
  • Checker with vk_pipeline_check: enable maintenance8 with the runtime so offline BVH cache seeds hit #7474: its second pass again reported 52/52 hits, and all 53 runtime slot-62 calls returned S_OK. The same integration advanced to the next existing command-signature stop in 4.19 s. This compares elapsed time and HRESULTs, not runtime creation-feedback hit counters.

The Sandbox configuration disabled networking and guest checks found no active adapters or default routes before each execution. No rendered frame or correctness of translated shader behavior is claimed.

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.