Skip to content

Commit 8a7549f

Browse files
committed
remove unsupported vulkan devices
1 parent aa0c461 commit 8a7549f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4621,6 +4621,29 @@ static void ggml_vk_instance_init() {
46214621
}
46224622
}
46234623

4624+
// Remove any unsupported devices
4625+
size_t num_unsupported = 0;
4626+
for (size_t i = 0; i < vk_instance.device_indices.size();) {
4627+
vk::PhysicalDevice vkdev = devices[vk_instance.device_indices[i]];
4628+
4629+
VkPhysicalDeviceFeatures2 device_features2;
4630+
device_features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
4631+
4632+
VkPhysicalDeviceVulkan11Features vk11_features;
4633+
vk11_features.pNext = nullptr;
4634+
vk11_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
4635+
device_features2.pNext = &vk11_features;
4636+
4637+
vkGetPhysicalDeviceFeatures2(vkdev, &device_features2);
4638+
if (!vk11_features.storageBuffer16BitAccess) {
4639+
vk_instance.device_indices.erase(vk_instance.device_indices.begin() + i);
4640+
num_unsupported++;
4641+
} else
4642+
i++;
4643+
}
4644+
if (num_unsupported > 0)
4645+
GGML_LOG_DEBUG("ggml_vulkan: Removed %zu unsupported Vulkan devices.\n", vk_instance.device_indices.size());
4646+
46244647
if (vk_instance.device_indices.empty()) {
46254648
GGML_LOG_INFO("ggml_vulkan: No devices found.\n");
46264649
return;

0 commit comments

Comments
 (0)