From 9459c0c16b7e6ed83095e5c7b270069c24a56e7f Mon Sep 17 00:00:00 2001 From: Ashish Trivedi Date: Tue, 3 Jun 2025 09:39:54 -0700 Subject: [PATCH 1/5] @FIR-714: Updated SDK version to r0.1.3 version --- CMakeLists.txt | 6 ++++-- ggml-tsi-kernel | 2 +- tsi-pkg-build.sh | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e047785e603d6..d1986def391fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ if (GGML_TSAVORITE) if (NOT DEFINED MLIR_COMPILER_DIR) if (NOT DEFINED $ENV{MLIR_SDK_VERSION}) - set (MLIR_COMPILER_DIR /proj/work/rel/sw/sdk-r.0.1.2/compiler) + set (MLIR_COMPILER_DIR /proj/rel/sw/sdk-r.0.1.3/compiler) + message("MLIR_SDK_VERSION not set defaulting to ${MLIR_COMPILER_DIR}") else() set (MLIR_COMPILER_DIR $ENV{MLIR_SDK_VERSION}/compiler) endif() @@ -23,7 +24,8 @@ if (GGML_TSAVORITE) if (NOT DEFINED RUNTIME_DIR) if (NOT DEFINED $ENV{MLIR_SDK_VERSION}) - set (RUNTIME_DIR /proj/work/rel/sw/sdk-r.0.1.2/${GGML_TSAVORITE_TARGET}/runtime) + set (RUNTIME_DIR /proj/rel/sw/sdk-r.0.1.3/${GGML_TSAVORITE_TARGET}/runtime) + message("MLIR_SDK_VERSION not set defaulting to ${RUNTIME_DIR}") else() set (RUNTIME_DIR $ENV{MLIR_SDK_VERSION}/${GGML_TSAVORITE_TARGET}/runtime) endif() diff --git a/ggml-tsi-kernel b/ggml-tsi-kernel index d1383a04f29d0..9dcf09f210636 160000 --- a/ggml-tsi-kernel +++ b/ggml-tsi-kernel @@ -1 +1 @@ -Subproject commit d1383a04f29d0160750c0e51ab524d461c6a127b +Subproject commit 9dcf09f2106364d0dafa54bce743d1c11b701112 diff --git a/tsi-pkg-build.sh b/tsi-pkg-build.sh index 2dd5f048871b7..2a2c0afe462a3 100755 --- a/tsi-pkg-build.sh +++ b/tsi-pkg-build.sh @@ -6,12 +6,14 @@ echo 'updating submodule' git submodule update --recursive --init cd ggml-tsi-kernel/ module load tsi4 gcc/13.3.0 +export MLIR_SDK_VERSION=/proj/rel/sw/sdk-r.0.1.3 echo 'creating python virtual env' +/proj/local/Python-3.10.12/bin/python3 -m venv blob-creation python3 -m venv blob-creation source blob-creation/bin/activate echo 'installing mlir and python dependencies' -pip install -r /proj/rel/sw/mlir-compiler/python/requirements-common.txt -pip install /proj/rel/sw/mlir-compiler/python/mlir_external_packages-1.2.1-py3-none-any.whl +pip install -r ${MLIR_SDK_VERSION}/compiler/python/requirements-common.txt +pip install ${MLIR_SDK_VERSION}/compiler/python/mlir_external_packages-1.2.3-py3-none-any.whl pip install onnxruntime-training #build TSI kernels for the Tsavorite backend @@ -31,7 +33,6 @@ cd ../posix-kernel/ cd ../../ -export MLIR_SDK_VERSION=/proj/work/rel/sw/sdk-r.0.1.2 #Compile for posix with build-posix as a target folder echo 'building llama.cp, ggml for tsavorite and other binary for posix' From c18585c2fa0c09015e3d2b08861bf704361889ff Mon Sep 17 00:00:00 2001 From: Ashish Trivedi Date: Tue, 3 Jun 2025 11:49:25 -0700 Subject: [PATCH 2/5] @FIR-714: Updated TLIBS to be passed to llama_build function --- tests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 31fa312f65da6..ade78632c7352 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,7 +8,7 @@ function(llama_build source) endif() add_executable(${TEST_TARGET} ${source}) - target_link_libraries(${TEST_TARGET} PRIVATE common) + target_link_libraries(${TEST_TARGET} PRIVATE common ${TLIBS}) install(TARGETS ${TEST_TARGET} RUNTIME) endfunction() @@ -169,7 +169,7 @@ endif() # libmtmd set(LLAMA_TEST_NAME test-mtmd-c-api) llama_build_and_test(test-mtmd-c-api.c) -target_link_libraries(${LLAMA_TEST_NAME} PRIVATE mtmd) +target_link_libraries(${LLAMA_TEST_NAME} PRIVATE mtmd ${TLIBS}) # dummy executable - not installed get_filename_component(TEST_TARGET test-c.c NAME_WE) From 47ceff08be48672c997ee3b3242fdf504cb54696 Mon Sep 17 00:00:00 2001 From: Ashish Trivedi Date: Wed, 4 Jun 2025 10:50:11 -0700 Subject: [PATCH 3/5] @FIR-714: Updated to use 1.30 external dependencies --- CMakeLists.txt | 4 ++-- tests/CMakeLists.txt | 2 +- tsi-pkg-build.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1986def391fa..6af525e29cdbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,14 +35,14 @@ if (GGML_TSAVORITE) set (GGML_TSI_KERNEL_DIR ${CMAKE_SOURCE_DIR}/ggml-tsi-kernel/${GGML_TSAVORITE_TARGET}) endif() - file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o") if (${GGML_TSAVORITE_TARGET} STREQUAL fpga) set(CMAKE_CROSSCOMPILING ON) set(ARCH_FLAGS -march=armv8-a) + file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o") message("Setting target as fpga") elseif (${GGML_TSAVORITE_TARGET} STREQUAL "posix") - list(APPEND TLIBS "${MLIR_COMPILER_DIR}/lib/libFFMDeviceShim.so") + file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o" "${MLIR_COMPILER_DIR}/lib/libFFMDeviceShim.so" "${MLIR_COMPILER_DIR}/lib/libTsavRTPosixShimCAPI.so") message("Setting target as posix for tsavorite") endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ade78632c7352..6ffd975127e8e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -69,7 +69,7 @@ function(llama_build_and_test source) add_executable(${TEST_TARGET} ${source} get-model.cpp) install(TARGETS ${TEST_TARGET} RUNTIME) - target_link_libraries(${TEST_TARGET} PRIVATE common) + target_link_libraries(${TEST_TARGET} PRIVATE common ${TLIBS}) add_test( NAME ${TEST_TARGET} diff --git a/tsi-pkg-build.sh b/tsi-pkg-build.sh index 2a2c0afe462a3..488d98abb035b 100755 --- a/tsi-pkg-build.sh +++ b/tsi-pkg-build.sh @@ -13,7 +13,7 @@ python3 -m venv blob-creation source blob-creation/bin/activate echo 'installing mlir and python dependencies' pip install -r ${MLIR_SDK_VERSION}/compiler/python/requirements-common.txt -pip install ${MLIR_SDK_VERSION}/compiler/python/mlir_external_packages-1.2.3-py3-none-any.whl +pip install ${MLIR_SDK_VERSION}/compiler/python/mlir_external_packages-1.3.0-py3-none-any.whl pip install onnxruntime-training #build TSI kernels for the Tsavorite backend From 2ea9390d102562f36d655638f0e7345d30c48ccd Mon Sep 17 00:00:00 2001 From: Ashish Trivedi Date: Wed, 4 Jun 2025 13:29:14 -0700 Subject: [PATCH 4/5] @FIR-714: Addressed build failures for posix, FPGA still fails as follows /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: /proj/work/atrivedi/workspace/06_02_2025/llama.cpp/ggml-tsi-kernel/fpga/host/host_abs.o: in function `txe_abs_host': LLVMDialectModule:(.text+0x18): undefined reference to `tsi_alloc' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x24): undefined reference to `tsi_shmem_handle_from_ptr' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x30): undefined reference to `tsi_shmem_handle_from_ptr' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x3c): undefined reference to `tsi_create_command_list' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x58): undefined reference to `tsi_load_blob' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x64): undefined reference to `tsi_shmem_handle_from_ptr' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x70): undefined reference to `tsi_launch_blob' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x7c): undefined reference to `tsi_add_command_to_list' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x84): undefined reference to `tsi_finalize_command_list' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x8c): undefined reference to `tsi_wait' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x94): undefined reference to `tsi_unload_blob' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0xa0): undefined reference to `tsi_dealloc' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: /proj/work/atrivedi/workspace/06_02_2025/llama.cpp/ggml-tsi-kernel/fpga/host/host_add.o: in function `txe_add_host': LLVMDialectModule:(.text+0x20): undefined reference to `tsi_alloc' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x2c): undefined reference to `tsi_shmem_handle_from_ptr' /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/../lib/gcc/aarch64-none-linux-gnu/14.2.1/../../../../aarch64-none-linux-gnu/bin/ld: LLVMDialectModule:(.text+0x38): undefined reference to `tsi_shmem_handle_from_ptr' --- CMakeLists.txt | 2 +- ggml/include/ggml-tsavorite.h | 20 ++++++++++---------- ggml/src/ggml-tsavorite/ggml-tsavorite.cpp | 20 ++++++++++---------- tests/CMakeLists.txt | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6af525e29cdbc..2eebb65851cad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if (GGML_TSAVORITE) if (${GGML_TSAVORITE_TARGET} STREQUAL fpga) set(CMAKE_CROSSCOMPILING ON) set(ARCH_FLAGS -march=armv8-a) - file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o") + file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o") message("Setting target as fpga") elseif (${GGML_TSAVORITE_TARGET} STREQUAL "posix") file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o" "${MLIR_COMPILER_DIR}/lib/libFFMDeviceShim.so" "${MLIR_COMPILER_DIR}/lib/libTsavRTPosixShimCAPI.so") diff --git a/ggml/include/ggml-tsavorite.h b/ggml/include/ggml-tsavorite.h index 54a8e34662799..238dcc428da88 100644 --- a/ggml/include/ggml-tsavorite.h +++ b/ggml/include/ggml-tsavorite.h @@ -151,16 +151,16 @@ typedef struct tensor_log_ { const ggml_tensor *tensor; } tensor_log; -extern void _mlir_ciface_txe_add(void *a, void *b, void *res); -extern void _mlir_ciface_txe_sub(void *a, void *b, void *res); -extern void _mlir_ciface_txe_mult(void *a, void *b, void *res); -extern void _mlir_ciface_txe_div(void *a, void *b, void *res); -extern void _mlir_ciface_txe_sqrt(void *a, void *res); -extern void _mlir_ciface_txe_neg(void *a, void *res); -extern void _mlir_ciface_txe_abs(void *a, void *res); -extern void _mlir_ciface_txe_sin(void *a, void *res); -extern void _mlir_ciface_txe_sigmoid(void *a, void *res); -extern void _mlir_ciface_txe_silu(void *a, void *res); +extern void _mlir_ciface_txe_add_host(void *a, void *b, void *res); +extern void _mlir_ciface_txe_sub_host(void *a, void *b, void *res); +extern void _mlir_ciface_txe_mult_host(void *a, void *b, void *res); +extern void _mlir_ciface_txe_div_host(void *a, void *b, void *res); +extern void _mlir_ciface_txe_sqrt_host(void *a, void *res); +extern void _mlir_ciface_txe_neg_host(void *a, void *res); +extern void _mlir_ciface_txe_abs_host(void *a, void *res); +extern void _mlir_ciface_txe_sin_host(void *a, void *res); +extern void _mlir_ciface_txe_sigmoid_host(void *a, void *res); +extern void _mlir_ciface_txe_silu_host(void *a, void *res); extern void ggml_tsi_log_tensor_data(tensor_log log_data); #define NUM_OF_TXES 1 diff --git a/ggml/src/ggml-tsavorite/ggml-tsavorite.cpp b/ggml/src/ggml-tsavorite/ggml-tsavorite.cpp index 573220c8a7027..bc7095eeebf2f 100644 --- a/ggml/src/ggml-tsavorite/ggml-tsavorite.cpp +++ b/ggml/src/ggml-tsavorite/ggml-tsavorite.cpp @@ -389,12 +389,12 @@ static txe_compute_pipeline_state_s tsi_kernel_setup(enum ggml_tsavorite_kernel_ if (ggml_tsavorite_kernel_mode_flag == GGML_TSAVORITE_KERNEL_MODE_CPU) kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_add_test; else - kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_add; + kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_add_host; kernel_pipeline->kernel_name = "TXE_ADD"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_SUB: - kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_sub; + kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_sub_host; kernel_pipeline->kernel_name = "TXE_SUB"; flag = true; break; @@ -402,42 +402,42 @@ static txe_compute_pipeline_state_s tsi_kernel_setup(enum ggml_tsavorite_kernel_ if (ggml_tsavorite_kernel_mode_flag == GGML_TSAVORITE_KERNEL_MODE_CPU) kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_mult_test; else - kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_mult; + kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_mult_host; kernel_pipeline->kernel_name = "TXE_MULT"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_DIV: - kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_div; + kernel_pipeline->_mlir_fptr_2_input = &_mlir_ciface_txe_div_host; kernel_pipeline->kernel_name = "TXE_DIV"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_SQRT: - kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_sqrt; + kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_sqrt_host; kernel_pipeline->kernel_name = "TXE_SQRT"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_NEG: - kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_neg; + kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_neg_host; kernel_pipeline->kernel_name = "TXE_NEG"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_ABS: - kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_abs; + kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_abs_host; kernel_pipeline->kernel_name = "TXE_ABS"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_SIN: - kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_sin; + kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_sin_host; kernel_pipeline->kernel_name = "TXE_SIN"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_SIGMOID: - kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_sigmoid; + kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_sigmoid_host; kernel_pipeline->kernel_name = "TXE_SIGMOID"; flag = true; break; case GGML_TSAVORITE_KERNEL_TYPE_SILU: - kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_silu; + kernel_pipeline->_mlir_fptr_1_input = &_mlir_ciface_txe_silu_host; kernel_pipeline->kernel_name = "TXE_SILU"; flag = true; break; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6ffd975127e8e..c2b5cc88ad330 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,7 +8,7 @@ function(llama_build source) endif() add_executable(${TEST_TARGET} ${source}) - target_link_libraries(${TEST_TARGET} PRIVATE common ${TLIBS}) + target_link_libraries(${TEST_TARGET} PRIVATE common) install(TARGETS ${TEST_TARGET} RUNTIME) endfunction() @@ -69,7 +69,7 @@ function(llama_build_and_test source) add_executable(${TEST_TARGET} ${source} get-model.cpp) install(TARGETS ${TEST_TARGET} RUNTIME) - target_link_libraries(${TEST_TARGET} PRIVATE common ${TLIBS}) + target_link_libraries(${TEST_TARGET} PRIVATE common) add_test( NAME ${TEST_TARGET} @@ -169,9 +169,9 @@ endif() # libmtmd set(LLAMA_TEST_NAME test-mtmd-c-api) llama_build_and_test(test-mtmd-c-api.c) -target_link_libraries(${LLAMA_TEST_NAME} PRIVATE mtmd ${TLIBS}) +target_link_libraries(${LLAMA_TEST_NAME} PRIVATE mtmd) # dummy executable - not installed get_filename_component(TEST_TARGET test-c.c NAME_WE) add_executable(${TEST_TARGET} test-c.c) -target_link_libraries(${TEST_TARGET} PRIVATE llama ${TLIBS}) +target_link_libraries(${TEST_TARGET} PRIVATE ${TLIBS} llama) From cea50afa37a04114429b07abf9e6849c0d3a2ecb Mon Sep 17 00:00:00 2001 From: Ashish Trivedi Date: Wed, 4 Jun 2025 18:06:58 -0700 Subject: [PATCH 5/5] @FIR-714: Fixed the issues of not finding fpga libs using runtime/utils/lib/ path --- CMakeLists.txt | 6 +++--- tests/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2eebb65851cad..a4d51cdbe2dc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ if (GGML_TSAVORITE) if (NOT DEFINED MLIR_COMPILER_DIR) if (NOT DEFINED $ENV{MLIR_SDK_VERSION}) set (MLIR_COMPILER_DIR /proj/rel/sw/sdk-r.0.1.3/compiler) - message("MLIR_SDK_VERSION not set defaulting to ${MLIR_COMPILER_DIR}") + message("MLIR_SDK_VERSION not set defaulting to ${MLIR_COMPILER_DIR}") else() set (MLIR_COMPILER_DIR $ENV{MLIR_SDK_VERSION}/compiler) endif() @@ -25,7 +25,7 @@ if (GGML_TSAVORITE) if (NOT DEFINED RUNTIME_DIR) if (NOT DEFINED $ENV{MLIR_SDK_VERSION}) set (RUNTIME_DIR /proj/rel/sw/sdk-r.0.1.3/${GGML_TSAVORITE_TARGET}/runtime) - message("MLIR_SDK_VERSION not set defaulting to ${RUNTIME_DIR}") + message("MLIR_SDK_VERSION not set defaulting to ${RUNTIME_DIR}") else() set (RUNTIME_DIR $ENV{MLIR_SDK_VERSION}/${GGML_TSAVORITE_TARGET}/runtime) endif() @@ -39,7 +39,7 @@ if (GGML_TSAVORITE) if (${GGML_TSAVORITE_TARGET} STREQUAL fpga) set(CMAKE_CROSSCOMPILING ON) set(ARCH_FLAGS -march=armv8-a) - file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o") + file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o" "${RUNTIME_DIR}/../utils/lib/TsavRTShimCAPI.cpp.o") message("Setting target as fpga") elseif (${GGML_TSAVORITE_TARGET} STREQUAL "posix") file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "${GGML_TSI_KERNEL_DIR}/host/*.o" "${MLIR_COMPILER_DIR}/lib/libFFMDeviceShim.so" "${MLIR_COMPILER_DIR}/lib/libTsavRTPosixShimCAPI.so") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c2b5cc88ad330..1c8b8e29a822e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -174,4 +174,4 @@ target_link_libraries(${LLAMA_TEST_NAME} PRIVATE mtmd) # dummy executable - not installed get_filename_component(TEST_TARGET test-c.c NAME_WE) add_executable(${TEST_TARGET} test-c.c) -target_link_libraries(${TEST_TARGET} PRIVATE ${TLIBS} llama) +target_link_libraries(${TEST_TARGET} PRIVATE ${TLIBS} llama stdc++)