From: Ruben Ortlam Date: Tue, 9 Sep 2025 20:26:03 +0000 (+0200) Subject: vulkan: throw the oom error instead of no memory type found (#15905) X-Git-Tag: upstream/0.0.6527~95 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=ae355f6f7108540297d8b7f7ae71d20fe610a0b7;p=pkg%2Fggml%2Fsources%2Fllama.cpp vulkan: throw the oom error instead of no memory type found (#15905) --- diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp index c0c2239c..cb379fe9 100644 --- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp +++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp @@ -1937,7 +1937,9 @@ static vk_buffer ggml_vk_create_buffer(vk_device& device, size_t size, const std vk::PhysicalDeviceMemoryProperties mem_props = device->physical_device.getMemoryProperties(); - for (auto &req_flags : req_flags_list) { + for (auto it = req_flags_list.begin(); it != req_flags_list.end(); it++) { + const auto & req_flags = *it; + uint32_t memory_type_index = find_properties(&mem_props, &mem_req, req_flags); if (memory_type_index == UINT32_MAX) { @@ -1950,6 +1952,11 @@ static vk_buffer ggml_vk_create_buffer(vk_device& device, size_t size, const std break; } catch (const vk::SystemError& e) { // loop and retry + // during last attempt throw the exception + if (it + 1 == req_flags_list.end()) { + device->device.destroyBuffer(buf->buffer); + throw e; + } } }