From f9196c917400435f62fe6f10252d2a8e97a2cb15 Mon Sep 17 00:00:00 2001 From: slaren Date: Wed, 18 Sep 2024 14:58:49 +0200 Subject: [PATCH 1/2] ggml : fix n_threads_cur initialization with one thread --- ggml/src/ggml.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c index bccb62377..2e8c806c4 100644 --- a/ggml/src/ggml.c +++ b/ggml/src/ggml.c @@ -20239,6 +20239,7 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl ggml_graph_compute_thread(&threadpool->workers[omp_get_thread_num()]); } } else { + threadpool->n_threads_cur = 1; ggml_graph_compute_thread(&threadpool->workers[0]); } #else From 6b0248c29a224c767ae29551cfd6b40ae10ffa19 Mon Sep 17 00:00:00 2001 From: Max Krasnyansky Date: Wed, 18 Sep 2024 09:00:26 -0700 Subject: [PATCH 2/2] Update ggml/src/ggml.c --- ggml/src/ggml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml/src/ggml.c b/ggml/src/ggml.c index 2e8c806c4..c5c98dbe4 100644 --- a/ggml/src/ggml.c +++ b/ggml/src/ggml.c @@ -20239,7 +20239,7 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl ggml_graph_compute_thread(&threadpool->workers[omp_get_thread_num()]); } } else { - threadpool->n_threads_cur = 1; + atomic_store_explicit(&threadpool->n_threads_cur, 1, memory_order_relaxed); ggml_graph_compute_thread(&threadpool->workers[0]); } #else