-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fixed cooperative matrix shaders on Vulkan builds when CROSS_COMPILE ON #2914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
04ab3d3
e6ab39f
62e5be8
eaa2808
3275375
3519d2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,22 @@ if(NOT GLSLC_EXECUTABLE) | |
| message(FATAL_ERROR "glslc not found.") | ||
| endif() | ||
|
|
||
| option(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT "Enable coopmat shaders" OFF) | ||
| option(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT "Enable coopmat2 shaders" OFF) | ||
|
|
||
| message(STATUS "GGML_VULKAN_COOPMAT_GLSLC_SUPPORT: ${GGML_VULKAN_COOPMAT_GLSLC_SUPPORT}") | ||
| message(STATUS "GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT: ${GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT}") | ||
|
|
||
| set(TARGET vulkan-shaders-gen) | ||
| add_executable(${TARGET} vulkan-shaders-gen.cpp) | ||
| if (GGML_VULKAN_COOPMAT_GLSLC_SUPPORT) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In ggml-org/llama.cpp#11695 (comment) I had guessed that we may need to pass through a cmake variable telling this makefile which version of glslc to use? Is that not necessary? It's just the #defines that weren't making it through?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure if we need additional version to be used (and in my case it was working as same version as the host system was used). I can confirm that only providing the compile definitions is working for my build => https://github.com/sandrohanea/whisper.net/actions/runs/13977409227/job/39134498314 |
||
| target_compile_definitions(vulkan-shaders-gen PRIVATE GGML_VULKAN_COOPMAT_GLSLC_SUPPORT) | ||
| endif() | ||
|
|
||
| if (GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT) | ||
| target_compile_definitions(vulkan-shaders-gen PRIVATE GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT) | ||
| endif() | ||
|
|
||
| install(TARGETS ${TARGET} RUNTIME) | ||
| target_compile_features(${TARGET} PRIVATE cxx_std_17) | ||
| target_link_libraries(vulkan-shaders-gen PUBLIC Threads::Threads) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this part. Why does cross compiling skip the checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this change, it was not skipping this check, but it was not forwarding it to the
vulkan-shaders-genas for CMAKE_CROSSCOMPILING it is starting it withExternalProject_Addso the compile definition added withadd_compile_definitions(GGML_VULKAN_COOPMAT_GLSLC_SUPPORT)was not forwarded to that external project (only added to the current project.For not CMAKE_CROSSCOMPILING it was added with

add_subdirectorywhich maintained the compile definitions:After my change, for
CMAKE_CROSSCOMPILING, we don't try to detect the version of the coopmap based on the current system but retrieving it from the options and pass it to the external project as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work if you remove this condition? i.e. detect whether it's supported and pass it to the external project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that should work:
vulkan-shaders-genexternal projecttarget_compile_definitionsThe reason why I didn't use this approach was that I was thinking that it is clearer to not check the build host for this version when CROSS_COMPILING as we're not building for this system => but indeed, if this system won't have that specific version, we won't be able to build anyway.
I'm happy to simplify it like that if you think it would be better :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to CI in Whisper.net after the change: https://github.com/sandrohanea/whisper.net/actions/runs/14087208133/job/39454313299