Skip to content

vk_descriptor_bench, vk_sandbox: LEONIDA_VK_DEVICE names the GPU, and a filter that matches nothing fails the run (TEST-1141) - #9605

Closed
adamraskin wants to merge 2 commits into
ProjectLeonida:mainfrom
adamraskin:test/vk-device-pick-harnesses
Closed

adamraskin wants to merge 2 commits into
ProjectLeonida:mainfrom
adamraskin:test/vk-device-pick-harnesses

Conversation

@adamraskin

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-1141 (#9522 (comment))

What and why

docs/testing.md ("Choosing the GPU") says that LEONIDA_VK_DEVICE names the GPU in every harness, and that a value that matches no device fails the run instead of testing another GPU. Two tools in runtime/test ranked the devices themselves and ignored it:

  • vk_descriptor_bench, when no --device N is given.
  • vk_sandbox.

On a PC with two GPUs they always ran on the best-ranked one, whatever the filter said. Found by running every vk_* program with LEONIDA_VK_DEVICE=<no such GPU> at main 5d74c27. These two were the only ones that went on to choose a device. (vk_sampler_test and vk_bindless_test, named in the TEST-1141 row, already use vk_device_pick.h on current main.)

  • vk_sandbox now picks with leonida::vk_test::pick_device, the shared pick.
  • vk_descriptor_bench keeps its own Vulkan 1.1 and compute-queue checks, and skips a device that leonida::vulkan_device_wanted leaves out. --device N and --list-devices do not change.
  • When the filter left out every usable device, both call report_no_device() and exit 1, as vk_compute_test does. With no filter, the result is the same as before: the unsupported exit 77 for the bench, and the same device.
  • runtime/test/check_device_filter_tools.py (ctest vk_device_filter_tools): runs both tools with a filter that matches nothing and expects the failure that names the filter. It skips (77) on a machine with no Vulkan device, where vk_descriptor_bench --list-devices lists none.

Tested

Windows 11 Home 26300, MSVC 19.44, Ninja RelWithDebInfo (-DLEONIDA_VULKAN_HEADERS_FETCH=ON). One PC with an NVIDIA RTX 5090 (621.24) and an AMD Radeon iGPU of a Ryzen 7 9800X3D (gfx1036, 25.10.42). No game files.

  • ctest -R "vk_device_filter_tools|vk_device_pick|vulkan_device_filter|vk_descriptor_bench_selftest": 4/4 passed.
  • Negative control: the same checker against main's binaries fails for both tools. vk_descriptor_bench ran its benchmark on the RTX 5090 and exited 0. vk_sandbox chose the RTX 5090 too, and failed later on the missing shader file.
  • With a filter that matches: LEONIDA_VK_DEVICE=radeon gives device: AMD Radeon(TM) Graphics in both tools, and LEONIDA_VK_DEVICE=5090 gives device: NVIDIA GeForce RTX 5090.
  • Full ctest -j 8 of this branch: vk_device_filter_tools passes on both. With LEONIDA_VK_DEVICE=5090: 238 of 240 passed, failing d3d12_vulkan_device and d3d12_depth_resolve, the same as main. With LEONIDA_VK_DEVICE=radeon: 237 of 240 passed, the same two plus vk_queue_query_sync. That one fails 3 of 3 times on main's binary on this Radeon too (progress counter device loss NOT propagated, Runtime: propagate device loss found by the retire-ticket progress query (D3D-599) #6149, main 6312c057f on AMD RX 9070 XT (RDNA4, Windows 26300): 5 ctest failures; #5873 verified to fix one here #9544) and passes on the RTX 5090.
  • git diff --check, python -m compileall of the new script, and python -I scripts/check_no_game_data.py on every changed file: pass.

TEST-1141's triage part, on current main 5d74c27 on both GPUs, found no failure that nobody owns, so this PR holds only the code fix:

Not run: Linux, macOS, Wine.

AI-assisted: yes

Checklist

  • 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. (Not applicable: no translator change.)

-AI Assisted

…T-1141)

Both tools ranked the devices themselves and ignored LEONIDA_VK_DEVICE,
so on a PC with two GPUs they ran on the best-ranked one whatever the
filter said. vk_sandbox now uses vk_device_pick.h's pick_device, and
vk_descriptor_bench skips devices the filter leaves out. When the filter
matches no usable device, both report it and fail the run, as the other
harnesses do.

check_device_filter_tools.py (ctest vk_device_filter_tools) runs both
tools with a filter that matches nothing and skips on a machine with no
Vulkan device.
@matheusfermiano-source

Copy link
Copy Markdown

checked: #9605@9538218e | base: main@5d74c2723 | Arch Linux x86-64, GCC 16.2.1, CMake/Ninja | AMD Radeon 660M (RADV 26.3.1) and NVIDIA RTX 3050 Laptop (620.73.04) | 4/4 focused CTests

I tested both tools with the two physical GPUs on the same machine:

  • main ignored an unmatched filter in both tools and completed the workload on the RTX 3050. The PR's binaries both returned 1, printed the filter, and printed no selected device. The sandbox produced no image in the rejected run.
  • rAdEoN and 3050 selected the expected GPU for both tools. The sandbox drew an original synthetic triangle with glslang-generated, spirv-val-checked shaders. Both 64×64 readbacks were byte-identical, with 962 of 4096 pixels covered.
  • With the unmatched filter still set, the bench listed both devices, and passing the listed Radeon index explicitly completed a small benchmark on the Radeon. With the filter unset, the bench still selected the RTX 3050.
  • Forcing a nonexistent Vulkan ICD with VK_DRIVER_FILES produced the expected CTest skip.

One test-reporting gap. The preflight maps any nonzero --list-devices status to skip. A synthetic executable returning 23 with an unexpected-error diagnostic made the checker return 77. That's a distinct outcome from the real no-ICD case, where the current bench returns 1 with VK_ERROR_INCOMPATIBLE_DRIVER. An explicit unavailable status from the device probe would let CTest keep the expected skip and surface unexpected enumeration, startup, or process failures.

No broader CTest suite run. AI-assisted (Codex). Synthetic inputs only.

@milas6669

Copy link
Copy Markdown

Checked head 9538218ee merged onto main 867d922f0, clean (4 files, +89/-7). Native Windows 11 26200, MSVC 19.44 RelWithDebInfo, one GPU (RTX 3070, NVIDIA 621.24), so the two-GPU case from the description cannot be shown here; what can is the "a filter that matches nothing fails" part.

  • ctest -R device_filter: 2/2 pass (vulkan_device_filter, vk_device_filter_tools; the second runs the new check_device_filter_tools.py, about 1 s).
  • By hand, vk_descriptor_bench with the PR: no filter runs on NVIDIA GeForce RTX 3070, exit 0; LEONIDA_VK_DEVICE=RTX 3070 the same; LEONIDA_VK_DEVICE=no such gpu xyz prints LEONIDA_VK_DEVICE=no such gpu xyz: no Vulkan physical device matches and exits 1.
  • Negative control, main's vk_descriptor_bench.cpp and vk_sandbox.cpp with the PR's test kept: the same bad filter still runs the benchmark on the RTX 3070 and exits 0 (the bug the description reports), and vk_device_filter_tools fails (after about 53 s, vs 1 s with the PR).

No defect. No game data. AI-assisted (Claude Code).

@Nevrche

Nevrche commented Nov 23, 2026

Copy link
Copy Markdown

Tested 9538218ee on Windows 10 Pro 22H2 (19045), MSVC 19.44.35230, VS 2022 generator, RelWithDebInfo, NVIDIA GTX 1050 Ti: pass.

  • vk_descriptor_bench --list-devices → [0] NVIDIA GeForce GTX 1050 Ti (discrete, vendor=0x10de, device=0x1c82, api=1.4.312).
  • vk_descriptor_bench --quick → exit 0, full scenario table (11 rows). Its header prints the selected GPU: device: NVIDIA GeForce GTX 1050 Ti (discrete, vendor=0x10de, device=0x1c82, subgroup=32, driver=NVIDIA (582.66)) — so the name now comes through in the tool's own output, and the driver string matches what Vulkan reports (32.0.15.8266 = 582.66).
  • With LEONIDA_VK_DEVICE=1050 set, the same device is selected and the run completes (this host has one GPU, so the multi-device selection itself is only covered to the extent that the variable is accepted and matched).
  • vk_sandbox builds and prints its usage line; it needs a scene and SPIR-V pair, so nothing beyond that was run.

AI-assisted.

…driver or device

The preflight took any nonzero vk_descriptor_bench --list-devices exit
as "no device" and skipped, so an unexpected failure of the tool was
reported as a skip. It now skips only for a missing loader, a
vkCreateInstance that gives VK_ERROR_INCOMPATIBLE_DRIVER, or an empty
device list, and fails for any other exit. Found by
matheusfermiano-source.
@adamraskin

Copy link
Copy Markdown
Contributor Author

@matheusfermiano-source thank you, that was a real gap. Fixed in 652e85a: the preflight now skips only for no Vulkan loader (could not load / has no vkGetInstanceProcAddr), no driver (vkCreateInstance -> -9, VK_ERROR_INCOMPATIBLE_DRIVER), or an empty device list. Any other --list-devices exit fails the test and prints the tool's output. Checked on this machine (RTX 5090 + gfx1036):

  • real tools: exit 0;
  • VK_DRIVER_FILES pointing at a nonexistent ICD: SKIP ... (no Vulkan driver (VK_ERROR_INCOMPATIBLE_DRIVER)), exit 77;
  • your case, a stand-in bench that prints an error and exits 23: FAIL: ... --list-devices exit 23, exit 1.

ctest -R "vk_device_filter_tools|vk_device_pick|vulkan_device_filter|vk_descriptor_bench_selftest": 4/4 passed.

-AI Assisted

@Zipettte

Copy link
Copy Markdown

Tested on AMD Radeon RX 7700 XT (RDNA3), AMD Windows driver 32.0.32029.2010, Windows 11, MSVC 14.51 Release, at 9538218. Full ctest -j 8, out of 240 tests:

No regression. The only failures are the same 5 as on main dde82f2 on this card (vk_queue_query_sync, d3d12_vulkan_device tiles == 1, d3d12_texture_tiles, d3d12_depth_resolve, d3d12_pipeline_library_host; tracked in #8426). Every test this PR adds or touches passes.

AI-assisted (Claude Code).

ItsNotRexed added a commit that referenced this pull request Nov 23, 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.

6 participants