@@ -1513,7 +1513,7 @@ static void ggml_vk_load_shaders(vk_device& device) {
15131513 compiles.push_back (std::async (ggml_vk_create_pipeline_func, std::ref (device), std::ref (pipeline), name, spv_size, spv_data, entrypoint, parameter_count, push_constant_size, wg_denoms, specialization_constants, align, disable_robustness));
15141514 };
15151515
1516- #if defined(VK_NV_cooperative_matrix2)
1516+ #if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
15171517 if (device->coopmat2 ) {
15181518
15191519 auto const &fa_wg_denoms = [&](uint32_t D, uint32_t clamp, ggml_type type, bool small_rows) -> std::array<uint32_t , 3 > {
@@ -1611,7 +1611,7 @@ static void ggml_vk_load_shaders(vk_device& device) {
16111611#undef CREATE_MM
16121612#undef CREATE_MM2
16131613 } else
1614- #endif // defined(VK_NV_cooperative_matrix2)
1614+ #endif // defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
16151615 if (device->coopmat_support ) {
16161616 // Create 6 variants, {s,m,l}x{unaligned,aligned}
16171617#define CREATE_MM (PIPELINE_NAME, NAMELC, F16ACC, WG_DENOMS, WARPTILE, PUSHCONST, PARAMCOUNT, ID ) \
@@ -2153,7 +2153,7 @@ static vk_device ggml_vk_get_device(size_t idx) {
21532153 device->coopmat_support = device->coopmat_support && coopmat_features.cooperativeMatrix ;
21542154
21552155 if (coopmat2_support) {
2156- #if defined(VK_NV_cooperative_matrix2)
2156+ #if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
21572157 if (coopmat2_features.cooperativeMatrixWorkgroupScope &&
21582158 coopmat2_features.cooperativeMatrixFlexibleDimensions &&
21592159 coopmat2_features.cooperativeMatrixReductions &&
@@ -2414,14 +2414,19 @@ static void ggml_vk_print_gpu_info(size_t idx) {
24142414 bool fp16_storage = false ;
24152415 bool fp16_compute = false ;
24162416 bool coopmat_support = false ;
2417+ bool coopmat2_support = false ;
24172418
24182419 for (auto properties : ext_props) {
24192420 if (strcmp (" VK_KHR_16bit_storage" , properties.extensionName ) == 0 ) {
24202421 fp16_storage = true ;
24212422 } else if (strcmp (" VK_KHR_shader_float16_int8" , properties.extensionName ) == 0 ) {
24222423 fp16_compute = true ;
2423- } else if (strcmp (" VK_KHR_cooperative_matrix" , properties.extensionName ) == 0 ) {
2424+ } else if (strcmp (" VK_KHR_cooperative_matrix" , properties.extensionName ) == 0 &&
2425+ !getenv (" GGML_VK_DISABLE_COOPMAT" )) {
24242426 coopmat_support = true ;
2427+ } else if (strcmp (" VK_NV_cooperative_matrix2" , properties.extensionName ) == 0 &&
2428+ !getenv (" GGML_VK_DISABLE_COOPMAT2" )) {
2429+ coopmat2_support = true ;
24252430 }
24262431 }
24272432
@@ -2472,9 +2477,11 @@ static void ggml_vk_print_gpu_info(size_t idx) {
24722477
24732478 coopmat_support = coopmat_support && coopmat_features.cooperativeMatrix ;
24742479
2480+ std::string matrix_cores = coopmat2_support ? " NV_coopmat2" : coopmat_support ? " KHR_coopmat" : " none" ;
2481+
24752482 std::string device_name = props2.properties .deviceName .data ();
2476- GGML_LOG_DEBUG (" ggml_vulkan: %zu = %s (%s) | uma: %d | fp16: %d | warp size: %zu | matrix cores: %d \n " ,
2477- idx, device_name.c_str (), driver_props.driverName .data (), uma, fp16, subgroup_size, coopmat_support );
2483+ GGML_LOG_DEBUG (" ggml_vulkan: %zu = %s (%s) | uma: %d | fp16: %d | warp size: %zu | matrix cores: %s \n " ,
2484+ idx, device_name.c_str (), driver_props.driverName .data (), uma, fp16, subgroup_size, matrix_cores. c_str () );
24782485
24792486 if (props2.properties .deviceType == vk::PhysicalDeviceType::eCpu) {
24802487 GGML_LOG_DEBUG (" ggml_vulkan: Warning: Device type is CPU. This is probably not the device you want.\n " );
0 commit comments