Skip to content

Commit 165beb0

Browse files
committed
move public backend headers to the public include directory
1 parent 3c1532e commit 165beb0

16 files changed

+47
-45
lines changed

.github/labeler.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
Kompute:
33
- changed-files:
44
- any-glob-to-any-file:
5-
- ggml/src/ggml-kompute.h
5+
- ggml/include/ggml-kompute.h
66
- ggml/src/ggml-kompute.cpp
77
- README-kompute.md
88
Apple Metal:
99
- changed-files:
1010
- any-glob-to-any-file:
11-
- ggml/src/ggml-metal.h
11+
- ggml/include/ggml-metal.h
1212
- ggml/src/ggml-metal.cpp
1313
- README-metal.md
1414
SYCL:
1515
- changed-files:
1616
- any-glob-to-any-file:
17-
- ggml/src/ggml-sycl.h
17+
- ggml/include/ggml-sycl.h
1818
- ggml/src/ggml-sycl.cpp
1919
- README-sycl.md
2020
Nvidia GPU:
2121
- changed-files:
2222
- any-glob-to-any-file:
23-
- ggml/src/ggml-cuda.h
23+
- ggml/include/ggml-cuda.h
2424
- ggml/src/ggml-cuda/**
2525
Vulkan:
2626
- changed-files:

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ ggml/src/ggml-cuda/%.o: \
680680

681681
ggml/src/ggml-cuda.o: \
682682
ggml/src/ggml-cuda.cu \
683-
ggml/src/ggml-cuda.h \
683+
ggml/include/ggml-cuda.h \
684684
ggml/include/ggml.h \
685685
ggml/include/ggml-backend.h \
686686
ggml/src/ggml-backend-impl.h \
@@ -716,7 +716,7 @@ endif
716716

717717
ggml/src/ggml-vulkan.o: \
718718
ggml/src/ggml-vulkan.cpp \
719-
ggml/src/ggml-vulkan.h
719+
ggml/include/ggml-vulkan.h
720720
$(CXX) $(CXXFLAGS) -c $< -o $@
721721
endif # GGML_VULKAN
722722

@@ -764,7 +764,7 @@ endif # GGML_CUDA_NO_PEER_COPY
764764

765765
ggml/src/ggml-cuda.o: \
766766
ggml/src/ggml-cuda.cu \
767-
ggml/src/ggml-cuda.h \
767+
ggml/include/ggml-cuda.h \
768768
ggml/include/ggml.h \
769769
ggml/include/ggml-backend.h \
770770
ggml/src/ggml-backend-impl.h \
@@ -796,7 +796,7 @@ endif # GGML_METAL
796796
ifdef GGML_METAL
797797
ggml/src/ggml-metal.o: \
798798
ggml/src/ggml-metal.m \
799-
ggml/src/ggml-metal.h \
799+
ggml/include/ggml-metal.h \
800800
ggml/include/ggml.h
801801
$(CC) $(CFLAGS) -c $< -o $@
802802

@@ -957,7 +957,7 @@ ggml/src/ggml-quants.o: \
957957

958958
ggml/src/ggml-blas.o: \
959959
ggml/src/ggml-blas.cpp \
960-
ggml/src/ggml-blas.h
960+
ggml/include/ggml-blas.h
961961
$(CXX) $(CXXFLAGS) -c $< -o $@
962962

963963
ifndef GGML_NO_LLAMAFILE
@@ -971,7 +971,7 @@ endif # GGML_NO_LLAMAFILE
971971
ifdef GGML_RPC
972972
ggml/src/ggml-rpc.o: \
973973
ggml/src/ggml-rpc.cpp \
974-
ggml/src/ggml-rpc.h
974+
ggml/include/ggml-rpc.h
975975
$(CXX) $(CXXFLAGS) -c $< -o $@
976976
endif # GGML_RPC
977977

@@ -999,8 +999,8 @@ src/llama.o: \
999999
src/llama.cpp \
10001000
src/unicode.h \
10011001
include/llama.h \
1002-
ggml/src/ggml-cuda.h \
1003-
ggml/src/ggml-metal.h \
1002+
ggml/include/ggml-cuda.h \
1003+
ggml/include/ggml-metal.h \
10041004
ggml/include/ggml.h \
10051005
ggml/include/ggml-alloc.h \
10061006
ggml/include/ggml-backend.h
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ggml/src/ggml-sycl.h renamed to ggml/include/ggml-sycl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#include "ggml.h"
1010
#include "ggml-backend.h"
11-
#include "ggml-sycl/presets.hpp"
11+
12+
#define GGML_SYCL_NAME "SYCL"
13+
#define GGML_SYCL_MAX_DEVICES 48
1214

1315
#ifdef __cplusplus
1416
extern "C" {
File renamed without changes.

ggml/src/CMakeLists.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if (GGML_METAL)
4747
find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
4848

4949
message(STATUS "Metal framework found")
50-
set(GGML_HEADERS_METAL ggml-metal.h)
50+
set(GGML_HEADERS_METAL ../include/ggml-metal.h)
5151
set(GGML_SOURCES_METAL ggml-metal.m)
5252

5353
list(APPEND GGML_CDEF_PUBLIC GGML_USE_METAL)
@@ -225,7 +225,7 @@ if (GGML_BLAS)
225225
add_compile_definitions(GGML_BLAS_USE_MKL)
226226
endif()
227227

228-
set(GGML_HEADERS_BLAS ggml-blas.h)
228+
set(GGML_HEADERS_BLAS ../include/ggml-blas.h)
229229
set(GGML_SOURCES_BLAS ggml-blas.cpp)
230230

231231
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ${BLAS_LIBRARIES})
@@ -271,7 +271,7 @@ if (GGML_CUDA)
271271
enable_language(CUDA)
272272

273273
file(GLOB GGML_HEADERS_CUDA "ggml-cuda/*.cuh")
274-
list(APPEND GGML_HEADERS_CUDA "ggml-cuda.h")
274+
list(APPEND GGML_HEADERS_CUDA "../include/ggml-cuda.h")
275275

276276
file(GLOB GGML_SOURCES_CUDA "ggml-cuda/*.cu")
277277
list(APPEND GGML_SOURCES_CUDA "ggml-cuda.cu")
@@ -396,7 +396,7 @@ if (GGML_HIPBLAS)
396396
message(STATUS "HIP and hipBLAS found")
397397

398398
file(GLOB GGML_HEADERS_ROCM "ggml-cuda/*.cuh")
399-
list(APPEND GGML_HEADERS_ROCM "ggml-cuda.h")
399+
list(APPEND GGML_HEADERS_ROCM "../include/ggml-cuda.h")
400400

401401
file(GLOB GGML_SOURCES_ROCM "ggml-cuda/*.cu")
402402
list(APPEND GGML_SOURCES_ROCM "ggml-cuda.cu")
@@ -489,7 +489,7 @@ if (GGML_SYCL)
489489
endif()
490490

491491
file(GLOB GGML_HEADERS_SYCL "ggml-sycl/*.hpp")
492-
list(APPEND GGML_HEADERS_SYCL "ggml-sycl.h")
492+
list(APPEND GGML_HEADERS_SYCL "../include/ggml-sycl.h")
493493

494494
file(GLOB GGML_SOURCES_SYCL "ggml-sycl/*.cpp")
495495
list(APPEND GGML_SOURCES_SYCL "ggml-sycl.cpp")
@@ -517,7 +517,7 @@ if (GGML_RPC)
517517
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ws2_32)
518518
endif()
519519

520-
set(GGML_HEADERS_RPC ggml-rpc.h)
520+
set(GGML_HEADERS_RPC ../include/ggml-rpc.h)
521521
set(GGML_SOURCES_RPC ggml-rpc.cpp)
522522
endif()
523523

@@ -527,7 +527,7 @@ if (GGML_VULKAN)
527527
if (Vulkan_FOUND)
528528
message(STATUS "Vulkan found")
529529

530-
set(GGML_HEADERS_VULKAN ggml-vulkan.h)
530+
set(GGML_HEADERS_VULKAN ../include/ggml-vulkan.h)
531531
set(GGML_SOURCES_VULKAN ggml-vulkan.cpp)
532532

533533
list(APPEND GGML_CDEF_PUBLIC GGML_USE_VULKAN)
@@ -712,8 +712,8 @@ if (GGML_KOMPUTE)
712712
)
713713

714714
# Add the stamp to the main sources to ensure dependency tracking
715-
set(GGML_SOURCES_KOMPUTE ggml-kompute.cpp ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp)
716-
set(GGML_HEADERS_KOMPUTE ggml-kompute.h ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp)
715+
set(GGML_SOURCES_KOMPUTE ggml-kompute.cpp ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp)
716+
set(GGML_HEADERS_KOMPUTE ../include/ggml-kompute.h ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp)
717717

718718
list(APPEND GGML_CDEF_PUBLIC GGML_USE_KOMPUTE)
719719

@@ -1155,8 +1155,9 @@ if (EMSCRIPTEN)
11551155
endif()
11561156

11571157
target_compile_definitions(ggml PUBLIC ${GGML_CDEF_PUBLIC})
1158-
target_include_directories(ggml PUBLIC . ../include ${GGML_EXTRA_INCLUDES})
1159-
target_compile_features (ggml PUBLIC c_std_11) # don't bump
1158+
target_include_directories(ggml PUBLIC ../include)
1159+
target_include_directories(ggml PRIVATE . ${GGML_EXTRA_INCLUDES})
1160+
target_compile_features (ggml PRIVATE c_std_11) # don't bump
11601161

11611162
target_link_libraries(ggml PRIVATE Threads::Threads ${GGML_EXTRA_LIBS})
11621163

ggml/src/ggml-sycl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "ggml-backend-impl.h"
3838

3939
#include "ggml-sycl/backend.hpp"
40+
#include "ggml-sycl/presets.hpp"
4041

4142
bool ggml_sycl_loaded(void);
4243
void ggml_sycl_free_data(struct ggml_tensor * tensor);

ggml/src/ggml-sycl/common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <iostream>
1818

1919
#include "dpct/helper.hpp"
20+
#include "ggml-sycl.h"
2021
#include "presets.hpp"
2122

2223
#define GGML_COMMON_DECL_SYCL

ggml/src/ggml-sycl/presets.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#define GGML_SYCL_MAX_STREAMS 8
1717
#define GGML_SYCL_MAX_BUFFERS 256
18-
#define GGML_SYCL_MAX_DEVICES 48
19-
#define GGML_SYCL_NAME "SYCL"
2018

2119
#define WARP_SIZE 32
2220
#define MATRIX_ROW_PADDING 512 // last row of quant. matrices is a multiple of this to avoid out-of-bounds memory accesses

scripts/sync-ggml-am.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,24 @@ if [ -f $SRC_LLAMA/ggml-src.patch ]; then
107107
# src/ggml-common.h -> ggml/src/ggml-common.h
108108
# src/ggml-cuda/* -> ggml/src/ggml-cuda/
109109
# src/ggml-cuda.cu -> ggml/src/ggml-cuda.cu
110-
# src/ggml-cuda.h -> ggml/src/ggml-cuda.h
111110
# src/ggml-impl.h -> ggml/src/ggml-impl.h
112111
# src/ggml-kompute.cpp -> ggml/src/ggml-kompute.cpp
113-
# src/ggml-kompute.h -> ggml/src/ggml-kompute.h
114-
# src/ggml-metal.h -> ggml/src/ggml-metal.h
115112
# src/ggml-metal.m -> ggml/src/ggml-metal.m
116113
# src/ggml-quants.c -> ggml/src/ggml-quants.c
117114
# src/ggml-quants.h -> ggml/src/ggml-quants.h
118115
# src/ggml-rpc.cpp -> ggml/src/ggml-rpc.cpp
119-
# src/ggml-rpc.h -> ggml/src/ggml-rpc.h
120116
# src/ggml-sycl.cpp -> ggml/src/ggml-sycl.cpp
121-
# src/ggml-sycl.h -> ggml/src/ggml-sycl.h
122117
# src/ggml-vulkan.cpp -> ggml/src/ggml-vulkan.cpp
123-
# src/ggml-vulkan.h -> ggml/src/ggml-vulkan.h
124118
#
125119
# include/ggml/ggml.h -> ggml/include/ggml.h
126120
# include/ggml/ggml-alloc.h -> ggml/include/ggml-alloc.h
127121
# include/ggml/ggml-backend.h -> ggml/include/ggml-backend.h
122+
# include/ggml-cuda.h -> ggml/include/ggml-cuda.h
123+
# include/ggml-kompute.h -> ggml/include/ggml-kompute.h
124+
# include/ggml-metal.h -> ggml/include/ggml-metal.h
125+
# include/ggml-rpc.h -> ggml/include/ggml-rpc.h
126+
# include/ggml-sycl.h -> ggml/include/ggml-sycl.h
127+
# include/ggml-vulkan.h -> ggml/include/ggml-vulkan.h
128128
#
129129
# tests/test-opt.cpp -> tests/test-opt.cpp
130130
# tests/test-grad0.cpp -> tests/test-grad0.cpp
@@ -146,20 +146,20 @@ if [ -f $SRC_LLAMA/ggml-src.patch ]; then
146146
-e 's/src\/ggml-common\.h/ggml/src/ggml-common.h/g' \
147147
-e 's/src\/ggml-cuda\//ggml-cuda\//g' \
148148
-e 's/src\/ggml-cuda\.cu/ggml/src/ggml-cuda.cu/g' \
149-
-e 's/src\/ggml-cuda\.h/ggml/src/ggml-cuda.h/g' \
150149
-e 's/src\/ggml-impl\.h/ggml/src/ggml-impl.h/g' \
151150
-e 's/src\/ggml-kompute\.cpp/ggml/src/ggml-kompute.cpp/g' \
152-
-e 's/src\/ggml-kompute\.h/ggml/src/ggml-kompute.h/g' \
153-
-e 's/src\/ggml-metal\.h/ggml/src/ggml-metal.h/g' \
154151
-e 's/src\/ggml-metal\.m/ggml/src/ggml-metal.m/g' \
155152
-e 's/src\/ggml-quants\.c/ggml/src/ggml-quants.c/g' \
156153
-e 's/src\/ggml-quants\.h/ggml/src/ggml-quants.h/g' \
157154
-e 's/src\/ggml-rpc\.cpp/ggml/src/ggml-rpc.cpp/g' \
158-
-e 's/src\/ggml-rpc\.h/ggml/src/ggml-rpc.h/g' \
159155
-e 's/src\/ggml-sycl\.cpp/ggml/src/ggml-sycl.cpp/g' \
160-
-e 's/src\/ggml-sycl\.h/ggml/src/ggml-sycl.h/g' \
161156
-e 's/src\/ggml-vulkan\.cpp/ggml/src/ggml-vulkan.cpp/g' \
162-
-e 's/src\/ggml-vulkan\.h/ggml/src/ggml-vulkan.h/g' \
157+
-e 's/include\/ggml-cuda\.h/ggml/include/ggml-cuda.h/g' \
158+
-e 's/include\/ggml-kompute\.h/ggml/include/ggml-kompute.h/g' \
159+
-e 's/include\/ggml-metal\.h/ggml/include/ggml-metal.h/g' \
160+
-e 's/include\/ggml-rpc\.h/ggml/include/ggml-rpc.h/g' \
161+
-e 's/include\/ggml-sycl\.h/ggml/include/ggml-sycl.h/g' \
162+
-e 's/include\/ggml-vulkan\.h/ggml/include/ggml-vulkan.h/g' \
163163
-e 's/include\/ggml\/ggml\.h/ggml/include/ggml.h/g' \
164164
-e 's/include\/ggml\/ggml-alloc\.h/ggml/include/ggml-alloc.h/g' \
165165
-e 's/include\/ggml\/ggml-backend\.h/ggml/include/ggml-backend.h/g' \

scripts/sync-ggml.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ cp -rpv ../ggml/src/ggml-backend.c ./ggml/src/ggml-backend.c
1111
cp -rpv ../ggml/src/ggml-common.h ./ggml/src/ggml-common.h
1212
cp -rpv ../ggml/src/ggml-cuda/* ./ggml/src/ggml-cuda/
1313
cp -rpv ../ggml/src/ggml-cuda.cu ./ggml/src/ggml-cuda.cu
14-
cp -rpv ../ggml/src/ggml-cuda.h ./ggml/src/ggml-cuda.h
1514
cp -rpv ../ggml/src/ggml-impl.h ./ggml/src/ggml-impl.h
1615
cp -rpv ../ggml/src/ggml-kompute.cpp ./ggml/src/ggml-kompute.cpp
17-
cp -rpv ../ggml/src/ggml-kompute.h ./ggml/src/ggml-kompute.h
18-
cp -rpv ../ggml/src/ggml-metal.h ./ggml/src/ggml-metal.h
1916
cp -rpv ../ggml/src/ggml-metal.m ./ggml/src/ggml-metal.m
2017
cp -rpv ../ggml/src/ggml-metal.metal ./ggml/src/ggml-metal.metal
2118
cp -rpv ../ggml/src/ggml-quants.c ./ggml/src/ggml-quants.c
2219
cp -rpv ../ggml/src/ggml-quants.h ./ggml/src/ggml-quants.h
2320
cp -rpv ../ggml/src/ggml-rpc.cpp ./ggml/src/ggml-rpc.cpp
24-
cp -rpv ../ggml/src/ggml-rpc.h ./ggml/src/ggml-rpc.h
2521
cp -rpv ../ggml/src/ggml-sycl.cpp ./ggml/src/ggml-sycl.cpp
26-
cp -rpv ../ggml/src/ggml-sycl.h ./ggml/src/ggml-sycl.h
2722
cp -rpv ../ggml/src/ggml-vulkan.cpp ./ggml/src/ggml-vulkan.cpp
28-
cp -rpv ../ggml/src/ggml-vulkan.h ./ggml/src/ggml-vulkan.h
2923

3024
cp -rpv ../ggml/include/ggml.h ./ggml/include/ggml.h
3125
cp -rpv ../ggml/include/ggml-alloc.h ./ggml/include/ggml-alloc.h
3226
cp -rpv ../ggml/include/ggml-backend.h ./ggml/include/ggml-backend.h
27+
cp -rpv ../ggml/include/ggml-cuda.h ./ggml/include/ggml-cuda.h
28+
cp -rpv ../ggml/include/ggml-kompute.h ./ggml/include/ggml-kompute.h
29+
cp -rpv ../ggml/include/ggml-metal.h ./ggml/include/ggml-metal.h
30+
cp -rpv ../ggml/include/ggml-rpc.h ./ggml/include/ggml-rpc.h
31+
cp -rpv ../ggml/include/ggml-sycl.h ./ggml/include/ggml-sycl.h
32+
cp -rpv ../ggml/include/ggml-vulkan.h ./ggml/include/ggml-vulkan.h
3333

3434
cp -rpv ../ggml/tests/test-opt.cpp ./tests/test-opt.cpp
3535
cp -rpv ../ggml/tests/test-grad0.cpp ./tests/test-grad0.cpp

tests/test-backend-ops.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <ggml.h>
22
#include <ggml-alloc.h>
33
#include <ggml-backend.h>
4-
#include <ggml-backend-impl.h>
54

65
#include <algorithm>
76
#include <array>

0 commit comments

Comments
 (0)