Fix Vulkan crash on APUs with very little device memory

This commit is contained in:
0cc4m 2024-02-08 22:20:42 +01:00
parent 8e6a9d2de0
commit 858187f1a5

View file

@ -744,6 +744,8 @@ static vk_buffer ggml_vk_create_buffer(ggml_backend_vk_context * ctx, size_t siz
} }
if (memory_type_index >= mem_props.memoryTypeCount) { if (memory_type_index >= mem_props.memoryTypeCount) {
ctx->device.lock()->device.destroyBuffer(buf->buffer);
buf->size = 0;
throw vk::OutOfDeviceMemoryError("No suitable memory type found"); throw vk::OutOfDeviceMemoryError("No suitable memory type found");
} }