From 693f6493e5146c6354e6ec4530e2ea006358be7d Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Tue, 9 Jan 2024 18:12:58 +0800 Subject: [PATCH] fixed a bug that resulted in the program hanging --- ggml.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ggml.c b/ggml.c index a0061183a..03ec5349b 100644 --- a/ggml.c +++ b/ggml.c @@ -16557,7 +16557,7 @@ static thread_ret_t ggml_graph_compute_thread(void * data) { atomic_store(&state->shared->n_active, n_threads); atomic_store(&state->shared->node_n, node_n); } else { - // wait for other threads to finish + // wait for other threads to finish const int last = node_n; const bool do_yield = last < 0 || cgraph->nodes[last]->op == GGML_OP_MUL_MAT; @@ -16573,7 +16573,8 @@ static thread_ret_t ggml_graph_compute_thread(void * data) { } node_n = atomic_load(&state->shared->node_n); - } while (node_n == last); + if (node_n != last) break; + }; } // check if we should stop