Skip to content

Commit 8c76cc2

Browse files
committed
vulkan: fix coopmat shader generation when cross-compiling
Previously the status of coopmat{,2} support isn't passed to the vulkan-shaders-gen project building on the host, which leads to build failure because of the cross-compiling code expecting coopmat{,2} shaders that didn't get generated. Fix this by passing the coopmat{,2} support status to vulkan-shaders subproject. Signed-off-by: Icenowy Zheng <[email protected]>
1 parent 7ab3643 commit 8c76cc2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ggml/src/ggml-vulkan/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ if (Vulkan_FOUND)
3535
else()
3636
message(STATUS "GL_KHR_cooperative_matrix supported by glslc")
3737
add_compile_definitions(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
38+
set(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT ON)
3839
endif()
3940

4041
# Compile a test shader to determine whether GL_NV_cooperative_matrix2 is supported.
@@ -49,6 +50,7 @@ if (Vulkan_FOUND)
4950
else()
5051
message(STATUS "GL_NV_cooperative_matrix2 supported by glslc")
5152
add_compile_definitions(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
53+
set(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT ON)
5254
endif()
5355

5456
target_link_libraries(ggml-vulkan PRIVATE Vulkan::Vulkan)
@@ -119,6 +121,8 @@ if (Vulkan_FOUND)
119121
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders
120122
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${HOST_CMAKE_TOOLCHAIN_FILE}
121123
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
124+
-DGGML_VULKAN_COOPMAT_GLSLC_SUPPORT=${GGML_VULKAN_COOPMAT_GLSLC_SUPPORT}
125+
-DGGML_VULKAN_COOPMAT2_GLSLC_SUPPORT=${GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT}
122126
BUILD_COMMAND ${CMAKE_COMMAND} --build .
123127
INSTALL_COMMAND ${CMAKE_COMMAND} --install .
124128
INSTALL_DIR ${CMAKE_BINARY_DIR}

ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ if(NOT GLSLC_EXECUTABLE)
44
message(FATAL_ERROR "glslc not found.")
55
endif()
66

7+
if (GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
8+
add_compile_definitions(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)
9+
endif()
10+
if (GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
11+
add_compile_definitions(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
12+
endif()
713
set(TARGET vulkan-shaders-gen)
814
add_executable(${TARGET} vulkan-shaders-gen.cpp)
915
install(TARGETS ${TARGET} RUNTIME)

0 commit comments

Comments
 (0)