@@ -3,6 +3,10 @@ cmake_policy(SET CMP0114 NEW)
33
44find_package (Vulkan COMPONENTS glslc REQUIRED)
55
6+ # Add options to disable cooperative matrix support
7+ option (GGML_VULKAN_DISABLE_COOPMAT "Disable VK_KHR_cooperative_matrix support" OFF )
8+ option (GGML_VULKAN_DISABLE_COOPMAT2 "Disable VK_NV_cooperative_matrix2 support" OFF )
9+
610function (detect_host_compiler)
711 if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" )
812 find_program (HOST_C_COMPILER NAMES cl gcc clang NO_CMAKE_FIND_ROOT_PATH )
@@ -52,17 +56,25 @@ if (Vulkan_FOUND)
5256 set (VULKAN_SHADER_GEN_CMAKE_ARGS "" )
5357
5458 # Test all shader extensions
55- test_shader_extension_support(
56- "GL_KHR_cooperative_matrix"
57- "${CMAKE_CURRENT_SOURCE_DIR} /vulkan-shaders/test_coopmat_support.comp"
58- "GGML_VULKAN_COOPMAT_GLSLC_SUPPORT"
59- )
59+ if (NOT GGML_VULKAN_DISABLE_COOPMAT)
60+ test_shader_extension_support(
61+ "GL_KHR_cooperative_matrix"
62+ "${CMAKE_CURRENT_SOURCE_DIR} /vulkan-shaders/test_coopmat_support.comp"
63+ "GGML_VULKAN_COOPMAT_GLSLC_SUPPORT"
64+ )
65+ else ()
66+ message (STATUS "VK_KHR_cooperative_matrix support disabled by GGML_VULKAN_DISABLE_COOPMAT" )
67+ endif ()
6068
61- test_shader_extension_support(
62- "GL_NV_cooperative_matrix2"
63- "${CMAKE_CURRENT_SOURCE_DIR} /vulkan-shaders/test_coopmat2_support.comp"
64- "GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT"
65- )
69+ if (NOT GGML_VULKAN_DISABLE_COOPMAT2)
70+ test_shader_extension_support(
71+ "GL_NV_cooperative_matrix2"
72+ "${CMAKE_CURRENT_SOURCE_DIR} /vulkan-shaders/test_coopmat2_support.comp"
73+ "GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT"
74+ )
75+ else ()
76+ message (STATUS "VK_NV_cooperative_matrix2 support disabled by GGML_VULKAN_DISABLE_COOPMAT2" )
77+ endif ()
6678
6779 test_shader_extension_support(
6880 "GL_EXT_integer_dot_product"
@@ -78,6 +90,7 @@ if (Vulkan_FOUND)
7890
7991 target_link_libraries (ggml-vulkan PRIVATE Vulkan::Vulkan)
8092 target_include_directories (ggml-vulkan PRIVATE ${CMAKE_CURRENT_BINARY_DIR} )
93+ target_include_directories (ggml-vulkan PRIVATE "${CMAKE_CURRENT_SOURCE_DIR} /vulkan_cpp_wrapper/include" )
8194
8295 # Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
8396 # Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
0 commit comments