Skip to content

Commit 6f3bd38

Browse files
authored
cmake: remove caching from vulkan coopmat checks (#12719)
1 parent be0a0f8 commit 6f3bd38

File tree

1 file changed

+24
-38
lines changed

1 file changed

+24
-38
lines changed

ggml/src/ggml-vulkan/CMakeLists.txt

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,35 @@ if (Vulkan_FOUND)
2323
../../include/ggml-vulkan.h
2424
)
2525

26-
if(NOT DEFINED GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
27-
# Compile a test shader to determine whether GL_KHR_cooperative_matrix is supported.
28-
# If it's not, there will be an error to stderr.
29-
# If it's supported, set a define to indicate that we should compile those shaders
30-
execute_process(COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o - -fshader-stage=compute --target-env=vulkan1.3 "${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat_support.comp"
31-
OUTPUT_VARIABLE glslc_output
32-
ERROR_VARIABLE glslc_error)
33-
34-
if (${glslc_error} MATCHES ".*extension not supported: GL_KHR_cooperative_matrix.*")
35-
message(STATUS "GL_KHR_cooperative_matrix not supported by glslc")
36-
set(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT OFF CACHE INTERNAL "Whether coopmat is supported by glslc")
37-
else()
38-
message(STATUS "GL_KHR_cooperative_matrix supported by glslc")
39-
set(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT ON CACHE INTERNAL "Whether coopmat is supported by glslc")
40-
endif()
41-
else()
42-
message(STATUS "GL_KHR_cooperative_matrix support already defined: ${GGML_VULKAN_COOPMAT_GLSLC_SUPPORT}")
43-
endif()
26+
# Compile a test shader to determine whether GL_KHR_cooperative_matrix is supported.
27+
# If it's not, there will be an error to stderr.
28+
# If it's supported, set a define to indicate that we should compile those shaders
29+
execute_process(COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o - -fshader-stage=compute --target-env=vulkan1.3 "${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat_support.comp"
30+
OUTPUT_VARIABLE glslc_output
31+
ERROR_VARIABLE glslc_error)
4432

45-
if(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
33+
if (${glslc_error} MATCHES ".*extension not supported: GL_KHR_cooperative_matrix.*")
34+
message(STATUS "GL_KHR_cooperative_matrix not supported by glslc")
35+
set(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT OFF)
36+
else()
37+
message(STATUS "GL_KHR_cooperative_matrix supported by glslc")
38+
set(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT ON)
4639
add_compile_definitions(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
4740
endif()
4841

49-
if(NOT DEFINED GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
50-
# Compile a test shader to determine whether GL_NV_cooperative_matrix2 is supported.
51-
# If it's not, there will be an error to stderr.
52-
# If it's supported, set a define to indicate that we should compile those shaders
53-
execute_process(COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o - -fshader-stage=compute --target-env=vulkan1.3 "${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat2_support.comp"
54-
OUTPUT_VARIABLE glslc_output
55-
ERROR_VARIABLE glslc_error)
56-
57-
if (${glslc_error} MATCHES ".*extension not supported: GL_NV_cooperative_matrix2.*")
58-
message(STATUS "GL_NV_cooperative_matrix2 not supported by glslc")
59-
set(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT OFF CACHE INTERNAL "Whether coopmat2 is supported by glslc")
60-
else()
61-
message(STATUS "GL_NV_cooperative_matrix2 supported by glslc")
62-
set(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT ON CACHE INTERNAL "Whether coopmat2 is supported by glslc")
63-
endif()
64-
else()
65-
message(STATUS "GL_NV_cooperative_matrix2 support already defined: ${GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT}")
66-
endif()
42+
# Compile a test shader to determine whether GL_NV_cooperative_matrix2 is supported.
43+
# If it's not, there will be an error to stderr.
44+
# If it's supported, set a define to indicate that we should compile those shaders
45+
execute_process(COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o - -fshader-stage=compute --target-env=vulkan1.3 "${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat2_support.comp"
46+
OUTPUT_VARIABLE glslc_output
47+
ERROR_VARIABLE glslc_error)
6748

68-
if(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
49+
if (${glslc_error} MATCHES ".*extension not supported: GL_NV_cooperative_matrix2.*")
50+
message(STATUS "GL_NV_cooperative_matrix2 not supported by glslc")
51+
set(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT OFF)
52+
else()
53+
message(STATUS "GL_NV_cooperative_matrix2 supported by glslc")
54+
set(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT ON)
6955
add_compile_definitions(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
7056
endif()
7157

0 commit comments

Comments
 (0)