Skip to content

Commit 03e3fb1

Browse files
committed
vulkan: Make Vulkan optional at runtime (#11493).
1 parent 66ee4f2 commit 03e3fb1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7433,9 +7433,13 @@ static void ggml_vk_cleanup(ggml_backend_vk_context * ctx) {
74337433
}
74347434

74357435
static int ggml_vk_get_device_count() {
7436-
ggml_vk_instance_init();
7437-
7438-
return vk_instance.device_indices.size();
7436+
try {
7437+
ggml_vk_instance_init();
7438+
return vk_instance.device_indices.size();
7439+
} catch (const vk::SystemError& e) {
7440+
std::cerr << "ggml_vulkan: Error: System error " << e.what() << std::endl;
7441+
return 0;
7442+
}
74397443
}
74407444

74417445
static void ggml_vk_get_device_description(int device, char * description, size_t description_size) {

0 commit comments

Comments
 (0)