Skip to content

Commit b4f5466

Browse files
@FIR-1035: Bring llama.cpp to latest and add dependencies for curl and openssl.
This change brings in latest llama.cpp and adds 1. Open SSL 2. Lib CURL dependencies The arm tool chain also has been updated with following libraries in /proj/rel/sw area [atrivedi@ws01 workspace]$ ls /proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/lib -lt total 41840 -rw-r--r-- 1 atrivedi tsiusers 730992 Oct 29 06:38 libzstd.so.1.4.8 -rw-r--r-- 1 atrivedi tsiusers 730992 Oct 29 06:38 libzstd.so.1 -rwxr-xr-x 1 atrivedi tsiusers 96248 Oct 29 06:38 libz.so.1.3.1 -rwxr-xr-x 1 atrivedi tsiusers 96248 Oct 29 06:38 libz.so.1 -rwxr-xr-x 1 atrivedi tsiusers 96248 Oct 29 06:38 libz.so -rw-r--r-- 1 atrivedi tsiusers 128580 Oct 29 06:38 libz.a -rwxr-xr-x 1 atrivedi tsiusers 2033616 Oct 29 06:38 libunistring.so.5.2.0 -rwxr-xr-x 1 atrivedi tsiusers 2033616 Oct 29 06:38 libunistring.so.5 -rwxr-xr-x 1 atrivedi tsiusers 2033616 Oct 29 06:38 libunistring.so -rwxr-xr-x 1 atrivedi tsiusers 1196040 Oct 29 06:38 libssl.so.3 -rw-r--r-- 1 atrivedi tsiusers 132968 Oct 29 06:38 libidn2.so.0.4.0 -rw-r--r-- 1 atrivedi tsiusers 132968 Oct 29 06:38 libidn2.so.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.7.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.6.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.5.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.4.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.3.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.2.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.1.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.4.0.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl.so.3 -rwxr-xr-x 1 atrivedi tsiusers 666912 Oct 29 06:38 libcurl.so -rw-r--r-- 1 atrivedi tsiusers 1066 Oct 29 06:38 libcurl.la -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.8.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.7.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.6.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.5.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.4.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.3.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.2.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.1.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.4.0.0 -rwxr-xr-x 1 atrivedi tsiusers 1195448 Oct 29 06:38 libcurl-compat.so.3 -rw-r--r-- 1 atrivedi tsiusers 776948 Oct 29 06:38 libcurl.a -rwxr-xr-x 1 atrivedi tsiusers 6302760 Oct 29 06:38 libcrypto.so.3 -rw-r--r-- 1 atrivedi tsiusers 2612824 Oct 29 06:38 libcrypto.so.1.1
1 parent 650a834 commit b4f5466

File tree

8 files changed

+46
-9
lines changed

8 files changed

+46
-9
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ if (GGML_TSAVORITE)
4949
set(GGML_TSAVORITE_TARGET "${GGML_TSAVORITE_TARGET}" CACHE STRING "Target for tsavorite")
5050
set (TSAVORITE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ggml/src/ggml-tsavorite/include)
5151

52+
include_directories($ENV{TSAVORITE_SYSROOT_INCLUDE_DIR})
5253
include_directories(${TSAVORITE_INCLUDE_DIR})
5354
include_directories(${MLIR_COMPILER_DIR}/include/runtime/shim)
5455
include_directories(${RUNTIME_DIR}/include)

common/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ target_compile_features (${TARGET} PUBLIC cxx_std_17)
176176
if (GGML_TSAVORITE)
177177
if (${GGML_TSAVORITE_TARGET} STREQUAL fpga)
178178
target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} ${TLIBS} PUBLIC llama Threads::Threads)
179+
set(SYSROOT_PATH_FOR_LIBRARIES $ENV{CMAKE_FIND_ROOT_PATH}/lib)
180+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${SYSROOT_PATH_FOR_LIBRARIES} -Wl,-rpath-link,${SYSROOT_PATH_FOR_LIBRARIES}")
181+
target_link_directories(${TARGET} PRIVATE ${SYSROOT_PATH_FOR_LIBRARIES})
179182
else()
180183
target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} PUBLIC llama Threads::Threads)
181184
endif()

examples/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ llama_add_compile_flags()
1212

1313
# examples
1414

15+
#if (NOT DEFINED GGML_TSAVORITE)
1516
if (EMSCRIPTEN)
1617
else()
18+
if (NOT DEFINED GGML_TSAVORITE)
1719
add_subdirectory(batched)
1820
add_subdirectory(embedding)
1921
add_subdirectory(eval-callback)
@@ -26,7 +28,9 @@ else()
2628
add_subdirectory(passkey)
2729
add_subdirectory(retrieval)
2830
add_subdirectory(save-load-state)
31+
endif()
2932
add_subdirectory(simple)
33+
if (NOT DEFINED GGML_TSAVORITE)
3034
add_subdirectory(simple-chat)
3135
add_subdirectory(speculative)
3236
add_subdirectory(speculative-simple)
@@ -41,4 +45,6 @@ else()
4145
add_subdirectory(sycl)
4246
endif()
4347
endif()
48+
endif()
4449
endif()
50+
#endif()

pocs/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ find_package(Threads REQUIRED)
66

77
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
88

9+
if (NOT DEFINED GGML_TSAVORITE)
910
if (EMSCRIPTEN)
1011
else()
1112
if (NOT GGML_BACKEND_DL)
1213
add_subdirectory(vdot)
1314
endif()
1415
endif()
16+
endif()

tests/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ function(llama_build_and_test source)
108108
set_property(TEST ${TEST_TARGET} PROPERTY LABELS ${LLAMA_TEST_LABEL})
109109
endfunction()
110110

111+
if (NOT DEFINED GGML_TSAVORITE)
112+
111113
# build test-tokenizer-0 target once and add many tests
112114
llama_build(test-tokenizer-0.cpp)
113115

@@ -125,6 +127,8 @@ llama_test(test-tokenizer-0 NAME test-tokenizer-0-qwen2 ARGS ${PROJE
125127
llama_test(test-tokenizer-0 NAME test-tokenizer-0-refact ARGS ${PROJECT_SOURCE_DIR}/models/ggml-vocab-refact.gguf)
126128
llama_test(test-tokenizer-0 NAME test-tokenizer-0-starcoder ARGS ${PROJECT_SOURCE_DIR}/models/ggml-vocab-starcoder.gguf)
127129

130+
endif()
131+
128132
if (NOT WIN32)
129133
llama_test_cmd(
130134
${CMAKE_CURRENT_SOURCE_DIR}/test-tokenizers-repo.sh
@@ -138,6 +142,7 @@ if (LLAMA_LLGUIDANCE)
138142
llama_build_and_test(test-grammar-llguidance.cpp ARGS ${PROJECT_SOURCE_DIR}/models/ggml-vocab-llama-bpe.gguf)
139143
endif ()
140144

145+
if (NOT DEFINED GGML_TSAVORITE)
141146
if (NOT WIN32 OR NOT BUILD_SHARED_LIBS)
142147
# these tests are disabled on Windows because they use internal functions not exported with LLAMA_API (when building with shared libraries)
143148
llama_build_and_test(test-sampling.cpp)
@@ -213,7 +218,6 @@ if (NOT GGML_BACKEND_DL)
213218
llama_build_and_test(test-quantize-perf.cpp)
214219
llama_build_and_test(test-rope.cpp)
215220
endif()
216-
217221
# libmtmd
218222
set(LLAMA_TEST_NAME test-mtmd-c-api)
219223
llama_build_and_test(test-mtmd-c-api.c)
@@ -225,3 +229,4 @@ add_executable(${TEST_TARGET} test-c.c)
225229
target_link_libraries(${TEST_TARGET} PRIVATE ${TLIBS} llama stdc++)
226230
llama_build_and_test(test-alloc.cpp)
227231
target_include_directories(test-alloc PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
232+
endif()

tools/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ llama_add_compile_flags()
1414

1515
if (EMSCRIPTEN)
1616
else()
17+
if (NOT DEFINED GGML_TSAVORITE)
1718
add_subdirectory(batched-bench)
1819
add_subdirectory(gguf-split)
1920
add_subdirectory(imatrix)
2021
add_subdirectory(llama-bench)
22+
endif()
2123
add_subdirectory(main)
24+
if (NOT DEFINED GGML_TSAVORITE)
2225
add_subdirectory(perplexity)
2326
add_subdirectory(quantize)
2427
if (LLAMA_BUILD_SERVER)
@@ -35,5 +38,6 @@ else()
3538
# these examples use the backends directly and cannot be built with dynamic loading
3639
add_subdirectory(cvector-generator)
3740
add_subdirectory(export-lora)
41+
endif()
3842
endif()
3943
endif()

tools/main/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
set(TARGET llama-cli)
22
add_executable(${TARGET} main.cpp)
33
target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
4+
if (GGML_TSAVORITE)
5+
if (${GGML_TSAVORITE_TARGET} STREQUAL fpga)
6+
set(SYSROOT_PATH_FOR_LIBRARIES $ENV{CMAKE_FIND_ROOT_PATH}/lib)
7+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${SYSROOT_PATH_FOR_LIBRARIES} -Wl,-rpath-link,${SYSROOT_PATH_FOR_LIBRARIES}")
8+
target_link_directories(${TARGET} PRIVATE ${SYSROOT_PATH_FOR_LIBRARIES})
9+
endif()
10+
endif()
411
target_compile_features(${TARGET} PRIVATE cxx_std_17)
512

613
if(LLAMA_TOOLS_INSTALL)

tsi-pkg-build.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11

2+
3+
# Steps to merge the branch to latest
4+
#git clone [email protected]:tsisw/llama.cpp.git
5+
#git remote add upstream https://github.com/ggml-org/llama.cpp.git
6+
#git fetch upstream
7+
#git checkout master
8+
#git merge upstream/master
9+
210
set -e
311

412
#Ensure prerequisites are met as follows
513
echo 'updating submodule'
614
git submodule update --recursive --init
715
cd ggml-tsi-kernel/
8-
module load tsi4 gcc/13.3.0
16+
module load gcc/13.3.0
917
export MLIR_SDK_VERSION=/proj/rel/sw/sdk-r.0.2.0
1018
echo 'creating python virtual env'
1119
/proj/local/Python-3.10.12/bin/python3 -m venv blob-creation
@@ -38,11 +46,11 @@ cd ../../
3846
echo 'building llama.cp, ggml for tsavorite and other binary for posix'
3947
if [ "$(echo "$1" | tr '[:upper:]' '[:lower:]')" = "release" ];
4048
then
41-
cmake -B build-posix -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=posix -DCMAKE_C_FLAGS="-DGGML_PERF_RELEASE -DGGML_TARGET_POSIX -DGGML_TSAVORITE" -DCMAKE_CXX_FLAGS="-DGGML_PERF_RELEASE -DGGML_TARGET_POSIX -DGGML_TSAVORITE"
49+
cmake -B build-posix -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=posix -DCMAKE_C_FLAGS="-DGGML_PERF_RELEASE -DGGML_TARGET_POSIX -DGGML_TSAVORITE" -DCMAKE_CXX_FLAGS="-DGGML_PERF_RELEASE -DGGML_TARGET_POSIX -DGGML_TSAVORITE"
4250
elif [ "$(echo "$1" | tr '[:upper:]' '[:lower:]')" = "debug" ]; then
43-
cmake -B build-posix -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=posix -DCMAKE_C_FLAGS="-DGGML_PERF_DETAIL -DGGML_TARGET_POSIX -DGGML_TSAVORITE" -DCMAKE_CXX_FLAGS="-DGGML_PERF_DETAIL -DGGML_TARGET_POSIX -DGGML_TSAVORITE"
51+
cmake -B build-posix -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=posix -DCMAKE_C_FLAGS="-DGGML_PERF_DETAIL -DGGML_TARGET_POSIX -DGGML_TSAVORITE" -DCMAKE_CXX_FLAGS="-DGGML_PERF_DETAIL -DGGML_TARGET_POSIX -DGGML_TSAVORITE"
4452
else
45-
cmake -B build-posix -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=posix -DCMAKE_C_FLAGS="-DGGML_PERF -DGGML_TARGET_POSIX -DGGML_TSAVORITE" -DCMAKE_CXX_FLAGS="-DGGML_PERF -DGGML_TARGET_POSIX -DGGML_TSAVORITE"
53+
cmake -B build-posix -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=posix -DCMAKE_C_FLAGS="-DGGML_PERF -DGGML_TARGET_POSIX -DGGML_TSAVORITE" -DCMAKE_CXX_FLAGS="-DGGML_PERF -DGGML_TARGET_POSIX -DGGML_TSAVORITE"
4654
fi
4755

4856
cmake --build build-posix --config Release
@@ -73,14 +81,15 @@ chmod +x build-posix/bin/llama-cli
7381
echo 'building llama.cp, ggml for tsavorite and other binary for fpga'
7482
export CC="/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc"
7583
export CXX="/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-g++"
76-
84+
export CMAKE_FIND_ROOT_PATH=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/
85+
export TSAVORITE_SYSROOT_INCLUDE_DIR=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/include/
7786
if [ "$(echo "$1" | tr '[:upper:]' '[:lower:]')" = "release" ];
7887
then
79-
cmake -B build-fpga -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=fpga -DCMAKE_C_FLAGS="-DGGML_PERF_RELEASE" -DCMAKE_CXX_FLAGS="-DGGML_PERF_RELEASE"
88+
cmake -B build-fpga -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=fpga -DCMAKE_C_FLAGS="-DGGML_PERF_RELEASE" -DCMAKE_CXX_FLAGS="-DGGML_PERF_RELEASE" -DCURL_INCLUDE_DIR=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/include -DCURL_LIBRARY=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/lib/libcurl.so
8089
elif [ "$(echo "$1" | tr '[:upper:]' '[:lower:]')" = "debug" ]; then
81-
cmake -B build-fpga -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=fpga -DCMAKE_C_FLAGS="-DGGML_PERF_DETAIL" -DCMAKE_CXX_FLAGS="-DGGML_PERF_DETAIL"
90+
cmake -B build-fpga -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=fpga -DCMAKE_C_FLAGS="-DGGML_PERF_DETAIL" -DCMAKE_CXX_FLAGS="-DGGML_PERF_DETAIL" -DCURL_INCLUDE_DIR=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/include -DCURL_LIBRARY=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/lib/libcurl.so
8291
else
83-
cmake -B build-fpga -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=fpga -DCMAKE_C_FLAGS="-DGGML_PERF" -DCMAKE_CXX_FLAGS="-DGGML_PERF"
92+
cmake -B build-fpga -DGGML_TSAVORITE=ON -DGGML_TSAVORITE_TARGET=fpga -DCMAKE_C_FLAGS="-DGGML_PERF" -DCMAKE_CXX_FLAGS="-DGGML_PERF" -DCURL_INCLUDE_DIR=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/include -DCURL_LIBRARY=/proj/rel/sw/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu/lib/libcurl.so
8493
fi
8594

8695
cmake --build build-fpga --config Release

0 commit comments

Comments
 (0)