From be0e7b68ba4b11aea9c0476e8b7eac7c19eae6ba Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Mon, 13 Jan 2025 11:24:08 +0200 Subject: [PATCH] ggml : do not define GGML_USE_CUDA when building with GGML_BACKEND_DL Build fails when using HIP and GGML_BACKEND_DL: ``` /usr/bin/ld: ../ggml/src/libggml.so: undefined reference to `ggml_backend_cuda_reg' collect2: error: ld returned 1 exit status ``` This patch fixes this. --- ggml/src/ggml-hip/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-hip/CMakeLists.txt b/ggml/src/ggml-hip/CMakeLists.txt index b15fbd24d..d090ba9bd 100644 --- a/ggml/src/ggml-hip/CMakeLists.txt +++ b/ggml/src/ggml-hip/CMakeLists.txt @@ -70,7 +70,9 @@ ggml_add_backend_library(ggml-hip ) # TODO: do not use CUDA definitions for HIP -target_compile_definitions(ggml PUBLIC GGML_USE_CUDA) +if (NOT GGML_BACKEND_DL) + target_compile_definitions(ggml PUBLIC GGML_USE_CUDA) +endif() add_compile_definitions(GGML_USE_HIP)