-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
Compile bug: How to compile llama.cpp with Vulkan for android device #11695
Comments
the same issue on my end, building against |
Please attach the full log for a clean build. This looks like another "weird combination of tooling installed" issue. |
@jeffbolznv please take a look.
b4651
|
Hi, here are all the logs from when I try to compile the Vulkan and llama.cpp for Android. ~/test/llama.cpp-b4644$ cmake -- Configuring done ~/test/llama.cpp-b4644$ cmake --build build-android --config Release -j8
near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first -- The C compiler identification is GNU 11.4.0
should be added at the top of the file. The version specified may be lower -- Configuring done |
OK, so cmake detects coopmat2 support, but those shader are either not being generated at all, or the generation is silently crashing (seems less likely). Please check whether |
Hi, GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT was not defined when compiling vulkan-shaders-gen.cpp. However, when I add |
That's surprising. Was it a clean build? I don't fully trust the dependencies (they're manually hacked together in
Either that (or in addition to that!) the cross-compile might be picking up a different glslc that does not support coopmat2 (seems very possible if the ndk hasn't updated). Is it possible to check what version of glslc is in the NDK and also try using it to compile |
I updated the nkd to the latest version
hardcoding
|
Hi, which version of llama.cpp did you compile, when I use this way and the latest NDK, the problem still exists. |
Hi, I use clean build every time. When downgrading vulkan from 1.4 to 1.3. The compilation log is as follows: -- Configuring done
near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first CMake Warning (dev) in CMakeLists.txt:
should be added at the top of the file. The version specified may be lower -- Configuring done /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f32_f16_cm2.spv -DACC_TYPE=float -DB_TYPE=float16_t -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_f32_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f32_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_TYPE=float16_t -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f16_cm2.spv -DACC_TYPE=float -DB_TYPE=float16_t -DDATA_A_F16=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q4_1_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_1_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q4_1=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q4_0_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_0_f16_cm2.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q4_1_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_1_f16_cm2.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q4_1=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_TYPE=float16_t -DDATA_A_F16=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q5_0_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q5_0_f16_cm2.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q5_0=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q5_1_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q5_1_f16_cm2.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q5_1=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q4_0_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_0_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q5_0_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q5_0_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q5_0=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q5_1_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q5_1_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q5_1=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q8_0_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q8_0_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q8_0=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q8_0_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q8_0_f16_cm2.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q8_0=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q2_k_f16_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q2_k_f16_cm2.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q2_K=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 cannot compile matmul_q2_k_f16_aligned_cm2 /home/ubuntu/VulkanSDK/1.3.261.1/x86_64/bin/glslc -fshader-stage=compute --target-env=vulkan1.3 -O /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp -o /home/ubuntu/test/llama.cpp-b4644/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q2_k_f16_aligned_cm2.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q2_K=1 -DD_TYPE=float -DFLOAT16=1 -DFLOAT_TYPE=float16_t -DLOAD_VEC_A=1 -DLOAD_VEC_B=1 /home/ubuntu/test/llama.cpp-b4644/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp:13: warning: '#extension' : extension not supported: GL_NV_cooperative_matrix2 [ 15%] Linking CXX shared library ../../bin/libggml-cpu.so And the compilation process will be blocked at [ 15%] Built target ggml-cpu. |
OK, sounds like the ndk glslc is very old (GL_KHR_cooperative_matrix was release in June 2023). And the issue seems to be related to vulkan-shaders/CMakeLists.txt picking up a different glslc than ggml-vulkan/CMakeLists.txt.
This is surprising. If this glslc doesn't support KHR_coopmat, I'd expect those compiles to fail. Does this somehow affect the logic in ggml-vulkan/CMakeLists.txt? I'm not an expert on cmake. But it seems like there are two |
This downgrade picked up a different glslc that doesn't support coopmat2 and this avoids the problem. We need the two CMakeLists.txt files to agree on which build of glslc is being used. (Or, we need to stop relying on whatever random stuff is installed and fetch and build shaderc directly. This just keeps coming up). |
I spent some time debugging the issue
added a debug message to check what gets resolved
here is the result:
so cmake properly detects path to headers and the library, but fails to lookup the right as a potential workaround, we can have a patched copy of @jeffbolznv I can put together a quick PR, please lmk if the proposed approach makes sense |
Having a copy of a core cmake module seems hacky and potentially has licensing issues. I can think of a couple options for dealing with this: Option (1) seems much easier, so that's what I think we should try. |
When I hardcode /home/ubuntu/android-ndk-r28/shader-tools/linux-x86_64/glslc in ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt and add -DVulkan_GLSLC_EXECUTABLE=/home/ubuntu/android-ndk-r28/shader-tools/linux-x86_64/glslc in cmake command, compilation succeeds. New cmake command is When I try to run LD_LIBRARY_PATH=/data/local/tmp/mobile-vulkan/lib ./bin/llama-bench -m ../model/Llama-3.2-1B-Instruct-Q4_K_M.gguf on Android device, the result shows "CANNOT LINK EXECUTABLE "./bin/llama-bench": library "libomp.so" not found: needed by /data/local/tmp/mobile-vulkan/lib/libggml-cpu.so in namespace (default)". After moving libomp.so from ${NDK}/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/19/lib/linux/aarch64/libomp.so to {install-dir}/lib, running "LD_LIBRARY_PATH=/data/local/tmp/mobile-vulkan/lib ./bin/llama-bench -m ../model/Llama-3.2-1B-Instruct-Q8_0.gguf", got: Run "LD_LIBRARY_PATH=/data/local/tmp/mobile-vulkan/lib ./bin/llama-bench -m ../model/Llama-3.2-1B-Instruct-Q4_K_M.gguf", got: Is there any way to solve this problem, or is there another compilation method required to solve this runtime error?
|
Please check if this branch fixes the glslc mismatch: https://github.com/jeffbolznv/llama.cpp/tree/glslc_mismatch.
Given how old it is, I kind of think it's a bad idea to force it to use the glslc from the ndk. |
This is so weird. If I remove -DVulkan_GLSLC_EXECUTABLE=, the compilation information is as follows: /llama.cpp$ cmake --build build-android --config Release -j8
near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first [ 8%] Built target sha256
should be added at the top of the file. The version specified may be lower -- Configuring done Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f32_f16_fp32.spv -DACC_TYPE=float -DB_TYPE=float16_t -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT_TYPE=float sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_f32_f32_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f32_f32_fp32.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=1 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile cannot compile matmul_f32_f16_aligned_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f32_f16_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_TYPE=f16vec4 -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=4 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_f16_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f16_fp32.spv -DACC_TYPE=float -DB_TYPE=float16_t -DDATA_A_F16=1 -DD_TYPE=float -DFLOAT_TYPE=float sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_f32_f32_aligned_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f32_f32_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=vec4 -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=4 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found matmul_f16_aligned_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f16_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_TYPE=f16vec4 -DDATA_A_F16=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=4 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_f16_f32_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f16_f32_fp32.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float -DDATA_A_F16=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=1 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found [ 12%] Building CXX object ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/ggml-cpu-hbm.cpp.o Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_f16_f32_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=vec4 -DDATA_A_F16=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=4 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_q4_0_f32_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_0_f32_fp32.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found [ 14%] Building CXX object ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/amx/amx.cpp.o Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_1_f32_fp32.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float -DDATA_A_Q4_1=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 cannot compile cannot compile matmul_q4_0_f16_aligned_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_0_f16_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=f16vec4 -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_0_f16_fp32.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_1_f32_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=vec4 -DDATA_A_Q4_1=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_0_f32_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=vec4 -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_q4_1_f16_aligned_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_1_f16_aligned_fp32.spv -DACC_TYPE=float -DALIGNED=1 -DB_IS_FLOAT=1 -DB_TYPE=f16vec4 -DDATA_A_Q4_1=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 -DLOAD_VEC_B=4 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found cannot compile matmul_q4_1_f16_fp32 Vulkan_GLSLC_EXECUTABLE-NOTFOUND -fshader-stage=compute --target-env=vulkan1.2 -O /home/ubuntu/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp -o /home/ubuntu/llama.cpp/build-android/ggml/src/ggml-vulkan/vulkan-shaders.spv/matmul_q4_1_f16_fp32.spv -DACC_TYPE=float -DB_IS_FLOAT=1 -DB_TYPE=float16_t -DDATA_A_Q4_1=1 -DD_TYPE=float -DFLOAT_TYPE=float -DLOAD_VEC_A=2 sh: 1: Vulkan_GLSLC_EXECUTABLE-NOTFOUND: not found [ 15%] Building CXX object ggml/src/CMakeFiles/ggml-cpu.dir/ggml-cpu/amx/mmq.cpp.o and the compile will pause at "[ 15%] Built target ggml-cpu". |
would it make sense to simply skip |
I don't understand why it wouldn't have picked up your the one from your Vulkan SDK. Was this a clean build (with no cmake caching)?
I'm not sure if that line was even doing anything. It was setting |
|
I checked ggml/src/ggml-vulkan/CMakeLists.txt and cmake did successfully find all Vulkan setting in the Android NDK except Vulkan_GLSLC_EXECUTABLE. ~/llama.cpp$ rm -rf build-android/ -- Found Vulkan: /home/ubuntu/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/34/libvulkan.so |
Hey everyone sorry for the delay jumping into this conversation. I wanted to let everyone know that there's a separate way to override the toolchain file using I am wondering if modifying this, or supplying a custom toolchain which adds the proper NDK path works? The lines here force the search paths, which may be causing an issue: From host-toolchain.cmake.in:
This is typically desired for a "standard" cross-compile where the system-supplied glslc is used, but in Android's case with multiple NDKs and so forth, there will be different paths to consider and so we probably need to supply two toolchains. If this is a common problem we could consider storing a general toolchain to supply for Android vulkan-shaders-gen builds. |
@liuxiaotiao @barzoj We just merged in #12272 to fix cross-compiling with coopmat support—if you have some time to check whether it fixes this issue it would be greatly appreciated! Thanks. |
@bandoti Using the following cmake command, vulkan cross compilation is successful without any further modifications to any cmake files. |
Great! Thanks for checking. I will close the issue as completed. |
Git commit
902368a
Operating systems
Linux
GGML backends
Vulkan
Problem description & steps to reproduce
I tried to compile llama.cpp(b4644) using NDK 27 and Vulkan-header(v1.4.307) and encountered the following compilation issues.
First Bad Commit
No response
Compile command
Relevant log output
The text was updated successfully, but these errors were encountered: