@@ -1645,6 +1645,7 @@ static void ggml_vk_load_shaders(vk_device& device) {
16451645#undef CREATE_MM2
16461646 } else
16471647#endif // defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
1648+ #if defined(VK_KHR_cooperative_matrix) && defined(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
16481649 if (device->coopmat_support ) {
16491650 // Create 6 variants, {s,m,l}x{unaligned,aligned}
16501651#define CREATE_MM (PIPELINE_NAME, NAMELC, F16ACC, WG_DENOMS, WARPTILE, PUSHCONST, PARAMCOUNT, ID ) \
@@ -1739,7 +1740,9 @@ static void ggml_vk_load_shaders(vk_device& device) {
17391740 }
17401741#undef CREATE_MM2
17411742#undef CREATE_MM
1742- } else if (device->fp16 ) {
1743+ } else
1744+ #endif // defined(VK_KHR_cooperative_matrix) && defined(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
1745+ if (device->fp16 ) {
17431746 // Create 6 variants, {s,m,l}x{unaligned,aligned}
17441747#define CREATE_MM (PIPELINE_NAME, NAMELC, F16ACC, WG_DENOMS, WARPTILE, PUSHCONST, PARAMCOUNT, ID ) \
17451748 if (device->mul_mat ## ID ## _l) \
@@ -2242,6 +2245,7 @@ static vk_device ggml_vk_get_device(size_t idx) {
22422245 last_struct = (VkBaseOutStructure *)&subgroup_size_control_features;
22432246 }
22442247
2248+ #if defined(VK_KHR_cooperative_matrix)
22452249 VkPhysicalDeviceCooperativeMatrixFeaturesKHR coopmat_features;
22462250 coopmat_features.pNext = nullptr ;
22472251 coopmat_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR;
@@ -2251,6 +2255,7 @@ static vk_device ggml_vk_get_device(size_t idx) {
22512255 last_struct->pNext = (VkBaseOutStructure *)&coopmat_features;
22522256 last_struct = (VkBaseOutStructure *)&coopmat_features;
22532257 }
2258+ #endif
22542259
22552260#if defined(VK_NV_cooperative_matrix2)
22562261 VkPhysicalDeviceCooperativeMatrix2FeaturesNV coopmat2_features {};
@@ -2283,7 +2288,9 @@ static vk_device ggml_vk_get_device(size_t idx) {
22832288 device_extensions.push_back (" VK_EXT_subgroup_size_control" );
22842289 }
22852290
2291+ #if defined(VK_KHR_cooperative_matrix)
22862292 device->coopmat_support = device->coopmat_support && coopmat_features.cooperativeMatrix ;
2293+ #endif
22872294
22882295 if (coopmat2_support) {
22892296#if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
@@ -2376,6 +2383,7 @@ static vk_device ggml_vk_get_device(size_t idx) {
23762383 device_extensions.push_back (" VK_KHR_shader_float16_int8" );
23772384 }
23782385
2386+ #if defined(VK_KHR_cooperative_matrix)
23792387 if (device->coopmat_support ) {
23802388 // Query supported shapes
23812389 std::vector<VkCooperativeMatrixPropertiesKHR> cm_props;
@@ -2442,7 +2450,7 @@ static vk_device ggml_vk_get_device(size_t idx) {
24422450 if (device->coopmat_support ) {
24432451 device_extensions.push_back (" VK_KHR_cooperative_matrix" );
24442452 }
2445-
2453+ # endif
24462454 device->name = GGML_VK_NAME + std::to_string (idx);
24472455
24482456 device_create_info = {
@@ -2553,9 +2561,11 @@ static void ggml_vk_print_gpu_info(size_t idx) {
25532561 fp16_storage = true ;
25542562 } else if (strcmp (" VK_KHR_shader_float16_int8" , properties.extensionName ) == 0 ) {
25552563 fp16_compute = true ;
2556- } else if (strcmp (" VK_KHR_cooperative_matrix" , properties.extensionName ) == 0 &&
2564+ #if defined(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
2565+ } else if (strcmp (" VK_KHR_cooperative_matrix" , properties.extensionName ) == 0 &&
25572566 !getenv (" GGML_VK_DISABLE_COOPMAT" )) {
25582567 coopmat_support = true ;
2568+ #endif
25592569#if defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
25602570 } else if (strcmp (" VK_NV_cooperative_matrix2" , properties.extensionName ) == 0 &&
25612571 !getenv (" GGML_VK_DISABLE_COOPMAT2" )) {
@@ -2593,6 +2603,7 @@ static void ggml_vk_print_gpu_info(size_t idx) {
25932603 // Pointer to the last chain element
25942604 VkBaseOutStructure * last_struct = (VkBaseOutStructure *)&vk12_features;
25952605
2606+ #if defined(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
25962607 VkPhysicalDeviceCooperativeMatrixFeaturesKHR coopmat_features;
25972608 coopmat_features.pNext = nullptr ;
25982609 coopmat_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR;
@@ -2608,6 +2619,7 @@ static void ggml_vk_print_gpu_info(size_t idx) {
26082619 fp16 = fp16 && vk12_features.shaderFloat16 ;
26092620
26102621 coopmat_support = coopmat_support && coopmat_features.cooperativeMatrix ;
2622+ #endif
26112623
26122624 std::string matrix_cores = coopmat2_support ? " NV_coopmat2" : coopmat_support ? " KHR_coopmat" : " none" ;
26132625
0 commit comments