Skip to content

Commit 2e6cd4b

Browse files
0cc4mJohannesGaesslerSlyEcho
authored
OpenCL Token Generation Acceleration (#1459)
* Move back to C++ for OpenCL * Refactor OpenCL code to work more like the CUDA code, add missing functions * Deduplicate dequant kernels * Add OpenCL compile options * Use compile args for preprocessing constants * Restore default platform + device selection by id behavior --------- Co-authored-by: Johannes Gäßler <[email protected]> Co-authored-by: Henri Vasserman <[email protected]>
1 parent 7e4ea5b commit 2e6cd4b

File tree

8 files changed

+1113
-536
lines changed

8 files changed

+1113
-536
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ if (LLAMA_CLBLAST)
201201
if (CLBlast_FOUND)
202202
message(STATUS "CLBlast found")
203203

204-
set(GGML_OPENCL_SOURCES ggml-opencl.c ggml-opencl.h)
204+
set(GGML_OPENCL_SOURCES ggml-opencl.cpp ggml-opencl.h)
205205

206206
add_compile_definitions(GGML_USE_CLBLAST)
207207

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,16 @@ ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
138138
endif
139139
ifdef LLAMA_CLBLAST
140140
CFLAGS += -DGGML_USE_CLBLAST
141+
CXXFLAGS += -DGGML_USE_CLBLAST
141142
# Mac provides OpenCL as a framework
142143
ifeq ($(UNAME_S),Darwin)
143144
LDFLAGS += -lclblast -framework OpenCL
144145
else
145146
LDFLAGS += -lclblast -lOpenCL
146147
endif
147148
OBJS += ggml-opencl.o
148-
ggml-opencl.o: ggml-opencl.c ggml-opencl.h
149-
$(CC) $(CFLAGS) -c $< -o $@
149+
ggml-opencl.o: ggml-opencl.cpp ggml-opencl.h
150+
$(CXX) $(CXXFLAGS) -c $< -o $@
150151
endif
151152
ifneq ($(filter aarch64%,$(UNAME_M)),)
152153
# Apple M1, M2, etc.

0 commit comments

Comments
 (0)