Skip to content

Commit 346f64f

Browse files
committed
Revert "ggml : remove OpenCL (ggml-org#7735) + (ggml-org#8235)"
Manually adjusted. This reverts commit 554c247. This reverts commit 257f8e4. Signed-off-by: David Heidelberg <[email protected]>
1 parent 8cd1bcf commit 346f64f

File tree

23 files changed

+2645
-25
lines changed

23 files changed

+2645
-25
lines changed

.devops/nix/package.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@
1818
vulkan-headers,
1919
vulkan-loader,
2020
curl,
21+
clblast,
2122
shaderc,
2223
useBlas ? builtins.all (x: !x) [
2324
useCuda
2425
useMetalKit
26+
useOpenCL
2527
useRocm
2628
useVulkan
2729
] && blas.meta.available,
2830
useCuda ? config.cudaSupport,
29-
useMetalKit ? stdenv.isAarch64 && stdenv.isDarwin,
31+
useMetalKit ? stdenv.isAarch64 && stdenv.isDarwin && !useOpenCL,
3032
useMpi ? false, # Increases the runtime closure size by ~700M
33+
useOpenCL ? false,
3134
useRocm ? config.rocmSupport,
3235
enableCurl ? true,
3336
useVulkan ? false,
@@ -56,6 +59,7 @@ let
5659
++ lib.optionals useCuda [ "CUDA" ]
5760
++ lib.optionals useMetalKit [ "MetalKit" ]
5861
++ lib.optionals useMpi [ "MPI" ]
62+
++ lib.optionals useOpenCL [ "OpenCL" ]
5963
++ lib.optionals useRocm [ "ROCm" ]
6064
++ lib.optionals useVulkan [ "Vulkan" ];
6165

@@ -207,6 +211,7 @@ effectiveStdenv.mkDerivation (
207211
optionals effectiveStdenv.isDarwin darwinBuildInputs
208212
++ optionals useCuda cudaBuildInputs
209213
++ optionals useMpi [ mpi ]
214+
++ optionals useOpenCL [ clblast ]
210215
++ optionals useRocm rocmBuildInputs
211216
++ optionals useBlas [ blas ]
212217
++ optionals useVulkan vulkanBuildInputs
@@ -220,6 +225,7 @@ effectiveStdenv.mkDerivation (
220225
(cmakeBool "LLAMA_CURL" enableCurl)
221226
(cmakeBool "GGML_NATIVE" false)
222227
(cmakeBool "GGML_BLAS" useBlas)
228+
(cmakeBool "GGML_CLBLAST" useOpenCL)
223229
(cmakeBool "GGML_CUDA" useCuda)
224230
(cmakeBool "GGML_HIPBLAS" useRocm)
225231
(cmakeBool "GGML_METAL" useMetalKit)
@@ -263,6 +269,7 @@ effectiveStdenv.mkDerivation (
263269
useCuda
264270
useMetalKit
265271
useMpi
272+
useOpenCL
266273
useRocm
267274
useVulkan
268275
;
@@ -289,7 +296,7 @@ effectiveStdenv.mkDerivation (
289296
# Configurations we don't want even the CI to evaluate. Results in the
290297
# "unsupported platform" messages. This is mostly a no-op, because
291298
# cudaPackages would've refused to evaluate anyway.
292-
badPlatforms = optionals useCuda lib.platforms.darwin;
299+
badPlatforms = optionals (useCuda || useOpenCL) lib.platforms.darwin;
293300

294301
# Configurations that are known to result in build failures. Can be
295302
# overridden by importing Nixpkgs with `allowBroken = true`.

.github/workflows/build.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,8 @@ jobs:
690690

691691
env:
692692
OPENBLAS_VERSION: 0.3.23
693+
OPENCL_VERSION: 2023.04.17
694+
CLBLAST_VERSION: 1.6.0
693695
SDE_VERSION: 9.33.0-2024-01-07
694696
VULKAN_VERSION: 1.3.261.1
695697

@@ -706,6 +708,8 @@ jobs:
706708
defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
707709
- build: 'avx512-x64'
708710
defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_AVX512=ON -DBUILD_SHARED_LIBS=ON'
711+
- build: 'clblast-x64'
712+
defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CLBLAST=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/clblast"'
709713
- build: 'openblas-x64'
710714
defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_BLAS=ON -DBUILD_SHARED_LIBS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
711715
- build: 'kompute-x64'
@@ -730,6 +734,27 @@ jobs:
730734
run: |
731735
git submodule update --init ggml/src/kompute
732736
737+
- name: Download OpenCL SDK
738+
id: get_opencl
739+
if: ${{ matrix.build == 'clblast-x64' }}
740+
run: |
741+
curl.exe -o $env:RUNNER_TEMP/opencl.zip -L "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v${env:OPENCL_VERSION}/OpenCL-SDK-v${env:OPENCL_VERSION}-Win-x64.zip"
742+
mkdir $env:RUNNER_TEMP/opencl
743+
tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl
744+
745+
- name: Download CLBlast
746+
id: get_clblast
747+
if: ${{ matrix.build == 'clblast-x64' }}
748+
run: |
749+
curl.exe -o $env:RUNNER_TEMP/clblast.7z -L "https://github.com/CNugteren/CLBlast/releases/download/${env:CLBLAST_VERSION}/CLBlast-${env:CLBLAST_VERSION}-windows-x64.7z"
750+
curl.exe -o $env:RUNNER_TEMP/CLBlast.LICENSE.txt -L "https://github.com/CNugteren/CLBlast/raw/${env:CLBLAST_VERSION}/LICENSE"
751+
7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/clblast.7z
752+
rename-item $env:RUNNER_TEMP/CLBlast-${env:CLBLAST_VERSION}-windows-x64 clblast
753+
foreach ($f in (gci -Recurse -Path "$env:RUNNER_TEMP/clblast" -Filter '*.cmake')) {
754+
$txt = Get-Content -Path $f -Raw
755+
$txt.Replace('C:/vcpkg/packages/opencl_x64-windows/', "$($env:RUNNER_TEMP.Replace('\','/'))/opencl/") | Set-Content -Path $f -Encoding UTF8
756+
}
757+
733758
- name: Download OpenBLAS
734759
id: get_openblas
735760
if: ${{ matrix.build == 'openblas-x64' }}
@@ -763,6 +788,13 @@ jobs:
763788
cmake -S . -B build ${{ matrix.defines }}
764789
cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
765790
791+
- name: Add clblast.dll
792+
id: add_clblast_dll
793+
if: ${{ matrix.build == 'clblast-x64' }}
794+
run: |
795+
cp $env:RUNNER_TEMP/clblast/lib/clblast.dll ./build/bin/Release
796+
cp $env:RUNNER_TEMP/CLBlast.LICENSE.txt ./build/bin/Release/CLBlast-${env:CLBLAST_VERSION}.txt
797+
766798
- name: Add libopenblas.dll
767799
id: add_libopenblas_dll
768800
if: ${{ matrix.build == 'openblas-x64' }}
@@ -786,7 +818,7 @@ jobs:
786818
- name: Test
787819
id: cmake_test
788820
# not all machines have native AVX-512
789-
if: ${{ matrix.build != 'msvc-arm64' && matrix.build != 'llvm-arm64' && matrix.build != 'kompute-x64' && matrix.build != 'vulkan-x64' && (matrix.build != 'avx512-x64' || env.HAS_AVX512F == '1') }}
821+
if: ${{ matrix.build != 'msvc-arm64' && matrix.build != 'llvm-arm64' && matrix.build != 'clblast-x64' && matrix.build != 'kompute-x64' && matrix.build != 'vulkan-x64' && (matrix.build != 'avx512-x64' || env.HAS_AVX512F == '1') }}
790822
run: |
791823
cd build
792824
ctest -L main -C Release --verbose --timeout 900
@@ -1044,7 +1076,7 @@ jobs:
10441076
# hypervisor: 'qemu'
10451077
# run: |
10461078
# sudo pkg update
1047-
# sudo pkg install -y gmake automake autoconf pkgconf llvm15 openblas
1079+
# sudo pkg install -y gmake automake autoconf pkgconf llvm15 clinfo clover opencl clblast openblas
10481080
# gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j `sysctl -n hw.ncpu`
10491081

10501082
release:

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ endif()
4242

4343
option(BUILD_SHARED_LIBS "build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
4444

45+
set(LLAMA_BLAS_VENDOR "Generic" CACHE STRING "llama: BLAS library vendor")
46+
option(GGML_CLBLAST "llama: use CLBlast" OFF)
47+
48+
4549
if (WIN32)
4650
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
4751
endif()
@@ -102,6 +106,7 @@ llama_option_depr(WARNING LLAMA_CUDA GGML_CUDA)
102106
llama_option_depr(WARNING LLAMA_KOMPUTE GGML_KOMPUTE)
103107
llama_option_depr(WARNING LLAMA_METAL GGML_METAL)
104108
llama_option_depr(WARNING LLAMA_METAL_EMBED_LIBRARY GGML_METAL_EMBED_LIBRARY)
109+
llama_option_depr(WARNING LLAMA_CLBLAST GGML_CLBLAST)
105110
llama_option_depr(WARNING LLAMA_NATIVE GGML_NATIVE)
106111
llama_option_depr(WARNING LLAMA_RPC GGML_RPC)
107112
llama_option_depr(WARNING LLAMA_SYCL GGML_SYCL)
@@ -165,6 +170,16 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/llama-config.cmake
165170
${CMAKE_CURRENT_BINARY_DIR}/llama-version.cmake
166171
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/llama)
167172

173+
set(GGML_PUBLIC_HEADERS "ggml.h" "ggml-alloc.h" "ggml-backend.h"
174+
"${GGML_HEADERS_CUDA}" "${GGML_HEADERS_OPENCL}"
175+
"${GGML_HEADERS_METAL}" "${GGML_HEADERS_EXTRA}")
176+
177+
set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}")
178+
install(TARGETS ggml PUBLIC_HEADER)
179+
180+
set_target_properties(llama PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/llama.h)
181+
install(TARGETS llama LIBRARY PUBLIC_HEADER)
182+
168183
install(
169184
FILES convert_hf_to_gguf.py
170185
PERMISSIONS

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,23 @@ ggml/src/ggml-cuda.o: \
746746
$(NVCC_COMPILE)
747747
endif # GGML_CUDA
748748

749+
ifdef LLAMA_CLBLAST
750+
MK_CPPFLAGS += -DGGML_USE_CLBLAST $(shell pkg-config --cflags-only-I clblast OpenCL)
751+
MK_CFLAGS += $(shell pkg-config --cflags-only-other clblast OpenCL)
752+
MK_CXXFLAGS += $(shell pkg-config --cflags-only-other clblast OpenCL)
753+
754+
# Mac provides OpenCL as a framework
755+
ifeq ($(UNAME_S),Darwin)
756+
MK_LDFLAGS += -lclblast -framework OpenCL
757+
else
758+
MK_LDFLAGS += $(shell pkg-config --libs clblast OpenCL)
759+
endif
760+
OBJS += ggml-opencl.o
761+
762+
ggml-opencl.o: ggml-opencl.cpp ggml-opencl.h
763+
$(CXX) $(CXXFLAGS) -c $< -o $@
764+
endif # LLAMA_CLBLAST
765+
749766
ifdef GGML_VULKAN
750767
MK_CPPFLAGS += -DGGML_USE_VULKAN
751768
MK_LDFLAGS += $(shell pkg-config --libs vulkan)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ variety of hardware - locally and in the cloud.
4949
- AVX, AVX2 and AVX512 support for x86 architectures
5050
- 1.5-bit, 2-bit, 3-bit, 4-bit, 5-bit, 6-bit, and 8-bit integer quantization for faster inference and reduced memory use
5151
- Custom CUDA kernels for running LLMs on NVIDIA GPUs (support for AMD GPUs via HIP)
52-
- Vulkan and SYCL backend support
52+
- Vulkan, SYCL, and (partial) OpenCL backend support
5353
- CPU+GPU hybrid inference to partially accelerate models larger than the total VRAM capacity
5454

5555
Since its [inception](https://github.com/ggerganov/llama.cpp/issues/33#issuecomment-1465108022), the project has

cmake/llama-config.cmake.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@)
66
set(GGML_BLAS @GGML_BLAS@)
77
set(GGML_CUDA @GGML_CUDA@)
88
set(GGML_METAL @GGML_METAL@)
9+
set(GGML_CLBLAST @GGML_CLBLAST@)
910
set(GGML_HIPBLAS @GGML_HIPBLAS@)
1011
set(GGML_ACCELERATE @GGML_ACCELERATE@)
1112
set(GGML_VULKAN @GGML_VULKAN@)
@@ -44,6 +45,11 @@ if (GGML_METAL)
4445
find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
4546
endif()
4647

48+
if (GGML_CLBLAST)
49+
find_package(CLBlast REQUIRED)
50+
endif()
51+
52+
4753
if (GGML_VULKAN)
4854
find_package(Vulkan REQUIRED)
4955
endif()

common/common.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,6 +3128,7 @@ void yaml_dump_non_result_info(FILE * stream, const gpt_params & params, const l
31283128
fprintf(stream, "cpu_has_avx512_vnni: %s\n", ggml_cpu_has_avx512_vnni() ? "true" : "false");
31293129
fprintf(stream, "cpu_has_cuda: %s\n", ggml_cpu_has_cuda() ? "true" : "false");
31303130
fprintf(stream, "cpu_has_vulkan: %s\n", ggml_cpu_has_vulkan() ? "true" : "false");
3131+
fprintf(stream, "cpu_has_clblast: %s\n", ggml_cpu_has_clblast() ? "true" : "false");
31313132
fprintf(stream, "cpu_has_kompute: %s\n", ggml_cpu_has_kompute() ? "true" : "false");
31323133
fprintf(stream, "cpu_has_fma: %s\n", ggml_cpu_has_fma() ? "true" : "false");
31333134
fprintf(stream, "cpu_has_gpublas: %s\n", ggml_cpu_has_gpublas() ? "true" : "false");

docs/backend/SYCL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The llama.cpp SYCL backend is designed to support **Intel GPU** firstly. Based o
3030

3131
When targeting **Intel CPU**, it is recommended to use llama.cpp for [Intel oneMKL](README.md#intel-onemkl) backend.
3232

33-
It has the similar design of other llama.cpp BLAS-based paths such as *OpenBLAS, cuBLAS, etc..*. In beginning work, the oneAPI's [SYCLomatic](https://github.com/oneapi-src/SYCLomatic) open-source migration tool (Commercial release [Intel® DPC++ Compatibility Tool](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compatibility-tool.html)) was used for this purpose.
33+
It has the similar design of other llama.cpp BLAS-based paths such as *OpenBLAS, cuBLAS, CLBlast etc..*. In beginning work, the oneAPI's [SYCLomatic](https://github.com/oneapi-src/SYCLomatic) open-source migration tool (Commercial release [Intel® DPC++ Compatibility Tool](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compatibility-tool.html)) was used for this purpose.
3434

3535
## Recommended Release
3636

examples/llama-bench/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ $ ./llama-bench -o csv
162162
```
163163

164164
```csv
165-
build_commit,build_number,cuda,metal,gpu_blas,blas,cpu_info,gpu_info,model_filename,model_type,model_size,model_n_params,n_batch,n_threads,f16_kv,n_gpu_layers,main_gpu,mul_mat_q,tensor_split,n_prompt,n_gen,test_time,avg_ns,stddev_ns,avg_ts,stddev_ts
165+
build_commit,build_number,cuda,opencl,metal,gpu_blas,blas,cpu_info,gpu_info,model_filename,model_type,model_size,model_n_params,n_batch,n_threads,f16_kv,n_gpu_layers,main_gpu,mul_mat_q,tensor_split,n_prompt,n_gen,test_time,avg_ns,stddev_ns,avg_ts,stddev_ts
166166
"3469684","1275","1","0","0","1","1","13th Gen Intel(R) Core(TM) i9-13900K","NVIDIA GeForce RTX 3090 Ti","models/7B/ggml-model-q4_0.gguf","llama 7B mostly Q4_0","3825065984","6738415616","512","16","1","99","0","1","0.00","512","0","2023-09-23T12:09:01Z","212155977","732372","2413.341687","8.305961"
167167
"3469684","1275","1","0","0","1","1","13th Gen Intel(R) Core(TM) i9-13900K","NVIDIA GeForce RTX 3090 Ti","models/7B/ggml-model-q4_0.gguf","llama 7B mostly Q4_0","3825065984","6738415616","512","16","1","99","0","1","0.00","0","128","2023-09-23T12:09:02Z","969320879","2728399","132.052051","0.371342"
168168
```
@@ -179,6 +179,7 @@ $ ./llama-bench -o json
179179
"build_commit": "3469684",
180180
"build_number": 1275,
181181
"cuda": true,
182+
"opencl": false,
182183
"metal": false,
183184
"gpu_blas": true,
184185
"blas": true,
@@ -209,6 +210,7 @@ $ ./llama-bench -o json
209210
"build_commit": "3469684",
210211
"build_number": 1275,
211212
"cuda": true,
213+
"opencl": false,
212214
"metal": false,
213215
"gpu_blas": true,
214216
"blas": true,
@@ -251,6 +253,7 @@ CREATE TABLE IF NOT EXISTS test (
251253
build_commit TEXT,
252254
build_number INTEGER,
253255
cuda INTEGER,
256+
opencl INTEGER,
254257
metal INTEGER,
255258
gpu_blas INTEGER,
256259
blas INTEGER,
@@ -276,6 +279,6 @@ CREATE TABLE IF NOT EXISTS test (
276279
stddev_ts REAL
277280
);
278281

279-
INSERT INTO test (build_commit, build_number, cuda, metal, gpu_blas, blas, cpu_info, gpu_info, model_filename, model_type, model_size, model_n_params, n_batch, n_threads, f16_kv, n_gpu_layers, main_gpu, mul_mat_q, tensor_split, n_prompt, n_gen, test_time, avg_ns, stddev_ns, avg_ts, stddev_ts) VALUES ('3469684', '1275', '1', '0', '0', '1', '1', '13th Gen Intel(R) Core(TM) i9-13900K', 'NVIDIA GeForce RTX 3090 Ti', 'models/7B/ggml-model-q4_0.gguf', 'llama 7B mostly Q4_0', '3825065984', '6738415616', '512', '16', '1', '99', '0', '1', '0.00', '512', '0', '2023-09-23T12:10:30Z', '212693772', '743623', '2407.240204', '8.409634');
280-
INSERT INTO test (build_commit, build_number, cuda, metal, gpu_blas, blas, cpu_info, gpu_info, model_filename, model_type, model_size, model_n_params, n_batch, n_threads, f16_kv, n_gpu_layers, main_gpu, mul_mat_q, tensor_split, n_prompt, n_gen, test_time, avg_ns, stddev_ns, avg_ts, stddev_ts) VALUES ('3469684', '1275', '1', '0', '0', '1', '1', '13th Gen Intel(R) Core(TM) i9-13900K', 'NVIDIA GeForce RTX 3090 Ti', 'models/7B/ggml-model-q4_0.gguf', 'llama 7B mostly Q4_0', '3825065984', '6738415616', '512', '16', '1', '99', '0', '1', '0.00', '0', '128', '2023-09-23T12:10:31Z', '977925003', '4037361', '130.891159', '0.537692');
282+
INSERT INTO test (build_commit, build_number, cuda, opencl, metal, gpu_blas, blas, cpu_info, gpu_info, model_filename, model_type, model_size, model_n_params, n_batch, n_threads, f16_kv, n_gpu_layers, main_gpu, mul_mat_q, tensor_split, n_prompt, n_gen, test_time, avg_ns, stddev_ns, avg_ts, stddev_ts) VALUES ('3469684', '1275', '1', '0', '0', '1', '1', '13th Gen Intel(R) Core(TM) i9-13900K', 'NVIDIA GeForce RTX 3090 Ti', 'models/7B/ggml-model-q4_0.gguf', 'llama 7B mostly Q4_0', '3825065984', '6738415616', '512', '16', '1', '99', '0', '1', '0.00', '512', '0', '2023-09-23T12:10:30Z', '212693772', '743623', '2407.240204', '8.409634');
283+
INSERT INTO test (build_commit, build_number, cuda, opencl, metal, gpu_blas, blas, cpu_info, gpu_info, model_filename, model_type, model_size, model_n_params, n_batch, n_threads, f16_kv, n_gpu_layers, main_gpu, mul_mat_q, tensor_split, n_prompt, n_gen, test_time, avg_ns, stddev_ns, avg_ts, stddev_ts) VALUES ('3469684', '1275', '1', '0', '0', '1', '1', '13th Gen Intel(R) Core(TM) i9-13900K', 'NVIDIA GeForce RTX 3090 Ti', 'models/7B/ggml-model-q4_0.gguf', 'llama 7B mostly Q4_0', '3825065984', '6738415616', '512', '16', '1', '99', '0', '1', '0.00', '0', '128', '2023-09-23T12:10:31Z', '977925003', '4037361', '130.891159', '0.537692');
281284
```

examples/llama-bench/llama-bench.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ struct test {
754754
static const std::string build_commit;
755755
static const int build_number;
756756
static const bool cuda;
757+
static const bool opencl;
757758
static const bool vulkan;
758759
static const bool kompute;
759760
static const bool metal;
@@ -843,6 +844,9 @@ struct test {
843844
if (cuda) {
844845
return GGML_CUDA_NAME;
845846
}
847+
if (opencl) {
848+
return "OpenCL";
849+
}
846850
if (vulkan) {
847851
return "Vulkan";
848852
}
@@ -868,7 +872,7 @@ struct test {
868872
static const std::vector<std::string> & get_fields() {
869873
static const std::vector<std::string> fields = {
870874
"build_commit", "build_number",
871-
"cuda", "vulkan", "kompute", "metal", "sycl", "rpc", "gpu_blas", "blas",
875+
"cuda", "opencl", "vulkan", "kompute", "metal", "sycl", "rpc", "gpu_blas", "blas",
872876
"cpu_info", "gpu_info",
873877
"model_filename", "model_type", "model_size", "model_n_params",
874878
"n_batch", "n_ubatch",
@@ -894,7 +898,7 @@ struct test {
894898
field == "avg_ns" || field == "stddev_ns") {
895899
return INT;
896900
}
897-
if (field == "cuda" || field == "vulkan" || field == "kompute" || field == "metal" ||
901+
if (field == "cuda" || field == "opencl" || field == "vulkan" || field == "kompute" || field == "metal" ||
898902
field == "gpu_blas" || field == "blas" || field == "sycl" ||field == "f16_kv" || field == "no_kv_offload" ||
899903
field == "flash_attn" || field == "use_mmap" || field == "embeddings") {
900904
return BOOL;
@@ -924,7 +928,7 @@ struct test {
924928
std::vector<std::string> values = {
925929
build_commit, std::to_string(build_number),
926930
std::to_string(cuda), std::to_string(vulkan), std::to_string(vulkan),
927-
std::to_string(metal), std::to_string(sycl), std::to_string(has_rpc), std::to_string(gpu_blas), std::to_string(blas),
931+
std::to_string(metal), std::to_string(opencl), std::to_string(sycl), std::to_string(has_rpc), std::to_string(gpu_blas), std::to_string(blas),
928932
cpu_info, gpu_info,
929933
model_filename, model_type, std::to_string(model_size), std::to_string(model_n_params),
930934
std::to_string(n_batch), std::to_string(n_ubatch),
@@ -952,6 +956,7 @@ struct test {
952956
const std::string test::build_commit = LLAMA_COMMIT;
953957
const int test::build_number = LLAMA_BUILD_NUMBER;
954958
const bool test::cuda = !!ggml_cpu_has_cuda();
959+
const bool test::opencl = !!ggml_cpu_has_clblast();
955960
const bool test::vulkan = !!ggml_cpu_has_vulkan();
956961
const bool test::kompute = !!ggml_cpu_has_kompute();
957962
const bool test::metal = !!ggml_cpu_has_metal();

0 commit comments

Comments
 (0)