From bfcb2a2ab960243c927792813ddd6a791e412042 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 14 Sep 2023 18:04:42 +0300 Subject: [PATCH] metal : remove the "concurrent" flag --- ggml-metal.h | 2 +- ggml-metal.m | 5 ++--- whisper.cpp | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ggml-metal.h b/ggml-metal.h index 4e36cc12..fca28d37 100644 --- a/ggml-metal.h +++ b/ggml-metal.h @@ -77,7 +77,7 @@ int * ggml_metal_get_concur_list(struct ggml_metal_context * ctx); // same as ggml_graph_compute but uses Metal // creates gf->n_threads command buffers in parallel -void ggml_metal_graph_compute(struct ggml_metal_context * ctx, struct ggml_cgraph * gf, bool concurrent); +void ggml_metal_graph_compute(struct ggml_metal_context * ctx, struct ggml_cgraph * gf); #ifdef __cplusplus } diff --git a/ggml-metal.m b/ggml-metal.m index 7ec31c21..b438b83f 100644 --- a/ggml-metal.m +++ b/ggml-metal.m @@ -610,15 +610,14 @@ void ggml_metal_graph_find_concurrency( void ggml_metal_graph_compute( struct ggml_metal_context * ctx, - struct ggml_cgraph * gf, - bool concurrent) { + struct ggml_cgraph * gf) { @autoreleasepool { // if there is ctx->concur_list, dispatch concurrently // else fallback to serial dispatch MTLComputePassDescriptor * edesc = MTLComputePassDescriptor.computePassDescriptor; - const bool has_concur = concurrent && ctx->concur_list_len && ctx->concur_list_len <= GGML_MAX_CONCUR; + const bool has_concur = ctx->concur_list_len && ctx->concur_list_len <= GGML_MAX_CONCUR; const int n_nodes = has_concur ? ctx->concur_list_len : gf->n_nodes; edesc.dispatchType = has_concur ? MTLDispatchTypeConcurrent : MTLDispatchTypeSerial; diff --git a/whisper.cpp b/whisper.cpp index a79689d0..23ebd7e9 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -1953,7 +1953,7 @@ static bool whisper_encode_internal( #ifdef GGML_USE_METAL if (wstate.ctx_metal) { ggml_metal_set_n_cb (wstate.ctx_metal, n_threads); - ggml_metal_graph_compute(wstate.ctx_metal, gf, false); + ggml_metal_graph_compute(wstate.ctx_metal, gf); } else { ggml_graph_compute_helper(wstate.work_buffer, gf, n_threads); } @@ -1975,7 +1975,7 @@ static bool whisper_encode_internal( #ifdef GGML_USE_METAL if (wstate.ctx_metal) { ggml_metal_set_n_cb (wstate.ctx_metal, n_threads); - ggml_metal_graph_compute(wstate.ctx_metal, gf, false); + ggml_metal_graph_compute(wstate.ctx_metal, gf); } else { ggml_graph_compute_helper(wstate.work_buffer, gf, n_threads); } @@ -2373,7 +2373,7 @@ static bool whisper_decode_internal( #ifdef GGML_USE_METAL if (wstate.ctx_metal) { ggml_metal_set_n_cb (wstate.ctx_metal, n_threads); - ggml_metal_graph_compute(wstate.ctx_metal, gf, false); + ggml_metal_graph_compute(wstate.ctx_metal, gf); } else { ggml_graph_compute_helper(wstate.work_buffer, gf, n_threads); }