Commit 3259ab6e5 for llama.cpp
commit 3259ab6e5dd86fad1931962d784702cb53c7877b
Author: Alex-JP-93 <Jianpeng.Li@amd.com>
Date: Thu Nov 5 14:40:39 2026 +0800
vulkan: Re-enable large coopmat matmul configuration on AMD proprietary driver 26.10.1+ (#31587)
diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
index 89f0470cb..3a010dbd5 100644
--- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp
+++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
@@ -1678,6 +1678,17 @@ static bool ggml_vk_fa_scalar_uses_mmq(const vk_device& device, ggml_type k_type
#endif
}
+// AMD proprietary drivers before 2.0.416 (Adrenalin 26.10.1) run the large coopmat matmul tile much slower than the medium one.
+static bool ggml_vk_amd_large_tile_supported(const vk_device& device) {
+ if (device->driver_id != vk::DriverId::eAmdProprietary) {
+ return true;
+ }
+ // AMD encodes driverVersion as major [31:22], build [21:0], not VK_MAKE_API_VERSION.
+ const uint32_t major = device->properties.driverVersion >> 22;
+ const uint32_t build = device->properties.driverVersion & 0x3fffff;
+ return major > 2 || (major == 2 && build >= 416);
+}
+
void ggml_vk_load_shaders(vk_device& device, vk_pipeline requested) {
VK_LOG_DEBUG("ggml_vk_load_shaders(" << device->name << ")");
@@ -1850,7 +1861,7 @@ void ggml_vk_load_shaders(vk_device& device, vk_pipeline requested) {
if ((device->architecture == AMD_GCN) && (device->driver_id != vk::DriverId::eAmdProprietary)) {
m_warptile_mmq = m_warptile_mmq_int = { 256, 64, 64, 32, 16, 16, 2, 2, 2, 1, 16 };
m_warptile_mmqid = m_warptile_mmqid_int = { 256, 64, 64, 32, 16, 16, 2, 2, 2, 1, 16 };
- } else if (device->vendor_id == VK_VENDOR_ID_AMD && device->coopmat_support && device->driver_id != vk::DriverId::eAmdProprietary) {
+ } else if (device->vendor_id == VK_VENDOR_ID_AMD && device->coopmat_support && ggml_vk_amd_large_tile_supported(device)) {
// This is intentionally using tx_m values, slight performance increase
l_warptile = { 256, 128, 128, 16, mm_warp_8, 64, 2, tm_m, tn_m, tk_m, mm_warp_8 };
l_warptile_mmq = l_warptile_mmq_int = { 256, 128, 128, 32, mm_warp_8, 64, 2, tm_m, tn_m, tk_m, mm_warp_8 };
@@ -4816,7 +4827,7 @@ vk_device ggml_vk_get_device(size_t idx) {
switch (device->vendor_id) {
#ifndef GGML_VULKAN_RUN_TESTS
case VK_VENDOR_ID_AMD:
- device->mul_mat_l[i] = device->coopmat_support && device->driver_id != vk::DriverId::eAmdProprietary;
+ device->mul_mat_l[i] = device->coopmat_support && ggml_vk_amd_large_tile_supported(device);
device->mul_mat_m[i] = true;
device->mul_mat_s[i] = true;
device->mul_mat_id_l[i] = false;