Skip to content

Commit e3af62a

Browse files
authored
feat: Add sycl support for whisper.cpp (#5341)
1 parent dc21604 commit e3af62a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ BARKCPP_VERSION?=v1.0.0
2424
STABLEDIFFUSION_GGML_REPO?=https://github.com/richiejp/stable-diffusion.cpp
2525
STABLEDIFFUSION_GGML_VERSION?=53e3b17eb3d0b5760ced06a1f98320b68b34aaae
2626

27+
# ONEAPI variables for SYCL
28+
export ONEAPI_VARS?=/opt/intel/oneapi/setvars.sh
29+
2730
ONNX_VERSION?=1.20.0
2831
ONNX_ARCH?=x64
2932
ONNX_OS?=linux
@@ -152,11 +155,13 @@ endif
152155
ifneq (,$(findstring sycl,$(BUILD_TYPE)))
153156
export GGML_SYCL=1
154157
CMAKE_ARGS+=-DGGML_SYCL=ON
158+
CMAKE_ARGS+=-DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
155159
endif
156160

157161
ifeq ($(BUILD_TYPE),sycl_f16)
158162
export GGML_SYCL_F16=1
159163
CMAKE_ARGS+=-DGGML_SYCL_F16=ON
164+
CMAKE_ARGS+=-DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
160165
endif
161166

162167
ifeq ($(BUILD_TYPE),hipblas)
@@ -167,7 +172,7 @@ ifeq ($(BUILD_TYPE),hipblas)
167172
export CC=$(ROCM_HOME)/llvm/bin/clang
168173
export STABLE_BUILD_TYPE=
169174
export GGML_HIP=1
170-
GPU_TARGETS ?= gfx900,gfx906,gfx908,gfx940,gfx941,gfx942,gfx90a,gfx1030,gfx1031,gfx1100,gfx1101
175+
GPU_TARGETS ?= gfx803,gfx900,gfx906,gfx908,gfx90a,gfx942,gfx1010,gfx1030,gfx1032,gfx1100,gfx1101,gfx1102
171176
AMDGPU_TARGETS ?= "$(GPU_TARGETS)"
172177
CMAKE_ARGS+=-DGGML_HIP=ON -DAMDGPU_TARGETS="$(AMDGPU_TARGETS)" -DGPU_TARGETS="$(GPU_TARGETS)"
173178
CGO_LDFLAGS += -O3 --rtlib=compiler-rt -unwindlib=libgcc -lhipblas -lrocblas --hip-link -L${ROCM_HOME}/lib/llvm/lib
@@ -303,8 +308,14 @@ sources/whisper.cpp:
303308
git submodule update --init --recursive --depth 1 --single-branch
304309

305310
sources/whisper.cpp/build/src/libwhisper.a: sources/whisper.cpp
311+
ifneq (,$(findstring sycl,$(BUILD_TYPE)))
312+
+bash -c "source $(ONEAPI_VARS); \
313+
cd sources/whisper.cpp && cmake $(CMAKE_ARGS) . -B ./build && \
314+
cd build && cmake --build . --config Release"
315+
else
306316
cd sources/whisper.cpp && cmake $(CMAKE_ARGS) . -B ./build
307317
cd sources/whisper.cpp/build && cmake --build . --config Release
318+
endif
308319

309320
get-sources: sources/go-piper sources/stablediffusion-ggml.cpp sources/bark.cpp sources/whisper.cpp backend/cpp/llama/llama.cpp
310321

0 commit comments

Comments
 (0)