Skip to content

Commit f035dba

Browse files
authored
Merge branch 'ggerganov:master' into master
2 parents 73069a9 + 9f40989 commit f035dba

38 files changed

+20047
-24619
lines changed

CMakePresets.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,23 @@
4848
}
4949
},
5050

51+
{
52+
"name": "arm64-apple-clang", "hidden": true,
53+
"architecture": { "value": "arm64", "strategy": "external" },
54+
"toolset": { "value": "host=x64", "strategy": "external" },
55+
"cacheVariables": {
56+
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-apple-clang.cmake"
57+
}
58+
},
59+
5160
{ "name": "arm64-windows-llvm-debug" , "inherits": [ "base", "arm64-windows-llvm", "debug" ] },
5261
{ "name": "arm64-windows-llvm-release", "inherits": [ "base", "arm64-windows-llvm", "reldbg" ] },
5362
{ "name": "arm64-windows-llvm+static-release", "inherits": [ "base", "arm64-windows-llvm", "reldbg", "static" ] },
5463

64+
{ "name": "arm64-apple-clang-debug" , "inherits": [ "base", "arm64-apple-clang", "debug" ] },
65+
{ "name": "arm64-apple-clang-release" , "inherits": [ "base", "arm64-apple-clang", "reldbg" ] },
66+
{ "name": "arm64-apple-clang+static-release" , "inherits": [ "base", "arm64-apple-clang", "reldbg", "static" ] },
67+
5568
{ "name": "arm64-windows-msvc-debug" , "inherits": [ "base", "arm64-windows-msvc", "debug" ] },
5669
{ "name": "arm64-windows-msvc-release", "inherits": [ "base", "arm64-windows-msvc", "reldbg" ] },
5770
{ "name": "arm64-windows-msvc+static-release", "inherits": [ "base", "arm64-windows-msvc", "reldbg", "static" ] },

Makefile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Define the default target now so that it is always the first target
22
BUILD_TARGETS = \
33
libllava.a \
4-
llama-baby-llama \
54
llama-batched \
65
llama-batched-bench \
76
llama-bench \
@@ -56,14 +55,14 @@ TEST_TARGETS = \
5655
tests/test-llama-grammar \
5756
tests/test-log \
5857
tests/test-model-load-cancel \
59-
tests/test-opt \
6058
tests/test-quantize-fns \
6159
tests/test-quantize-perf \
6260
tests/test-rope \
6361
tests/test-sampling \
6462
tests/test-tokenizer-0 \
6563
tests/test-tokenizer-1-bpe \
6664
tests/test-tokenizer-1-spm
65+
# tests/test-opt \
6766
6867
# Legacy build targets that were renamed in #7809, but should still be removed when the project is cleaned
6968
LEGACY_TARGETS_CLEAN = main quantize quantize-stats perplexity imatrix embedding vdot q8dot convert-llama2c-to-ggml \
@@ -916,6 +915,7 @@ endif # GGML_METAL
916915

917916
OBJ_GGML += \
918917
ggml/src/ggml.o \
918+
ggml/src/ggml-cpu.o \
919919
ggml/src/ggml-alloc.o \
920920
ggml/src/ggml-backend.o \
921921
ggml/src/ggml-quants.o \
@@ -936,7 +936,6 @@ OBJ_COMMON = \
936936
common/console.o \
937937
common/ngram-cache.o \
938938
common/sampling.o \
939-
common/train.o \
940939
common/build-info.o \
941940
common/json-schema-to-grammar.o
942941

@@ -1048,6 +1047,12 @@ ggml/src/ggml.o: \
10481047
ggml/include/ggml.h
10491048
$(CC) $(CFLAGS) -c $< -o $@
10501049

1050+
ggml/src/ggml-cpu.o: \
1051+
ggml/src/ggml-cpu.c \
1052+
ggml/include/ggml.h \
1053+
ggml/src/ggml-common.h
1054+
$(CC) $(CFLAGS) -c $< -o $@
1055+
10511056
ggml/src/ggml-alloc.o: \
10521057
ggml/src/ggml-alloc.c \
10531058
ggml/include/ggml.h \
@@ -1213,11 +1218,6 @@ common/json-schema-to-grammar.o: \
12131218
common/json-schema-to-grammar.h
12141219
$(CXX) $(CXXFLAGS) -c $< -o $@
12151220

1216-
common/train.o: \
1217-
common/train.cpp \
1218-
common/train.h
1219-
$(CXX) $(CXXFLAGS) -c $< -o $@
1220-
12211221
common/ngram-cache.o: \
12221222
common/ngram-cache.cpp \
12231223
common/ngram-cache.h
@@ -1390,11 +1390,6 @@ llama-bench: examples/llama-bench/llama-bench.cpp \
13901390
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
13911391
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
13921392

1393-
llama-baby-llama: examples/baby-llama/baby-llama.cpp \
1394-
$(OBJ_ALL)
1395-
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
1396-
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
1397-
13981393
llama-export-lora: examples/export-lora/export-lora.cpp \
13991394
$(OBJ_ALL)
14001395
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var sources = [
1010
"src/unicode.cpp",
1111
"src/unicode-data.cpp",
1212
"ggml/src/ggml.c",
13+
"ggml/src/ggml-cpu.c",
1314
"ggml/src/ggml-alloc.c",
1415
"ggml/src/ggml-backend.cpp",
1516
"ggml/src/ggml-quants.c",

cmake/arm64-apple-clang.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
set( CMAKE_SYSTEM_NAME Darwin )
2+
set( CMAKE_SYSTEM_PROCESSOR arm64 )
3+
4+
set( target arm64-apple-darwin-macho )
5+
6+
set( CMAKE_C_COMPILER clang )
7+
set( CMAKE_CXX_COMPILER clang++ )
8+
9+
set( CMAKE_C_COMPILER_TARGET ${target} )
10+
set( CMAKE_CXX_COMPILER_TARGET ${target} )
11+
12+
set( arch_c_flags "-march=armv8.4-a -fvectorize -ffp-model=fast -fno-finite-math-only" )
13+
set( warn_c_flags "-Wno-format -Wno-unused-variable -Wno-unused-function" )
14+
15+
set( CMAKE_C_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}" )
16+
set( CMAKE_CXX_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}" )

common/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ add_library(${TARGET} STATIC
7676
ngram-cache.h
7777
sampling.cpp
7878
sampling.h
79-
train.cpp
80-
train.h
8179
)
8280

8381
if (BUILD_SHARED_LIBS)

common/common.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,6 +1951,8 @@ void yaml_dump_string_multiline(FILE * stream, const char * prop_name, const cha
19511951

19521952
void yaml_dump_non_result_info(FILE * stream, const common_params & params, const llama_context * lctx,
19531953
const std::string & timestamp, const std::vector<int> & prompt_tokens, const char * model_desc) {
1954+
ggml_cpu_init(); // some ARM features are detected at runtime
1955+
19541956
const auto & sparams = params.sparams;
19551957

19561958
fprintf(stream, "build_commit: %s\n", LLAMA_COMMIT);

0 commit comments

Comments
 (0)