build : update CBLAS flags + fix unused var warning (#0)

This commit is contained in:
Georgi Gerganov 2024-02-19 14:44:46 +02:00
parent dda4b0ed06
commit 65faae0b6a
No known key found for this signature in database
GPG Key ID: BF970631944C16B7
3 changed files with 6 additions and 5 deletions

View File

@ -116,7 +116,7 @@ if (APPLE)
message(STATUS "Accelerate framework found") message(STATUS "Accelerate framework found")
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${ACCELERATE_FRAMEWORK}) set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${ACCELERATE_FRAMEWORK})
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_ACCELERATE) set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64)
else() else()
message(FATAL_ERROR "Accelerate framework not found") message(FATAL_ERROR "Accelerate framework not found")
endif() endif()

View File

@ -185,6 +185,8 @@ ifndef WHISPER_NO_ACCELERATE
# Mac M1 - include Accelerate framework # Mac M1 - include Accelerate framework
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
CFLAGS += -DGGML_USE_ACCELERATE CFLAGS += -DGGML_USE_ACCELERATE
CFLAGS += -DACCELERATE_NEW_LAPACK
CFLAGS += -DACCELERATE_LAPACK_ILP64
LDFLAGS += -framework Accelerate LDFLAGS += -framework Accelerate
endif endif
endif endif

View File

@ -1616,8 +1616,7 @@ static bool whisper_encode_external(const whisper_state & wstate) {
static struct ggml_cgraph * whisper_build_graph_conv( static struct ggml_cgraph * whisper_build_graph_conv(
whisper_context & wctx, whisper_context & wctx,
whisper_state & wstate, whisper_state & wstate) {
const int mel_offset) {
const auto & model = wctx.model; const auto & model = wctx.model;
const auto & hparams = model.hparams; const auto & hparams = model.hparams;
@ -2001,7 +2000,7 @@ static bool whisper_encode_internal(
{ {
auto & alloc = wstate.alloc_conv.alloc; auto & alloc = wstate.alloc_conv.alloc;
ggml_cgraph * gf = whisper_build_graph_conv(wctx, wstate, mel_offset); ggml_cgraph * gf = whisper_build_graph_conv(wctx, wstate);
if (!ggml_gallocr_alloc_graph(alloc, gf)) { if (!ggml_gallocr_alloc_graph(alloc, gf)) {
// should never happen as we pre-allocate the memory // should never happen as we pre-allocate the memory
@ -3024,7 +3023,7 @@ struct whisper_state * whisper_init_state(whisper_context * ctx) {
{ {
bool ok = whisper_allocr_graph_init(state->alloc_conv, ctx->backend, bool ok = whisper_allocr_graph_init(state->alloc_conv, ctx->backend,
[&]() { [&]() {
return whisper_build_graph_conv(*ctx, *state, 0); return whisper_build_graph_conv(*ctx, *state);
}); });
if (!ok) { if (!ok) {