Skip to content

vk_pipeline_check: choose robustBufferAccess and VK_EXT_robustness2 as the runtime does (RT-PIPELINE-CHECK-ROBUSTNESS) - #1833

Open
adrianmjim wants to merge 3 commits into
ProjectLeonida:mainfrom
adrianmjim:fix/pipeline-check-robustness
Open

adrianmjim wants to merge 3 commits into
ProjectLeonida:mainfrom
adrianmjim:fix/pipeline-check-robustness

Conversation

@adrianmjim

@adrianmjim adrianmjim commented Nov 25, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: RT-PIPELINE-CHECK-ROBUSTNESS (#1608 (comment))

Depends on: none. main is merged in (cf1c34128).

What and why

pipeline_cache_seed fails on main on an AMD Radeon RX 7900 XT:

FAIL: vk_pipeline_check cache does not hit on the runtime's device (AMD Radeon RX 7900 XT), which does hit a cache it wrote itself: vk_pipeline_check's device differs from the runtime's in something the driver makes part of a pipeline's cache key

#1723 (ba626820e) made the runtime's device enable, where supported:

  • robustBufferAccess together with VK_EXT_robustness2's robustBufferAccess2, for bounded indexed indirect draws (leonida::can_enable_robust_index_view, with maintenance5);
  • nullDescriptor, wherever it is offered.

vk_pipeline_check still forced robustBufferAccess off and never enabled VK_EXT_robustness2. AMD makes robust buffer access part of a pipeline's cache key, so the cache the checker saves no longer hits in gta6rt.

The change: the checker now makes the same choice the runtime does, with the same helper and the same inputs.

  • It queries VK_EXT_robustness2 (and maintenance5) and decides nullDescriptor and the robust index view as create_vulkan_device_standalone does.
  • The update-after-bind input is the runtime's VulkanDeviceInfo::bindless. The checker also enables update-after-bind as the runtime does: the sampled-image, storage-image and storage-buffer bits only where bindless holds, never the uniform or texel buffer ones. Otherwise robustBufferAccess could meet a buffer update-after-bind feature without robustBufferAccessUpdateAfterBind (VUID-VkDeviceCreateInfo-robustBufferAccess-10247).
  • It chains VK_EXT_robustness2 (and maintenance5) only when one of them is used.
  • After the general feature query it keeps only those choices: robustBufferAccess and robustBufferAccess2 follow the robust index view, nullDescriptor is as decided, and robustImageAccess2 is off.

docs/pipeline_check.md ("The cache and the runtime's device") says so.

Tested

AMD Radeon RX 7900 XT (RDNA3), AMD driver 32.0.32029.2010 (26.11.2), no Resizable BAR, Windows 11 build 26300, VS 2022 (MSVC 19.44) RelWithDebInfo.

  • On the merge with main (7aa549e07, main cf1c34128):
    • pipeline_cache_seed passes 3 of 3, also under LEONIDA_VK_VALIDATION=1 with no VUIDs.
    • With only vk_pipeline_check.cpp put back to main's, it fails 3 of 3.
    • pipeline_cache_file, pipeline_cache_store, heavy_pipeline_cache, pipeline_cache_journal, vk_pipeline_check_cli, vk_pipeline_check_stack and pipeline_cache_snapshot pass.
  • On 0d80bc5df + both commits: pipeline_cache_seed 3 of 3, also under validation; the checker tests pass.
  • What matters: in a local experiment on the first revision, mirroring nullDescriptor alone still missed. Adding robustBufferAccess and robustBufferAccess2 hit, with or without maintenance5. Turning off the uniform and texel buffer update-after-bind bits did not change the hit.
  • Whole ctest -j 6 (first revision, on 0d80bc5df): 437 of 439 pass or skip. The two failures, d3d12_texture_tiles (test: texture tiles NOTE only for the measured CopyTiles offset rounding on AMD and Intel (D3D-TILES-AMD-BYTE-OFFSET) #964) and d3d12_clear, fail on main there too. It was not re-run on the merge.

Others' results in the thread: Radeon 780M (cache-key matrix with vk_pipeline_check), RTX 4060 and RTX 3080 Ti (pipeline_cache_seed passes).

Not run on NVIDIA or Intel. Where the runtime makes the other choice, the checker now makes it too.

GPUs tested: AMD Radeon RX 7900 XT (RDNA3), AMD 32.0.32029.2010, Windows 11 26300

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. (No translator change.)

…s the runtime does (RT-PIPELINE-CHECK-ROBUSTNESS)

Since ba62682 (ubiquitarianism#1723) the runtime's device enables robustBufferAccess
with VK_EXT_robustness2's robustBufferAccess2 for bounded indexed
indirect draws (leonida::can_enable_robust_index_view, with
maintenance5), and nullDescriptor wherever robustness2 offers it. The
checker still forced robustBufferAccess off and never enabled
robustness2. AMD makes robust buffer access part of a pipeline's cache
key, so the cache the checker saves stopped hitting in gta6rt:
pipeline_cache_seed fails on an RX 7900 XT.

The checker now makes the same choice with the same helper, chains
robustness2 and maintenance5 only when one of them is used, and after
the general feature query keeps only those choices. A buffer
update-after-bind feature it enables also asks the helper for
robustBufferAccessUpdateAfterBind, so its own device stays valid.

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
What changed in this PR

Aligns vk_pipeline_check device feature/extension selection with the runtime to avoid Vulkan pipeline cache key mismatches (notably on AMD where robust buffer access affects the cache key).

Changes:

  • Mirrors the runtime’s decisions for robustBufferAccess, VK_EXT_robustness2 (robustBufferAccess2, nullDescriptor), and (conditionally) VK_KHR_maintenance5.
  • Updates the checker’s post-query feature overrides so only the runtime-matching robustness bits remain enabled.
  • Documents the robustness/keying behavior and the runtime parity requirement.
File Description
runtime/​test/​vk_pipeline_check.cpp Adds runtime-parity robustness2/maintenance5 probing and applies matching feature enables to keep pipeline cache keys consistent.
docs/​pipeline_check.md Updates documentation to describe the runtime/checker alignment for robustness-related cache key behavior.

Review effort: Lite

Comment thread runtime/test/vk_pipeline_check.cpp Outdated
Comment on lines +1174 to +1178
// The runtime passes its bindless choice (storage-buffer update-after-bind); this device enables every
// supported update-after-bind feature, so any buffer one asks for the property (VUID-...-robustBufferAccess-10247).
q12.descriptorBindingUniformBufferUpdateAfterBind || q12.descriptorBindingStorageBufferUpdateAfterBind ||
q12.descriptorBindingUniformTexelBufferUpdateAfterBind ||
q12.descriptorBindingStorageTexelBufferUpdateAfterBind);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in ba6720e9a. The input is now the runtime's VulkanDeviceInfo::bindless (runtime_bindless(), the same six-feature AND). The checker also enables only the runtime's update-after-bind set, so robustBufferAccess never meets a buffer update-after-bind feature without the property.

Comment thread runtime/test/vk_pipeline_check.cpp Outdated
Comment on lines +1174 to +1175
// The runtime passes its bindless choice (storage-buffer update-after-bind); this device enables every
// supported update-after-bind feature, so any buffer one asks for the property (VUID-...-robustBufferAccess-10247).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Reworded in ba6720e9a, and it now cites the full VUID-VkDeviceCreateInfo-robustBufferAccess-10247.

@Mby159

Mby159 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

AMD Radeon 780M (RDNA3): main's checker diverges from the runtime's robustness choice, with a cache-key measurement

I could not run pipeline_cache_seed on this machine (no MSVC or Windows SDK here - the test links gta6rt_d3d12_com), so this is a device-feature measurement plus a cache-key measurement with vk_pipeline_check, not a run of the test itself. The device is an AMD Radeon 780M Graphics (RDNA3, PCI\VEN_1002&DEV_1900), Windows driver 32.0.32015.12012, Vulkan apiVersion 1.4.359, props.driverVersion 2.0.416.

The runtime's device enables robustness here, so main (0d80bc5df) still differs from the runtime on this GPU. Querying the features the way create_vulkan_device_standalone queries them: VK_EXT_robustness2 and VK_KHR_maintenance5 are advertised (the maintenance5 feature is on), core robustBufferAccess and drawIndirectFirstInstance are on, robustBufferAccess2 and nullDescriptor are on, runtimeDescriptorArray, shaderSampledImageArrayDynamicIndexing, shaderStorageImageArrayDynamicIndexing and the sampled-image/storage-image/storage-buffer update-after-bind features are on (so the runtime's info.bindless is on), and robustBufferAccessUpdateAfterBind (Vulkan 1.2 property) is on. leonida::can_enable_robust_index_view(...) with the runtime's inputs therefore returns true here, so the runtime's device enables robustBufferAccess together with robustBufferAccess2, plus nullDescriptor where it is offered. With this PR's change the checker makes the same robustness choice on this device; on main the checker still forces robustBufferAccess off and never enables VK_EXT_robustness2.

Cache-key measurement. Four builds of runtime/test/vk_pipeline_check.cpp, one synthetic minimal compute SPIR-V and index.json (the same pair runtime/test/check_pipeline_cache_seed.cmake feeds the checker), and --jobs 1 --cache-feedback:

  • main (0d80bc5df): robustness off (core robustBufferAccess forced off, no VK_EXT_robustness2).
  • main + core robustBufferAccess on only, no VK_EXT_robustness2 (a local one-line patch of main).
  • this PR's head (97fb9ee3) with the robust index view forced off: VK_EXT_robustness2 with nullDescriptor on, both robustBufferAccess bits off (a local patch of this PR).
  • this PR's head as it stands: core robustBufferAccess + robustBufferAccess2 + nullDescriptor, and VK_KHR_maintenance5 with the robust index view.

Each build was run as the same file name (pipeline_cache_seed_test.exe) in the same directory; one run writes the cache, the next is given that cache file and reports the VkPipelineCreationFeedback hits:

cache written by read by main (robustness off) read by main + core robustBufferAccess on read by robustness2 + nullDescriptor only read by this PR's configuration
main (robustness off) 1 hit 0 hits 0 hits 0 hits
main + core robustBufferAccess on 0 hits 1 hit 0 hits 0 hits
robustness2 + nullDescriptor only 0 hits 0 hits 1 hit 0 hits
this PR's configuration 0 hits 0 hits 0 hits 1 hit

Every build hits its own cache (the diagonal) and misses the others, so the mechanism works on this driver; the off-diagonal entries report "no hit reported". The whole matrix was run twice with the same result. The cache file is accepted in every case: in the main/PR pair it grows from 2412 to 4772 bytes after the cross-configuration read, and each configuration then hits only its own entry - the misses are a cache-key difference, not a rejected cache.

So on this driver, turning core robustBufferAccess on and nothing else changes the key, and enabling VK_EXT_robustness2 with nullDescriptor (both robustBufferAccess bits still off) changes it as well.

One difference in the inputs, from reading the code rather than measuring it: the runtime passes its info.bindless as the update-after-bind input to can_enable_robust_index_view, while this PR's checker passes "any of the four update-after-bind features is supported". On this device both are true, so it did not affect the measurement above. On a device where info.bindless is false while one of those four is supported and robustBufferAccessUpdateAfterBind is false, and where the sized-indirect and robust-access gates pass, the helper returns true for the runtime and false for the checker, and the two would still disagree.

Not covered here: pipeline_cache_seed itself, the validation layer, and anything but one AMD GPU and one driver version. The RX 7900 XT result in the PR description is the author's own run of pipeline_cache_seed; I did not reproduce that test here.

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

@potatoe0100

Copy link
Copy Markdown
Contributor

NVIDIA data point: 97fb9ee3d merged onto main 98c2f7777 (clean), native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060, driver 621.14, VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja.

  • pipeline_cache_seed passes with this PR, as it does on main here, so the robustness choice keeps the cache hitting on NVIDIA.
  • Full ctest -j 6: all pass apart from xmem_no_write_watch, which failed while another build was running on this PC; xmem failed the same way in the main run under that load. run_gpu_tests.py: 209/263, identical to main.

AI-assisted (Claude)

@BubsMcgee

Copy link
Copy Markdown
Contributor

Potential high-severity gap in the robustness input, as Copilot flagged: the checker does not pass the same bindless choice the runtime passes.

The runtime (runtime/shims/d3d12_vulkan_device.cpp, create_vulkan_device_standalone) passes info.bindless, which is an AND:

runtimeDescriptorArray && shaderSampledImageArrayDynamicIndexing && shaderStorageImageArrayDynamicIndexing &&
descriptorBindingSampledImageUpdateAfterBind && descriptorBindingStorageImageUpdateAfterBind &&
descriptorBindingStorageBufferUpdateAfterBind

This checker passes an OR of descriptorBindingUniformBufferUpdateAfterBind, descriptorBindingStorageBufferUpdateAfterBind, descriptorBindingUniformTexelBufferUpdateAfterBind, descriptorBindingStorageTexelBufferUpdateAfterBind.

The OR can be true where info.bindless is false, e.g. a device that supports uniform/texel-buffer update-after-bind but not the sampled/storage-image UAB, or lacks runtimeDescriptorArray / dynamic indexing. The helper's last parameter is storage_update_after_bind, and when it is true the helper requires robustBufferAccessUpdateAfterBind. So on such a device, if that property is false, the checker chooses robust_index_view = false (robustBufferAccess off) while the runtime chooses true — the same class of cache-key mismatch this PR fixes.

The shared test device helper already does it correctly: runtime/test/vk_test_device.h:434 computes bindless with the same six-feature AND and passes that to can_enable_robust_index_view. The checker should do the same: compute that predicate from its queried features and pass it, rather than the OR. (The checker also enables every supported UAB feature, whereas the runtime enables only what info.bindless needs; for the device itself to match, it probably needs to mirror the runtime's UAB enable set too.)

On the 7900 XT both are true and robustBufferAccessUpdateAfterBind is true, so pipeline_cache_seed passes; the divergence is latent on devices where they differ. Worth correcting before treating #1833 as fully solving the AMD parity.

AI-assisted.

@BubsMcgee

Copy link
Copy Markdown
Contributor

Concrete patch for the OR-vs-AND gap, on top of your branch so it is easy to take:

Branch: BubsMcgee/leonida:fix-1833-bindless (head 3e45ed067, based on main b0f3d3998 + your 5894f9324). The only change is the last argument to can_enable_robust_index_view in runtime/test/vk_pipeline_check.cpp: replace the OR of the four update-after-bind flags with the same predicate the runtime passes (VulkanDeviceInfo::bindless in create_vulkan_device_standalone, and already in runtime/test/vk_test_device.h:434):

q12.runtimeDescriptorArray && query.features.shaderSampledImageArrayDynamicIndexing &&
    query.features.shaderStorageImageArrayDynamicIndexing &&
    q12.descriptorBindingSampledImageUpdateAfterBind &&
    q12.descriptorBindingStorageImageUpdateAfterBind &&
    q12.descriptorBindingStorageBufferUpdateAfterBind

Why: the OR is true on a device that supports, say, uniform/texel-buffer update-after-bind but not the sampled/storage-image ones (or lacks runtimeDescriptorArray), where the runtime's bindless is false. The helper's last parameter is storage_update_after_bind; with the OR true and robustBufferAccessUpdateAfterBind false, the checker would disable robust_index_view while the runtime enables it, changing robustBufferAccess and the cache key again.

Tested on Windows 11 / RTX 3080 Ti (driver 616.64): pipeline_cache_seed, pipeline_cache_file, pipeline_cache_store, vk_pipeline_check_cli, vk_pipeline_check_stack, pipeline_cache_snapshot — 6/6 pass. On this GPU the OR and the AND agree (both true), so this is a no-regression check; the divergence needs a device where they differ.

AI-assisted.

… set (RT-PIPELINE-CHECK-ROBUSTNESS)

can_enable_robust_index_view's last input is now the runtime's
VulkanDeviceInfo::bindless (the six-feature AND), not an OR of the four
buffer update-after-bind features, so the checker makes the runtime's
robust index view choice on every device.

The checker also enables update-after-bind as the runtime does: the
sampled-image, storage-image and storage-buffer bits only where bindless
holds, never the uniform or texel buffer ones. Without that, a device
with robustBufferAccess on and no robustBufferAccessUpdateAfterBind
would enable a buffer update-after-bind feature
(VUID-VkDeviceCreateInfo-robustBufferAccess-10247).

Reported by Copilot and BubsMcgee on ProjectLeonida#1833.
…ustness

# Conflicts:
#	runtime/test/vk_pipeline_check.cpp
@adrianmjim

Copy link
Copy Markdown
Author

Updated: ba6720e9a fixes the bindless input, and 7aa549e07 merges current main (cf1c34128). The only conflict was the transform-feedback line from D3D-302, and both are kept.

Thanks @BubsMcgee, Copilot, @Mby159 and @potatoe0100.

The bindless input. The OR was wrong, as you said. The checker now passes the runtime's VulkanDeviceInfo::bindless, the same six-feature AND as vk_test_device.h:434.

The AND alone was not enough, though. The checker enables every update-after-bind feature the device supports, while the runtime enables only the three its set 0 uses, and only where bindless holds. Take a device where bindless is false, the storage-buffer update-after-bind feature is supported and robustBufferAccessUpdateAfterBind is false. There the helper returns true, so the checker would enable robustBufferAccess together with a buffer update-after-bind feature, which VUID-VkDeviceCreateInfo-robustBufferAccess-10247 forbids. That was the reason for the OR in the first place. So the checker now also enables update-after-bind as the runtime does:

  • the sampled-image, storage-image and storage-buffer bits only where bindless holds;
  • never the uniform or texel buffer bits.

Set 0 only has sampled images, samplers, storage images and one storage buffer (vulkan_bindless.h), so its update-after-bind layout still has the features it needs. The comment now cites the full VUID, and docs/pipeline_check.md says the same.

Tested on an AMD Radeon RX 7900 XT (RDNA3), AMD 32.0.32029.2010, no Resizable BAR, Windows 11 26300, VS 2022 RelWithDebInfo:

  • On 0d80bc5df + ba6720e9a: pipeline_cache_seed passes 3 of 3, and under LEONIDA_VK_VALIDATION=1 with VK_LAYER_KHRONOS_validation loaded it reports no VUIDs. vk_pipeline_check_cli, vk_pipeline_check_stack and pipeline_cache_snapshot pass.
  • On the merge with main (7aa549e07):
    • pipeline_cache_seed passes 3 of 3, also under validation with no VUIDs.
    • With only vk_pipeline_check.cpp put back to main's, it fails 3 of 3 with the same "does not hit" message as in the description.
    • pipeline_cache_file, pipeline_cache_store, heavy_pipeline_cache, pipeline_cache_journal, vk_pipeline_check_cli, vk_pipeline_check_stack and pipeline_cache_snapshot pass.

Turning off the uniform and texel buffer update-after-bind bits did not change the hit on this card, which agrees with the 9070 XT note that the checker's other features are not part of the key. A device where the OR and the AND differ still needs testing; none of the GPUs tested here is one.

@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 27, 2026
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