From bcf2a4488c3197cc8f695a05ba6edd2804204afc Mon Sep 17 00:00:00 2001 From: 0cc4m Date: Mon, 22 Jan 2024 21:57:17 +0100 Subject: [PATCH] Use min of maxMemoryAllocationSize and maxBufferSize for device max allocation size --- ggml-vulkan.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ggml-vulkan.cpp b/ggml-vulkan.cpp index 722bbe37ab715..56381cb7742f6 100644 --- a/ggml-vulkan.cpp +++ b/ggml-vulkan.cpp @@ -975,11 +975,13 @@ std::cerr << "ggml_vulkan: Validation layers enabled" << std::endl; vk_device.physical_device = vk_instance.enumeratePhysicalDevices()[dev_num]; vk::PhysicalDeviceProperties2 props2; vk::PhysicalDeviceMaintenance3Properties props3; - props3.pNext = nullptr; + vk::PhysicalDeviceMaintenance4Properties props4; props2.pNext = &props3; + props3.pNext = &props4; + props4.pNext = nullptr; vk_device.physical_device.getProperties2(&props2); vk_device.properties = props2.properties; - vk_device.max_memory_allocation_size = props3.maxMemoryAllocationSize; + vk_device.max_memory_allocation_size = std::min(props3.maxMemoryAllocationSize, props4.maxBufferSize); std::cerr << "ggml_vulkan: Using " << vk_device.properties.deviceName << std::endl;