ggml-vulkan: fall back to CPU when 16-bit storage is unavailable
Previously, missing storageBuffer16BitAccess threw
std::runtime_error("Unsupported device") which crashed the process on
platforms where C++ exceptions propagate as uncaught aborts (Android).
Some drivers also report the feature bit but don't enumerate
VK_KHR_16bit_storage as a device extension — pushing it into
device_extensions then causes vkCreateDevice to fail with
ErrorExtensionNotPresent (another fatal abort on Android).
Instead of throwing, set pipeline_failures so supports_op returns
false for all ops and the backend scheduler routes everything to CPU.
Only push VK_KHR_16bit_storage when the extension is actually
enumerated.
This commit is contained in:
parent
d28a49b837
commit
fb934bf4a0
|
|
@ -5253,12 +5253,18 @@ static vk_device ggml_vk_get_device(size_t idx) {
|
|||
#endif
|
||||
}
|
||||
|
||||
if (!vk11_features.storageBuffer16BitAccess) {
|
||||
std::cerr << "ggml_vulkan: device " << GGML_VK_NAME << idx << " does not support 16-bit storage." << std::endl;
|
||||
throw std::runtime_error("Unsupported device");
|
||||
if (!vk11_features.storageBuffer16BitAccess || !fp16_storage) {
|
||||
GGML_LOG_WARN("ggml_vulkan: device %s%zu does not support 16-bit storage "
|
||||
"(feature=%d, extension=%d), falling back to CPU\n",
|
||||
GGML_VK_NAME, idx,
|
||||
(int)vk11_features.storageBuffer16BitAccess,
|
||||
(int)fp16_storage);
|
||||
device->pipeline_failures.store(1, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
device_extensions.push_back("VK_KHR_16bit_storage");
|
||||
if (fp16_storage) {
|
||||
device_extensions.push_back("VK_KHR_16bit_storage");
|
||||
}
|
||||
|
||||
#ifdef GGML_VULKAN_VALIDATE
|
||||
device_extensions.push_back("VK_KHR_shader_non_semantic_info");
|
||||
|
|
|
|||
Loading…
Reference in New Issue