Skip to content

Commit 15f5d96

Browse files
authored
build : fix build info generation and cleanup Makefile (#3920)
* cmake : fix joining of REAL_GIT_DIR * fix includes with help from include-what-you-use * make : remove unneeded deps and add test-rope target * fix C includes in C++ source files * Revert "fix includes with help from include-what-you-use" This reverts commit 635e9fa.
1 parent 33c9892 commit 15f5d96

File tree

5 files changed

+37
-31
lines changed

5 files changed

+37
-31
lines changed

.gitignore

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,16 @@ poetry.lock
8888
poetry.toml
8989

9090
# Test binaries
91-
tests/test-grammar-parser
92-
tests/test-llama-grammar
93-
tests/test-double-float
94-
tests/test-grad0
95-
tests/test-opt
96-
tests/test-quantize-fns
97-
tests/test-quantize-perf
98-
tests/test-sampling
99-
tests/test-tokenizer-0-llama
100-
tests/test-tokenizer-0-falcon
101-
tests/test-tokenizer-1-llama
102-
tests/test-tokenizer-1-bpe
91+
/tests/test-grammar-parser
92+
/tests/test-llama-grammar
93+
/tests/test-double-float
94+
/tests/test-grad0
95+
/tests/test-opt
96+
/tests/test-quantize-fns
97+
/tests/test-quantize-perf
98+
/tests/test-sampling
99+
/tests/test-tokenizer-0-llama
100+
/tests/test-tokenizer-0-falcon
101+
/tests/test-tokenizer-1-llama
102+
/tests/test-tokenizer-1-bpe
103+
/tests/test-rope

Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ BUILD_TARGETS = \
88
TEST_TARGETS = \
99
tests/test-llama-grammar tests/test-grammar-parser tests/test-double-float tests/test-grad0 tests/test-opt \
1010
tests/test-quantize-fns tests/test-quantize-perf tests/test-sampling tests/test-tokenizer-0-llama \
11-
tests/test-tokenizer-0-falcon tests/test-tokenizer-1-llama tests/test-tokenizer-1-bpe
11+
tests/test-tokenizer-0-falcon tests/test-tokenizer-1-llama tests/test-tokenizer-1-bpe tests/test-rope
1212

1313
# Code coverage output files
1414
COV_TARGETS = *.gcno tests/*.gcno *.gcda tests/*.gcda *.gcov tests/*.gcov lcov-report gcovr-report
@@ -648,7 +648,7 @@ beam-search: examples/beam-search/beam-search.cpp ggml.o llama.o $(COMMON_DEPS)
648648
finetune: examples/finetune/finetune.cpp ggml.o llama.o $(COMMON_DEPS) train.o $(OBJS)
649649
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
650650

651-
export-lora: examples/export-lora/export-lora.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
651+
export-lora: examples/export-lora/export-lora.cpp ggml.o common/common.h $(OBJS)
652652
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
653653

654654
speculative: examples/speculative/speculative.cpp ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
@@ -701,28 +701,28 @@ vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
701701
q8dot: pocs/vdot/q8dot.cpp ggml.o $(OBJS)
702702
$(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
703703

704-
tests/test-llama-grammar: tests/test-llama-grammar.cpp ggml.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
704+
tests/test-llama-grammar: tests/test-llama-grammar.cpp ggml.o grammar-parser.o $(OBJS)
705705
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
706706

707-
tests/test-grammar-parser: tests/test-grammar-parser.cpp ggml.o llama.o $(COMMON_DEPS) grammar-parser.o $(OBJS)
707+
tests/test-grammar-parser: tests/test-grammar-parser.cpp ggml.o llama.o grammar-parser.o $(OBJS)
708708
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
709709

710-
tests/test-double-float: tests/test-double-float.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
710+
tests/test-double-float: tests/test-double-float.cpp ggml.o $(OBJS)
711711
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
712712

713-
tests/test-grad0: tests/test-grad0.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
713+
tests/test-grad0: tests/test-grad0.cpp ggml.o $(OBJS)
714714
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
715715

716-
tests/test-opt: tests/test-opt.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
716+
tests/test-opt: tests/test-opt.cpp ggml.o $(OBJS)
717717
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
718718

719-
tests/test-quantize-fns: tests/test-quantize-fns.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
719+
tests/test-quantize-fns: tests/test-quantize-fns.cpp ggml.o $(OBJS)
720720
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
721721

722-
tests/test-quantize-perf: tests/test-quantize-perf.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
722+
tests/test-quantize-perf: tests/test-quantize-perf.cpp ggml.o $(OBJS)
723723
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
724724

725-
tests/test-sampling: tests/test-sampling.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
725+
tests/test-sampling: tests/test-sampling.cpp ggml.o llama.o $(OBJS)
726726
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
727727

728728
tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
@@ -737,5 +737,8 @@ tests/test-tokenizer-1-bpe: tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMM
737737
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
738738
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
739739

740+
tests/test-rope: tests/test-rope.cpp ggml.o $(OBJS)
741+
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
742+
740743
tests/test-c.o: tests/test-c.c llama.h
741744
$(CC) $(CFLAGS) -c $(filter-out %.h,$^) -o $@

common/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git")
1111
if(NOT IS_DIRECTORY "${GIT_DIR}")
1212
file(READ ${GIT_DIR} REAL_GIT_DIR_LINK)
1313
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" REAL_GIT_DIR ${REAL_GIT_DIR_LINK})
14-
set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${REAL_GIT_DIR}")
14+
string(FIND "${REAL_GIT_DIR}" "/" SLASH_POS)
15+
if (SLASH_POS EQUAL 0)
16+
set(GIT_DIR "${REAL_GIT_DIR}")
17+
else()
18+
set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${REAL_GIT_DIR}")
19+
endif()
1520
endif()
1621

1722
set(GIT_INDEX "${GIT_DIR}/index")

ggml-opencl.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1+
#include "ggml.h"
12
#include "ggml-opencl.h"
23

34
#include <array>
45
#include <atomic>
6+
#include <cstdio>
7+
#include <cstdlib>
8+
#include <cstring>
9+
#include <limits>
510
#include <sstream>
611
#include <vector>
7-
#include <limits>
812

913
#define CL_TARGET_OPENCL_VERSION 110
1014
#include <clblast.h>
1115

12-
#include <stdlib.h>
13-
#include <stdio.h>
14-
#include <string.h>
15-
16-
#include "ggml.h"
17-
1816
#if defined(_MSC_VER)
1917
#pragma warning(disable: 4244 4267) // possible loss of data
2018
#endif

llama.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#endif
4747
#include <windows.h>
4848
#include <io.h>
49-
#include <stdio.h> // for _fseeki64
5049
#endif
5150

5251
#include <algorithm>

0 commit comments

Comments
 (0)