Skip to content

runtime tests: gate the core feature chains on the device's Vulkan version (TEST-1110) - #4936

Closed
sh1shu1 wants to merge 2 commits into
ProjectLeonida:mainfrom
sh1shu1:test-1110-vulkan-feature-gates
Closed

sh1shu1 wants to merge 2 commits into
ProjectLeonida:mainfrom
sh1shu1:test-1110-vulkan-feature-gates

Conversation

@sh1shu1

@sh1shu1 sh1shu1 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claimed as TEST-1110 (tupacfan04's finding in #4816).

Six test programs (vk_sandbox, vk_harness, vk_compute_test, vk_store_test, vk_texture_test, vk_pipeline_check) chained VkPhysicalDeviceVulkan11/12/13Features into VkPhysicalDeviceFeatures2 / VkDeviceCreateInfo whatever the device's apiVersion. On a 1.1 device those structs are not valid pNext members (VUID-VkDeviceCreateInfo-pNext-pNext; the 1.1 struct itself is a 1.2 addition); a 1.0 implementation refuses the 1.2/1.3 instance before that.

vk_device_pick.h gets api_version_at_least(props, needed, program), which prints unsupported: <device> is a Vulkan 1.1 device, <program> needs 1.2; the six programs call it right after choosing the device and exit 77 like their other unsupported exits. pick_device takes the program's minimum version and ranks the devices that reach it first, older ones only when none does: a 1.1 discrete GPU no longer hides a 1.2 integrated one, while an old-only machine or an explicit LEONIDA_VK_DEVICE still reaches the diagnostic. The 1.3 struct is chained on a 1.3 device only (vk_harness, vk_compute_test, vk_pipeline_check): on a 1.2 device it stays zero, so subgroup size control and dynamicRendering read as absent instead of undefined (a 1.2 device keeps no subgroup size control either, even with VK_EXT_subgroup_size_control; querying the EXT structs on 1.2 as Vulkan13Features does for dynamic rendering is a follow-up). Not touched: the unqueried shaderInt64 / samplerAnisotropy enables. Merges cleanly with #4776 (vk_sandbox).

Tests: vk_device_pick_test covers the helper and the ranking (eight synthetic cases). On 1.3+ devices nothing changes: RTX 4090, 5070, 5090, a Radeon iGPU and llvmpipe gave main's hashes and test counts at 92552e8 (comments below); 24769e1 changes the ranking only; an Apple M2 A/B of the rebased 38e379e is identical to base. RTX 4070 SUPER (driver 616.92), Windows 11, at 38e379e on main d8a9bda: builds; vk_device_pick and vk_pipeline_check_cli 2/2; run_gpu_tests with validation 190/239 native and 221/239 emulated with only main's ms_wave_info_s3 failing; full ctest 264/269, the five failures being main's at that commit (d3d12_indirect_dispatch_count #5792, d3d12_indirect_rt #6010, d3d12_mesh under validation since #2359 merged, d3d12_vulkan_device line 6564 #7125, vk_queue as in #166), none of them touching the six programs. macOS: the six programs compile and the unit test passes. No older device at hand. No game files.

AI-assisted (Claude Code, Claude Fable 5.1).

🤖 Generated with Claude Code

https://claude.ai/code/session_01GDgoLQVYG7p8mvxkwBroVz

@tupacfan04

Copy link
Copy Markdown
Contributor

Independent Windows check at 92552e81, AI-assisted.

Built all six programs plus vk_device_pick_test with MSVC 19.51.36260.0 x64 (VS 18, 14.51.36231), Windows 11, CMake/Ninja, RelWithDebInfo, -DBUILD_TESTING=ON. No build errors.

I do not have a Vulkan 1.1/1.2 device, so the exit-77 path is only covered by the synthetic vk_device_pick cases here; the 1.3+ path is unchanged in practice. No game files or GPU data used.

@SphyserX

Copy link
Copy Markdown

Tested 92552e8 on Arch Linux (in a VM), GCC, Ninja, RelWithDebInfo, Mesa llvmpipe (Vulkan 1.4): pass on a 1.3+ device.

  • vk_device_pick_test: all cases pass (it prints the 1.1-needs-1.2 and 1.2-needs-1.3 refusals, then all cases passed).
  • Full Linux CTest: 50 of 50 pass.
  • scripts/run_gpu_tests.py on llvmpipe: 145 of 217 pass, 72 skipped, 0 failures. So the six programs are unchanged on a 1.4 device.

The old-device path is still untested on real hardware. I tried MESA_VK_VERSION_OVERRIDE=1.1 and =1.2 to make llvmpipe report a lower version, but lavapipe ignores it here (it still reports apiVersion = 1.4.363). Someone with a genuine 1.1/1.2 device (or a driver that honours the override) would need to confirm the exit-77 skip.

@dcastell1

Copy link
Copy Markdown
Contributor

Tested 92552e8 on RTX 5090, 621.24, Windows 11: pass. Programs rebuilt from this tree, LEONIDA_W64_EMULATE=1: 201/217 passed, 16 skipped, 0 failed — same counts as the tree without the change, so the feature-chain gating does not skip anything this GPU can actually run.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 92552e8 on Windows 11 with the NVIDIA GeForce RTX 4090 (32.0.16.2101) and AMD Radeon(TM) Graphics (32.0.21043.5001). Both adapters pass. Each program prints the selected adapter name.

  • On each adapter, vk_sandbox renders a synthetic triangle at 32 × 32. It covers all 1,024 pixels. All four image files from the PR and baseline 3faac55 have the same SHA-256 digest.
  • On each adapter, vk_harness renders a 3 × 5 target with synthetic shaders. All four raw output files have the same SHA-256 digest.
  • I also tested the version gate. In each scratch build, I set props.apiVersion = VK_API_VERSION_1_1; immediately after vkGetPhysicalDeviceProperties(pd, &props); in vk_harness.cpp. With the RTX 4090 selected, the PR reports that Vulkan 1.2 is required and exits with code 77. The baseline renders the same target and exits with code 0. This check simulates the reported version.
  • ctest -C RelWithDebInfo -R "^(vk_device_pick|vk_pipeline_check_cli)$" --output-on-failure passes both tests. I built all six changed programs. The GPU runs cover vk_harness and vk_sandbox.

AI-assisted.

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

Independent Windows CPU integration check, AI-assisted. #4936, #3045 and #3187 merged cleanly onto 3faac557. Applying the API-version change before or after the capability stack produced the same tree b8400df0f90cb490d4e4c4fc011148dcdb556f7b. MSVC 19.38 x64 built the picker test and checker, both focused CTests passed, and the Python worker-order check passed. The Vulkan 1.3 feature struct stays out of the 1.2 chain, while supported sampled/storage bits remain enabled and missing requirements are still checked before module creation.

One mixed-adapter case is worth considering: a synthetic Vulkan 1.1 discrete adapter outranked a 1.2 integrated adapter, so the default selection reached the skip gate. Explicitly selecting the 1.2 adapter passed it. Filtering by the program’s minimum API version before automatic ranking would avoid a false skip; an explicitly selected old device can still get the version diagnostic. The sampler and bindless tests already filter versions before ranking.

Synthetic properties and CPU checks only, no Vulkan device or game inputs.

@tupacfan04

Copy link
Copy Markdown
Contributor

One addendum from a second independent check at 92552e81, not a blocker:

  • The 1.0 motivation is effectively unreachable: a 1.0 implementation must return INCOMPATIBLE_DRIVER for an apiVersion above 1.0, so vkCreateInstance exits 1 before the new helper can return 77. Only 1.1 devices actually reach the new unsupported path.
  • "Runners count a 77 as a skip" is only partial: scripts/run_gpu_tests.py:348 treats 77 as a skip in the wave64 branch, while the generic dump paths (:930,:937,:961) and runtime/test/shaders/check.py:809 still report it as a failure.
  • On a real 1.2 device the 1.3 feature query is zero, so vk_compute_test.cpp:208 with --require-wave64 is always 77, and vk_harness.cpp:616,784 lose subgroup-size control even when VK_EXT_subgroup_size_control is present. That is disclosed, but it is a real coverage loss for 1.2 hardware.

AI-assisted review, no game files.

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@whattheflop done in 24769e1: pick_device takes the program's minimum version and ranks the devices that reach it first, older ones only when none does, so an old-only machine and an explicit LEONIDA_VK_DEVICE still get the diagnostic; four more unit cases.

@tupacfan04 wording fixed in the same commit (no 1.0 path; 77 "like the other unsupported exits"). The 1.2 subgroup-size-control loss stays as disclosed: querying VK_EXT_subgroup_size_control on a 1.2 device, as Vulkan13Features does for dynamic rendering, is a follow-up rather than part of this gate.
AI-assisted (Claude Code, Claude Fable 5.1).

@Ayinaki

Ayinaki commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 24769e1 on RTX 5070, driver 616.86, Windows 10.0.26200: pass.

Built runtime (MSVC 14.52, Visual Studio 18 2026, x64, RelWithDebInfo) and ran the shader suite at this head:

LLVM_MC=... LEONIDA_SPIRV_TOOLS=... py -I runtime/test/shaders/build.py <out> then LEONIDA_VK_DEVICE="RTX 5070" py -I runtime/test/shaders/check.py <out> runtime/build/RelWithDebInfo

153 of 188 pass, 35 skipped

exit 0. The 35 skips are the ones this device can't run (full 64-wide compute subgroups unavailable, mesh fixtures built by scripts/run_gpu_tests.py, a 64-wide fragment subgroup required) and match what I see on this GPU at main. The Vulkan-version gating paths all take the "supported" branch here (device reports Vulkan 1.4), so vk_store_test, vk_texture_test, vk_compute_test and vk_harness run their full chains with no regression: the suite is clean, vk_device_pick_test passes ("device pick: all cases passed").

@Atomic258

Copy link
Copy Markdown
Contributor

Overlap note for the coordinator: this is the third PR covering TEST-1110 apiVersion gating — #4989 (a70525d5, independently verified pass on Windows/RTX 5090) and #4970 touch the same vk_compute_test/vk_harness/vk_pipeline_check/vk_sandbox/vk_store_test/vk_texture_test files for the same feature-chain gating. Worth a maintainer pick rather than three competing implementations.

AI-assisted (Devin).

@searyecheesepeaceful

Copy link
Copy Markdown

Tested 24769e1 on Intel UHD 630 (CFL GT2, subgroup 8..32), Mesa 25.2.8 ANV, Ubuntu 24.04, LEONIDA_VK_DEVICE=Intel: no change on a Vulkan 1.4 device.

Full scripts/run_gpu_tests.py after a build at the head and at main 3faac55 on the same machine:

  • head 24769e1: 154/217 passed, 61 skipped
  • main 3faac55: 154/217 passed, 61 skipped

The pass, skip and fail name sets are identical (217 entries each). Both fail cs_fmt_int_narrow (word 34: expected 0xffffffff, got 0x00000000) and cs_signed_zero_nan. vk_device_pick_test passes ("device pick: all cases passed"). The 1.1/1.2 branches cannot be reached on this device.

AI-assisted.

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Timeline for the coordinator, since three PRs cover TEST-1110: claims in #4816 came from vibryxcx first (confirmed by the coordinator), then this one (06:27Z), then tedin7; PRs opened as #4936 (06:33Z), #4970 (06:57Z), #4989 (07:07Z). This one carries six independent checks and the pick_device ranking from review. If claim order decides, I close this and vibryxcx is welcome to lift the ranking and the unit cases into #4970; if PR order decides, the other two can rebase on it. Either way, one PR.
AI-assisted (Claude Code, Claude Fable 5.1).

sh1shu1 and others added 2 commits November 23, 2026 17:04
…rsion (TEST-1110)

vk_sandbox, vk_harness, vk_compute_test, vk_store_test, vk_texture_test and vk_pipeline_check chained
VkPhysicalDeviceVulkan11/12/13Features into VkPhysicalDeviceFeatures2 and VkDeviceCreateInfo whatever the
device's apiVersion. On a 1.0 or 1.1 device those structs are not valid pNext members
(VUID-VkDeviceCreateInfo-pNext-pNext), and a 1.0 instance has no vkGetPhysicalDeviceFeatures2.

vk_device_pick.h gets api_version_at_least(props, needed, program): the six programs require a 1.2 device after
choosing it and exit 77 (unsupported) otherwise, as the clean sites do. The 1.3 struct is chained on a 1.3
device only (vk_harness, vk_compute_test, vk_pipeline_check); on a 1.2 device it stays zero, so subgroup size
control and dynamicRendering read as absent instead of undefined. vk_device_pick_test covers the helper.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDgoLQVYG7p8mvxkwBroVz
…first (TEST-1110)

whattheflop's review: a 1.1 discrete GPU outranked a 1.2 integrated one, so the new gate skipped a program the
machine could run. pick_device takes the minimum version and ranks the devices that reach it; the older ones are
ranked only when none does, so an old-only machine still picks one and the gate reports it, and an explicit
LEONIDA_VK_DEVICE choice still gets the diagnostic. The five programs that use pick_device pass 1.2.

tupacfan04's review: the header comment no longer claims a 1.0 path (a 1.0 implementation refuses the instance
first) nor that every runner counts 77 as a skip.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDgoLQVYG7p8mvxkwBroVz
@sh1shu1
sh1shu1 force-pushed the test-1110-vulkan-feature-gates branch from 24769e1 to 38e379e Compare November 23, 2026 16:05
@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on main d8a9bda (head 38e379e): vk_compute_test now has main's groups-limit check and its f2q -> f12q -> f13q query chain, so the gate chains f13q behind f12q on a 1.3 device only (f12q.pNext is null on 1.2); nothing else changed. Windows run follows.
AI-assisted (Claude Code, Claude Fable 5.1).

@kapitche

Copy link
Copy Markdown
Collaborator

Tested 38e379e merged with main 042c5f3 on Windows 11 (MSVC 14.51, RelWithDebInfo, Ninja): pass
Real merge was clean. Built vk_device_pick_test, vk_compute_test, vk_harness, vk_pipeline_check, vk_sandbox, vk_store_test and vk_texture_test (no errors). ctest -R "vk_device_pick|vk_pipeline_check|vk_texture_cube_alpha" passes 4/4 on NVIDIA GeForce RTX 4080 SUPER and on Intel(R) UHD Graphics 770 (VK_LOADER_DRIVERS_DISABLE=nv plus LEONIDA_VK_DEVICE=Intel).
Negative control: with runtime/test/vk_device_pick.h reverted to main, vk_device_pick_test no longer compiles (api_version_at_least missing, pick_device does not take 2 arguments), so the new test depends on the PR's header change. This is a compile break, not a runtime assertion.
Not run: vk_compute_test, vk_store_test, vk_harness, vk_sandbox and the shader-driven vk_texture_test (they need shader or argument inputs I did not build), so the changed feature-chain gating in those was only compiled, not executed.
Overlap: #4970 is open for the same TEST-1110 gating in the same files (#4989 is closed), so one of the two will need a rebase.

@bobcatchris

Copy link
Copy Markdown
Contributor

Tested 38e379e on Apple M2 with MoltenVK 1.4.2 (macOS 26.4, device Vulkan 1.4.357, subgroup 4..32): vk_device_pick_test passes; full suite 178/239 passed, 59 skipped, 2 failed, identical to base fd33557 A/B; no regression.

Both heads built their own runtime with the same toolchain (AppleClang 17, llvm-mc 21.1.8, Python 3.13.18). vk_device_pick_test: all cases passed on both. GPU suite per-test comparison: 0 status differences, same two known failures (cs_fma_fused, ps_ssharp) and the same 59 skips. This device is Vulkan 1.4, so the new apiVersion gating should be a no-op here, and it is — the change is exercised only on older devices, which this machine cannot provide. No game data.

AI-assisted.

@SquishyGithub

Copy link
Copy Markdown

Tested 38e379e8e merged into main 37f215107 on NVIDIA GeForce RTX 3070 (Ampere), driver 620.70.06, Vulkan 1.4.357, subgroup 32..32, Linux (Bazzite 45; Fedora 45 distrobox, GCC 16.2.1, LLVM 23.1.5, SPIRV-Tools 2026.2, Python 3.15.2): pass

This machine has two Vulkan 1.4 devices (the RTX 3070 and Mesa llvmpipe). Every program picked the RTX 3070 (device: NVIDIA GeForce RTX 3070 in the runner output), and no program exited 77.

@thiefyzheng

Copy link
Copy Markdown

checked: ctest -R vk_compute_test at your head 38e379e8e — No tests were found!!!: target absent at this head. Not run; may land in a later commit on this branch. AI-assisted, 7900 XTX rig.

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.