Skip to content

Commit ed131c9

Browse files
committed
fix deadlock for cases where cgraph.n_nodes == 1
1 parent 8a39d75 commit ed131c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ggml/src/ggml.c

+5
Original file line numberDiff line numberDiff line change
@@ -19169,6 +19169,11 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
1916919169
}
1917019170
}
1917119171

19172+
if (cgraph->n_nodes == 1) {
19173+
// We need a barrier before disabling new_work in case we have a trivial graph
19174+
ggml_barrier(state->threadpool);
19175+
}
19176+
1917219177
if (!state->threadpool->disposable && state->ith == 0) {
1917319178
state->threadpool->new_work = false;
1917419179
}

0 commit comments

Comments
 (0)