Skip to content

Commit 4d8a0c2

Browse files
committed
skip barriers with 1 threads
1 parent e5c0c4e commit 4d8a0c2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ggml.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18973,11 +18973,18 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads, int n_cur_
1897318973

1897418974
#ifdef GGML_USE_OPENMP
1897518975
static void ggml_barrier(struct ggml_compute_state * state) {
18976+
if (state->shared->n_threads == 1) {
18977+
return;
18978+
}
18979+
1897618980
#pragma omp barrier
18977-
UNUSED(state);
1897818981
}
1897918982
#else
1898018983
static void ggml_barrier(struct ggml_compute_state * state) {
18984+
if (state->shared->n_threads == 1) {
18985+
return;
18986+
}
18987+
1898118988
atomic_int * n_barrier = &state->shared->n_barrier;
1898218989
atomic_int * n_barrier_passed = &state->shared->n_barrier_passed;
1898318990

0 commit comments

Comments
 (0)