@@ -3,6 +3,10 @@ cmake_policy(SET CMP0114 NEW)
3
3
4
4
find_package (Vulkan COMPONENTS glslc REQUIRED)
5
5
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
+
6
10
function (detect_host_compiler)
7
11
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" )
8
12
find_program (HOST_C_COMPILER NAMES cl gcc clang NO_CMAKE_FIND_ROOT_PATH )
@@ -52,17 +56,25 @@ if (Vulkan_FOUND)
52
56
set (VULKAN_SHADER_GEN_CMAKE_ARGS "" )
53
57
54
58
# 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 ()
60
68
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 ()
66
78
67
79
test_shader_extension_support(
68
80
"GL_EXT_integer_dot_product"
@@ -78,6 +90,7 @@ if (Vulkan_FOUND)
78
90
79
91
target_link_libraries (ggml-vulkan PRIVATE Vulkan::Vulkan)
80
92
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" )
81
94
82
95
# Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
83
96
# Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
0 commit comments