Skip to content

Commit 29e4729

Browse files
authored
deps(whisper.cpp): update to latest commit (#2709)
- Update include path to add ggml - Update linker options to add gml and libgomp - move some of the options to GGML_ rather then WHISPER_* Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 68f3943 commit 29e4729

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

Makefile

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RWKV_REPO?=https://github.com/donomii/go-rwkv.cpp
1616
RWKV_VERSION?=661e7ae26d442f5cfebd2a0881b44e8c55949ec6
1717

1818
# whisper.cpp version
19-
WHISPER_CPP_VERSION?=b29b3b29240aac8b71ce8e5a4360c1f1562ad66f
19+
WHISPER_CPP_VERSION?=c118733a29ad4a984015a5c08fd585086d01087a
2020

2121
# bert.cpp version
2222
BERT_VERSION?=710044b124545415f555e4260d16b146c725a6e4
@@ -36,6 +36,7 @@ export CMAKE_ARGS?=
3636

3737
CGO_LDFLAGS?=
3838
CGO_LDFLAGS_WHISPER?=
39+
CGO_LDFLAGS_WHISPER+=-lggml
3940
CUDA_LIBPATH?=/usr/local/cuda/lib64/
4041
GO_TAGS?=
4142
BUILD_ID?=
@@ -82,31 +83,40 @@ ifeq ($(OS),Darwin)
8283
else ifneq ($(BUILD_TYPE),metal)
8384
CMAKE_ARGS+=-DGGML_METAL=OFF
8485
export GGML_NO_ACCELERATE=1
86+
export GGML_NO_METAL=1
8587
endif
8688

8789
ifeq ($(BUILD_TYPE),metal)
8890
# -lcblas removed: it seems to always be listed as a duplicate flag.
8991
CGO_LDFLAGS += -framework Accelerate
9092
endif
93+
else
94+
CGO_LDFLAGS_WHISPER+=-lgomp
9195
endif
9296

9397
ifeq ($(BUILD_TYPE),openblas)
9498
CGO_LDFLAGS+=-lopenblas
95-
export WHISPER_OPENBLAS=1
99+
export GGML_OPENBLAS=1
96100
endif
97101

98-
99102
ifeq ($(BUILD_TYPE),cublas)
100103
CGO_LDFLAGS+=-lcublas -lcudart -L$(CUDA_LIBPATH)
101104
export GGML_CUDA=1
102-
export WHISPER_CUDA=1
103105
CGO_LDFLAGS_WHISPER+=-L$(CUDA_LIBPATH)/stubs/ -lcuda -lcufft
104106
endif
105107

106108
ifeq ($(BUILD_TYPE),vulkan)
107109
CMAKE_ARGS+=-DGGML_VULKAN=1
108110
endif
109111

112+
ifneq (,$(findstring sycl,$(BUILD_TYPE)))
113+
export GGML_SYCL=1
114+
endif
115+
116+
ifeq ($(BUILD_TYPE),sycl_f16)
117+
export GGML_SYCL_F16=1
118+
endif
119+
110120
ifeq ($(BUILD_TYPE),hipblas)
111121
ROCM_HOME ?= /opt/rocm
112122
ROCM_PATH ?= /opt/rocm
@@ -115,7 +125,7 @@ ifeq ($(BUILD_TYPE),hipblas)
115125
export CC=$(ROCM_HOME)/llvm/bin/clang
116126
# llama-ggml has no hipblas support, so override it here.
117127
export STABLE_BUILD_TYPE=
118-
export WHISPER_HIPBLAS=1
128+
export GGML_HIPBLAS=1
119129
GPU_TARGETS ?= gfx900,gfx906,gfx908,gfx940,gfx941,gfx942,gfx90a,gfx1030,gfx1031,gfx1100,gfx1101
120130
AMDGPU_TARGETS ?= "$(GPU_TARGETS)"
121131
CMAKE_ARGS+=-DGGML_HIPBLAS=ON -DAMDGPU_TARGETS="$(AMDGPU_TARGETS)" -DGPU_TARGETS="$(GPU_TARGETS)"
@@ -125,12 +135,11 @@ endif
125135
ifeq ($(BUILD_TYPE),metal)
126136
CGO_LDFLAGS+=-framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders
127137
export GGML_METAL=1
128-
export WHISPER_METAL=1
129138
endif
130139

131140
ifeq ($(BUILD_TYPE),clblas)
132141
CGO_LDFLAGS+=-lOpenCL -lclblast
133-
export WHISPER_CLBLAST=1
142+
export GGML_OPENBLAS=1
134143
endif
135144

136145
# glibc-static or glibc-devel-static required
@@ -248,7 +257,7 @@ sources/whisper.cpp:
248257
cd sources/whisper.cpp && git checkout -b build $(WHISPER_CPP_VERSION) && git submodule update --init --recursive --depth 1
249258

250259
sources/whisper.cpp/libwhisper.a: sources/whisper.cpp
251-
cd sources/whisper.cpp && $(MAKE) libwhisper.a
260+
cd sources/whisper.cpp && $(MAKE) libwhisper.a libggml.a
252261

253262
get-sources: sources/go-llama.cpp sources/gpt4all sources/go-piper sources/go-rwkv.cpp sources/whisper.cpp sources/go-bert.cpp sources/go-stable-diffusion sources/go-tiny-dream
254263

@@ -792,7 +801,7 @@ backend-assets/grpc/tinydream: sources/go-tiny-dream sources/go-tiny-dream/libti
792801
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/tinydream ./backend/go/image/tinydream
793802

794803
backend-assets/grpc/whisper: sources/whisper.cpp sources/whisper.cpp/libwhisper.a backend-assets/grpc
795-
CGO_LDFLAGS="$(CGO_LDFLAGS) $(CGO_LDFLAGS_WHISPER)" C_INCLUDE_PATH=$(CURDIR)/sources/whisper.cpp LIBRARY_PATH=$(CURDIR)/sources/whisper.cpp \
804+
CGO_LDFLAGS="$(CGO_LDFLAGS) $(CGO_LDFLAGS_WHISPER)" C_INCLUDE_PATH="$(CURDIR)/sources/whisper.cpp/include:$(CURDIR)/sources/whisper.cpp/ggml/include" LIBRARY_PATH=$(CURDIR)/sources/whisper.cpp \
796805
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/whisper ./backend/go/transcribe/
797806

798807
backend-assets/grpc/local-store: backend-assets/grpc

0 commit comments

Comments
 (0)