From 9d6675def40473561bff4c2c2fb78df9d09be856 Mon Sep 17 00:00:00 2001 From: Faisal Zaghloul Date: Fri, 31 May 2024 12:30:12 -0400 Subject: [PATCH] fix n_threads == 1 bug --- ggml.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ggml.c b/ggml.c index ff7a8ca1a..201f01958 100644 --- a/ggml.c +++ b/ggml.c @@ -20130,7 +20130,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl int compute_status = GGML_STATUS_SUCCESS; // The main-thread is a work thread too. Start computing... - atomic_fetch_sub(&threadpool->n_ready, 1); + if (n_threads > 1) { + atomic_fetch_sub(&threadpool->n_ready, 1); + } compute_status = (size_t) ggml_graph_compute_thread(&threadpool->workers[0]); // don't leave affinity set on the main thread