Skip to content

vk_pipeline_check: match runtime device features and restore pipeline_cache_seed test (RT-PIPELINE-CACHE-SEED) - #821

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
Taffyyy-ops:fix/vk-pipeline-cache-seed
Nov 24, 2026
Merged

aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
Taffyyy-ops:fix/vk-pipeline-cache-seed

Conversation

@Taffyyy-ops

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-PIPELINE-CACHE-SEED (#14 (comment))

What and why

Restores the vk_pipeline_check / runtime Vulkan device cache-key parity fix and pipeline_cache_seed regression test from ancestor commit c8a102d0cf (Senne Cools), which had been dropped from main by bulk merge 6dece9231, and fixes an additional NVIDIA Blackwell cache-key mismatch uncovered on current main (after #577):

  1. Disable three features in runtime/test/vk_pipeline_check.cpp (matching c8a102d0cf / RX 9070 XT findings):
    • f2.features.robustBufferAccess = VK_FALSE;
    • f12.scalarBlockLayout = VK_FALSE;
    • f13.robustImageAccess = VK_FALSE;
  2. Match runtime optional extensions and meshShaderQueries on runtime/test/vk_pipeline_check.cpp (measured on NVIDIA GeForce RTX 5060 Laptop GPU, driver 621.24):
    • Even with those three features disabled (and even with minimal core/1.1/1.2/1.3 feature parity and matching VkApplicationInfo::pApplicationName), a cache written by vk_pipeline_check still missed on RTX 5060 while a self-written cache hit.
    • Leave-one-out / isolated probing showed NVIDIA driver 621.24 hashes both VK_EXT_mesh_shader (including meshShaderQueries = VK_TRUE, which create_vulkan_device_standalone enables since d3d12/vulkan: a mesh segment's clipping invocations come from a mesh-primitives query (D3D-MESH-CLIPPING-COUNTER) #577) and VK_KHR_maintenance8 into the pipeline cache key even for compute pipelines.
    • vk_pipeline_check previously enabled both extensions only when selected shaders requested them and forced mesh.meshShaderQueries = VK_FALSE. It now enables both whenever supported and preserves meshShaderQueries.
  3. Self-contained pipeline_cache_seed CTest (runtime/test/pipeline_cache_seed_test.cpp + runtime/CMakeLists.txt):
    • Embeds the minimal valid compute SPIR-V module directly (35 words, LocalSize(1, 1, 1)), so the test builds and runs without glslangValidator or CMake script wrappers while matching tests/test_ctest_registration.py (every SKIP prints and returns 77).
    • Copies vk_pipeline_check.exe via CopyFileW under its own executable filename into a temporary directory, runs it via CreateProcessW (inheriting environment / LEONIDA_VK_DEVICE), seeds a VkPipelineCache on create_vulkan_device_standalone, and asserts VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT (or skips with 77 where no Vulkan 1.3 device or self-cache-hit support exists).
  4. Documentation (docs/pipeline_check.md):
    • Restores ### The cache and the runtime's device and adds the Windows 11 Intel RaptorLake-S iGPU and NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24) measurements.

Tested

  • Build (vcvars64.bat && cmake --build runtime/build, MSVC 19.44, RelWithDebInfo): clean, 0 errors, 0 /W4 /permissive- /utf-8 warnings in all touched targets.
  • BEFORE (pipeline_cache_seed on d0da7dade before any feature clears):
    • NVIDIA GeForce RTX 5060 Laptop GPU: FAIL (exit 8 / 1 — vk_pipeline_check cache missed on runtime device while self-written cache hit).
    • Intel(R) RaptorLake-S Mobile Graphics Controller: FAIL (exit 8 / 1 — cache missed).
  • AFTER the 3 feature clears alone (robustBufferAccess, scalarBlockLayout, robustImageAccess):
    • Intel(R) RaptorLake-S Mobile Graphics Controller: PASS (ok: vk_pipeline_check cache hits on the runtime's device, exit 0).
    • NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24): still FAIL (exit 8 / 1).
  • AFTER full fix (adding VK_EXT_mesh_shader with meshShaderQueries + VK_KHR_maintenance8 when supported):
    • Default (NVIDIA GeForce RTX 5060 Laptop GPU): vk_pipeline_check_cli, vk_pipeline_check_stack, pipeline_cache_seed -> 3/3 Passed (ok: vk_pipeline_check cache hits on the runtime's device (NVIDIA GeForce RTX 5060 Laptop GPU)).
    • LEONIDA_VK_DEVICE="RTX 5060": pipeline_cache_seed -> 1/1 Passed (exit 0).
    • LEONIDA_VK_DEVICE="Intel": pipeline_cache_seed -> 1/1 Passed (ok: vk_pipeline_check cache hits on the runtime's device (Intel(R) RaptorLake-S Mobile Graphics Controller), exit 0).
  • Python & hygiene checks:
    • python -I tests/test_ctest_registration.py -> 4/4 OK
    • python -I tests/test_docs_list_items.py -> 3/3 OK
    • python -I tests/test_docs_repeated_lines.py -> 2/2 OK
    • python -I tests/test_docs_table_ids.py -> 2/2 OK
    • python -I tests/test_text_write_line_endings.py -> 3/3 OK
    • python -I scripts/check_no_game_data.py runtime/test/vk_pipeline_check.cpp runtime/test/pipeline_cache_seed_test.cpp runtime/CMakeLists.txt docs/pipeline_check.md -> exit 0
    • git diff --check -> clean

GPUs tested: NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24) and Intel(R) RaptorLake-S Mobile Graphics Controller on Windows 11, MSVC 19.44 RelWithDebInfo. No game files.

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

@abnalstlll-byte abnalstlll-byte 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.

Clean-Room Peer Review for PR #821 (vk_pipeline_check: match runtime device features and restore pipeline_cache_seed test)

Outstanding empirical driver analysis and pipeline cache reconciliation:

  • Pipeline Cache Key Alignment:
    • Unconditionally disables
      obustBufferAccess, scalarBlockLayout, and
      obustImageAccess in �k_pipeline_check, matching create_vulkan_device_standalone.
    • Accurately accounts for NVIDIA's driver behavior hashing VK_EXT_mesh_shader, meshShaderQueries, and VK_KHR_maintenance8 into the compute pipeline cache key.
    • Aligns device feature requests between the offline checker and runtime loader, guaranteeing VkPipelineCache hits across AMD RDNA3/4, NVIDIA Blackwell/Ada, and Intel Xe.
  • Verification Harness:
    • pipeline_cache_seed_test.cpp cleanly mocks an embedded compute pipeline, verifies same-named binary execution invariance, and verifies feedback bit VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT.
    • Correctly handles headless/software drivers (llvmpipe) with exit code 77 (SKIP_RETURN_CODE).
  • Clean-room verification:
    • Pure synthetic compute SPIR-V module in test fixture; zero proprietary binaries or carved shaders.
    • Comprehensive documentation updates in docs/pipeline_check.md.

LGTM! Superb contribution. Approved.

@abnalstlll-byte abnalstlll-byte 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.

Clean-room verified (zero game data, synthetic SPIR-V compute shader fixture only). Critical Vulkan driver pipeline cache key alignment (disabling robustBufferAccess/scalarBlockLayout/robustImageAccess and enabling maintenance8/meshShaderQueries to match runtime device) and comprehensive pipeline_cache_seed_test restoring verification.

…_cache_seed test (RT-PIPELINE-CACHE-SEED)

Restores the vk_pipeline_check / runtime Vulkan device cache-key parity fix from
ancestor commit c8a102d (Senne Cools), which had been dropped in bulk merge
6dece92, and extends it for NVIDIA Blackwell (RTX 5060, driver 621.24) + ProjectLeonida#577:

- Disable robustBufferAccess, scalarBlockLayout and robustImageAccess on
  vk_pipeline_check's VkDevice to match create_vulkan_device_standalone.
- Always enable VK_EXT_mesh_shader and VK_KHR_maintenance8 when supported
  (rather than only when selected shaders request them) and keep
  meshShaderQueries as supported (matching ProjectLeonida#577 in d3d12_vulkan_device.cpp),
  because NVIDIA hashes both into pipeline cache keys even for compute shaders.
- Restore and register the pipeline_cache_seed CTest with a self-contained
  pipeline_cache_seed_test that embeds a minimal synthetic compute SPIR-V module
  (no glslangValidator required) and runs vk_pipeline_check under its own exe
  filename.
- Update docs/pipeline_check.md ("The cache and the runtime's device").

AI-assisted: yes
@Taffyyy-ops
Taffyyy-ops force-pushed the fix/vk-pipeline-cache-seed branch from ba5b7ff to e00d9d0 Compare November 24, 2026 17:08
@towade

towade commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

checked: e00d9d05b on two more vendors, Windows 11 26300, MSVC 19.44 (CMake + Ninja), main 3aa975421 with this PR merged, device picked with LEONIDA_VK_DEVICE. The new pipeline_cache_seed_test was run once against main's vk_pipeline_check and once against this PR's.

GPU vk_pipeline_check from main from this PR
AMD Radeon RX 9070 XT (RDNA4, 32.0.32029.2010) exit 1: cache does not hit on the runtime's device ... differs from the runtime's in something the driver makes part of a pipeline's cache key exit 0, cache hits on the runtime's device
Intel UHD Graphics 770 (Xe-LP, 32.0.101.7092) exit 1, the same message exit 0, cache hits on the runtime's device

So the cache-key mismatch is not NVIDIA-only: on main it is there on the AMD and the Intel Windows drivers too, and this PR removes it on both.

Not run: a full vk_pipeline_check over the corpus with a warm cache.

AI-assisted (Claude Code).

@aslan2142
aslan2142 merged commit 32a5d96 into ProjectLeonida:main Nov 24, 2026
7 of 12 checks passed
@aslan2142

Copy link
Copy Markdown
Collaborator

Merged. Nothing blocks this: the claim is valid and first, and it merges cleanly.

  • Local (Linux): the portable build is clean, and ctest gives 72 passed, 2 skipped, 0 failed on both main and main + this PR. The checker passes on llvmpipe and on an RDNA2 iGPU (RADV) with 0 validation errors.
  • Others: towade reports it passing on an RX 9070 XT and a UHD 770 where main fails.
  • The restored pipeline_cache_seed_test is Windows-only and could not be run here.

Three small edge cases where the checker and the runtime's device still differ, for a follow-up:

  • VK_EXT_mesh_shader and VK_KHR_maintenance8: the checker enables the extension whenever it is listed (link(..., true)). create_vulkan_device_standalone enables it only when meshShader / maintenance8 is VK_TRUE. Gating on the feature, as the runtime does, would close that gap.
  • meshShaderQueries: the checker clears it when pipelineStatisticsQuery is missing; the runtime has no such condition. Either drop the guard or put the same rule in both, and say which one docs/pipeline_check.md describes.
  • pipeline_cache_seed_test.cpp lines 340 and 346: clang-cl gives -Wmissing-field-initializers for the brace initialisers. MSVC /W4 is quiet; this matters only for the clang-cl cross-build.

AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).

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.

4 participants