Skip to content

Commit 0499b29

Browse files
authored
vulkan: throw system error instead of SIGABRT during init on older devices (#16156)
* Throw system error on old Vulkan driver rather than SIGABRT * Optionally handle any potential error in vulkan init
1 parent 234e2ff commit 0499b29

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4521,7 +4521,7 @@ static void ggml_vk_instance_init() {
45214521

45224522
if (api_version < VK_API_VERSION_1_2) {
45234523
std::cerr << "ggml_vulkan: Error: Vulkan 1.2 required." << std::endl;
4524-
GGML_ABORT("fatal error");
4524+
throw vk::SystemError(vk::Result::eErrorFeatureNotPresent, "Vulkan 1.2 required");
45254525
}
45264526

45274527
vk::ApplicationInfo app_info{ "ggml-vulkan", 1, nullptr, 0, api_version };
@@ -12909,6 +12909,12 @@ ggml_backend_reg_t ggml_backend_vk_reg() {
1290912909
} catch (const vk::SystemError& e) {
1291012910
VK_LOG_DEBUG("ggml_backend_vk_reg() -> Error: System error: " << e.what());
1291112911
return nullptr;
12912+
} catch (const std::exception &e) {
12913+
VK_LOG_DEBUG("ggml_backend_vk_reg() -> Error: " << e.what());
12914+
return nullptr;
12915+
} catch (...) {
12916+
VK_LOG_DEBUG("ggml_backend_vk_reg() -> Error: unknown exception during Vulkan init");
12917+
return nullptr;
1291212918
}
1291312919
}
1291412920

0 commit comments

Comments
 (0)