基础环境为scnet提供的PyTorch / 2.5.1 / py3.10-ubuntu22.04 / dtk25.04.2
使用的编译脚本如下,opendas上老的llama cpp可使用下面脚本编译
```
export LIBRARY_PATH=/opt/dtk-25.04.2/dcc/lib/clang/17.0.0/lib/linux:$LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/dtk-25.04.2/dcc/lib/clang/17.0.0/lib/linux:$LD_LIBRARY_PATH
cmake -S . -B build -DGGML_HIP=1 -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off -DCMAKE_C_COMPILER=/opt/dtk/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/dtk/llvm/bin/clang++ -DAMDGPU_TARGETS=gfx936 -DGPU_TARGETS=gfx936
echo "build step2..."
for f in `ag xhip build -l`
do
sed -i 's/^\(C_FLAGS.*\) -xhip --cuda-gpu-arch=gfx936\(.*\)/\1 --gpu-max-threads-per-block=1024 \2/g' $f
sed -i 's/^\(CXX_FLAGS.*\)/\1 --gpu-max-threads-per-block=1024/g' $f
done
cmake --build build --config Release
echo "build done..."
```
但是编译新的代码的时候出现问题
```
In file included from /root/llama.cpp-master/ggml/src/ggml-cuda/softmax.cu:6:
In file included from /opt/dtk/include/hip/hip_cooperative_groups.h:38:
In file included from /opt/dtk/include/hip/amd_detail/amd_hip_cooperative_groups.h:46:
/opt/dtk/include/hip/amd_detail/cooperative_groups/details/info.h:311:5: error: redefinition of '__any'
int __any_sync(unsigned mask, int predicate){
^
/root/llama.cpp-master/ggml/src/ggml-cuda/vendors/hip.h:35:31: note: expanded from macro '__any_sync'
#define __any_sync(mask, var) __any(var)
^
/opt/dtk/include/hip/amd_detail/amd_warp_functions.h:36:5: note: previous definition is here
int __any(int predicate) {
^
In file included from /root/llama.cpp-master/ggml/src/ggml-cuda/softmax.cu:6:
In file included from /opt/dtk/include/hip/hip_cooperative_groups.h:38:
In file included from /opt/dtk/include/hip/amd_detail/amd_hip_cooperative_groups.h:48:
In file included from /opt/dtk/include/hip/amd_detail/cooperative_groups/details/helpers.h:53:
/opt/dtk/include/hip/amd_detail/cooperative_groups/details/sync.h:70:62: error: invalid input constraint 'l' in asm
asm volatile("ld.acquire.gpu.u32 %0,[%1];" : "=r"(val) : _CG_ASM_PTR_CONSTRAINT((unsigned int*)addr) : "memory");
^
/opt/dtk/include/hip/amd_detail/cooperative_groups/details/info.h:157:34: note: expanded from macro '_CG_ASM_PTR_CONSTRAINT'
# define _CG_ASM_PTR_CONSTRAINT "l"
^
In file included from /root/llama.cpp-master/ggml/src/ggml-cuda/softmax.cu:6:
In file included from /opt/dtk/include/hip/hip_cooperative_groups.h:38:
In file included from /opt/dtk/include/hip/amd_detail/amd_hip_cooperative_groups.h:48:
In file included from /opt/dtk/include/hip/amd_detail/cooperative_groups/details/helpers.h:53:
/opt/dtk/include/hip/amd_detail/cooperative_groups/details/sync.h:81:71: error: invalid input constraint 'l' in asm
asm volatile("atom.add.release.gpu.u32 %0,[%1],%2;" : "=r"(old) : _CG_ASM_PTR_CONSTRAINT((unsigned int*)addr), "r"(val) : "memory");
^
/opt/dtk/include/hip/amd_detail/cooperative_groups/details/info.h:157:34: note: expanded from macro '_CG_ASM_PTR_CONSTRAINT'
# define _CG_ASM_PTR_CONSTRAINT "l"
^
9 warnings and 3 errors generated when compiling for gfx936.
gmake[2]: *** [ggml/src/ggml-hip/CMakeFiles/ggml-hip.dir/build.make:686: ggml/src/ggml-hip/CMakeFiles/ggml-hip.dir/__/ggml-cuda/softmax.cu.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1867: ggml/src/ggml-hip/CMakeFiles/ggml-hip.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
```
期望可以更新一下https://developer.sourcefind.cn/codes/OpenDAS/llama.cpp/-/tree/master