llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Bug: Vulkan build no longer working with MSVC cmake on windows

Open stduhpf opened this issue 1 year ago • 1 comments

What happened?

When trying to build the lastest version of the Vulkan backend, the shader compilation fails.

I suspect commit 17eb6aa8a992cda37ee65cf848d9289bd6cad860 to have introduced the issue, but more testing is required to know for sure.

Name and Version

commit: 3807c3de04cde853418033c95e96642876545f3e cmake flags: -DBUILD_SHARED_LIBS=OFF -DGGML_VULKAN=1 -G "Visual Studio 17 2022" -A x64 MSBuild version: 17.9.8+b34f75857 Vulkan Instance Version: 1.3.261

What operating system are you seeing the problem on?

Windows

Relevant log output

Version MSBuild 17.9.8+b34f75857 pour .NET Framework

[...]

Generate vulkan shaders
  ggml_vulkan: Generating and compiling shaders to SPIR-V
  cannot compile mul_mat_vec_id_f32_f32

  C:/VulkanSDK/1.3.275.0/Bin/glslc.exe -fshader-stage=compute --target-env=vulkan1.2 -O C:/llama cpp/ggml/src/vulkan-shaders\mul_mat_vec.comp -o C:/llama cpp/build/ggml/src/vulkan-shaders.spv\mul_mat_vec_id
  _f32_f32.spv -DB_TYPE=float -DDATA_A_F32=1 -DD_TYPE=float -DFLOAT_TYPE=float -DMUL_MAT_ID=1

glslc : error : linking multiple files is not supported yet. Use -c to compile files individually. [C:\llama cpp\build\ggml\src\ggml.vcxproj]


  cannot compile cannot compile mul_mat_vec_q4_0_f32_f32mul_mat_vec_q4_0_f16_f32

  C:/VulkanSDK/1.3.275.0/Bin/glslc.exe -fshader-stage=compute --target-env=vulkan1.2 -O C:/llama cpp/ggml/src/vulkan-shaders\mul_mat_vec.comp -o C:/llama cpp/build/ggml/src/vulkan-shaders.spv\mul_mat_vec_q4
  _0_f32_f32.spv -DB_TYPE=float -DDATA_A_Q4_0=1 -DD_TYPE=float -DFLOAT_TYPE=float



glslc : error : linking multiple files is not supported yet. Use -c to compile files individually. [C:\llama cpp\build\ggml\src\ggml.vcxproj]

(this goes on for every op, and build crashes with code -1)

stduhpf avatar Jul 18 '24 10:07 stduhpf

Just tested again, I can confirm that commit 17eb6aa8a992cda37ee65cf848d9289bd6cad860 (pr https://github.com/ggerganov/llama.cpp/pull/8119) introduced this error.

stduhpf avatar Jul 18 '24 11:07 stduhpf

I am getting some errors related to vulkan shaders as well

[ 2%] Generate vulkan shaders /bin/sh: 1: vulkan-shaders-gen: not found make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:123: ggml/src/ggml-vulkan-shaders.hpp] Error 127 make[1]: *** [CMakeFiles/Makefile2:1653: ggml/src/CMakeFiles/ggml.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

Utkarsh4430 avatar Jul 25 '24 21:07 Utkarsh4430

I am getting some errors related to vulkan shaders as well

[ 2%] Generate vulkan shaders /bin/sh: 1: vulkan-shaders-gen: not found make[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:123: ggml/src/ggml-vulkan-shaders.hpp] Error 127 make[1]: *** [CMakeFiles/Makefile2:1653: ggml/src/CMakeFiles/ggml.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

same issue

FranzKafkaYu avatar Jul 29 '24 07:07 FranzKafkaYu

The error was introduced in this commit: vulkan : cmake integration (https://github.com/ggerganov/llama.cpp/pull/8119)

The repo compiles for the commit before it: metal : template-ify some of the kernels (https://github.com/ggerganov/llama.cpp/pull/8447)

Utkarsh4430 avatar Jul 29 '24 21:07 Utkarsh4430