upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_sandbox.cpp
diff options
context:
space:
mode:
authorAdam Raskin <43547309+adamraskin@users.noreply.github.com>2026-11-23 16:36:07 -0500
committerAdam Raskin <43547309+adamraskin@users.noreply.github.com>2026-11-23 16:36:07 -0500
commit9538218ee3b458df7a458c9e8a9071dfc1cb5377 (patch)
tree5d9a07012fd5d62677635a3708965c916ab13f66 /runtime/test/vk_sandbox.cpp
parent5d74c272363f2703265d44e6aaab1a1df8ddfaf3 (diff)
vk_descriptor_bench, vk_sandbox: LEONIDA_VK_DEVICE names the GPU (TEST-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.
Diffstat (limited to 'runtime/test/vk_sandbox.cpp')
-rw-r--r--runtime/test/vk_sandbox.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/test/vk_sandbox.cpp b/runtime/test/vk_sandbox.cpp
index b5de7bd13..ffd4309c0 100644
--- a/runtime/test/vk_sandbox.cpp
+++ b/runtime/test/vk_sandbox.cpp
@@ -277,13 +277,13 @@ int main(int argc, char** argv) {
277 if (!n) { std::fprintf(stderr, "unsupported: no Vulkan physical device\n"); return 77; } 277 if (!n) { std::fprintf(stderr, "unsupported: no Vulkan physical device\n"); return 77; }
278 std::vector<VkPhysicalDevice> pds(n); 278 std::vector<VkPhysicalDevice> pds(n);
279 CHECK(vkEnumeratePhysicalDevices(inst, &n, pds.data())); 279 CHECK(vkEnumeratePhysicalDevices(inst, &n, pds.data()));
280 VkPhysicalDevice pd = VK_NULL_HANDLE; 280 // The shared pick, so LEONIDA_VK_DEVICE names the GPU here too (vk_device_pick.h, docs/testing.md).
281 VkPhysicalDeviceProperties props{}; 281 std::vector<VkPhysicalDeviceProperties> candidates(n);
282 int best = -1; 282 for (uint32_t i = 0; i < n; ++i) vkGetPhysicalDeviceProperties(pds[i], &candidates[i]);
283 for (auto p : pds) { 283 const std::size_t chosen = leonida::vk_test::pick_device(candidates);
284 VkPhysicalDeviceProperties pp; vkGetPhysicalDeviceProperties(p, &pp); 284 if (chosen == candidates.size()) { leonida::vk_test::report_no_device(); return 1; }
285 if (int r = leonida::vk_test::device_rank(pp.deviceType, pp.vendorID); r > best) { pd = p; props = pp; best = r; } 285 VkPhysicalDevice pd = pds[chosen];
286 } 286 const VkPhysicalDeviceProperties props = candidates[chosen];
287 constexpr uint32_t push_words = 36, push_bytes = push_words * 4; 287 constexpr uint32_t push_words = 36, push_bytes = push_words * 4;
288 if (props.limits.maxPushConstantsSize < push_bytes) { std::fprintf(stderr, "unsupported: push constants\n"); return 77; } 288 if (props.limits.maxPushConstantsSize < push_bytes) { std::fprintf(stderr, "unsupported: push constants\n"); return 77; }
289 std::fprintf(stderr, "device: %s\n", props.deviceName); 289 std::fprintf(stderr, "device: %s\n", props.deviceName);