Commit cdce056a3 for llama.cpp
commit cdce056a3e8811e5f7b2ee56ae24d8fb1c32df32
Author: Masato Nakasaka <masato.nakasaka@intel.com>
Date: Wed Oct 14 14:45:38 2026 +0900
vulkan: Add workaround for device free memory > total memory on Intel Windows (#29835)
* add workaround for Intel Windows driver issue
* applying safeguard to all GPUs
also a minor refactor
* partial revert
diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
index f996674f4..1496dd47a 100644
--- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp
+++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
@@ -15265,7 +15265,10 @@ void ggml_backend_vk_get_device_memory(int device, size_t * free, size_t * total
*total += heap.size;
if (membudget_supported && i < budgetprops.heapUsage.size()) {
- *free += budgetprops.heapBudget[i] - budgetprops.heapUsage[i];
+ // Driver may report heapBudget > heap.size so we add a safeguard here
+ // See https://github.com/ggml-org/llama.cpp/issues/29277
+ const vk::DeviceSize budget = std::min(budgetprops.heapBudget[i], heap.size);
+ *free += budget > budgetprops.heapUsage[i] ? budget - budgetprops.heapUsage[i] : 0;
} else {
*free += heap.size;
}