Skip to content

Commit

Permalink
skip barriers with 1 threads
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren committed Jun 19, 2024
1 parent e5c0c4e commit 4d8a0c2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -18973,11 +18973,18 @@ static int ggml_get_n_tasks(struct ggml_tensor * node, int n_threads, int n_cur_

#ifdef GGML_USE_OPENMP
static void ggml_barrier(struct ggml_compute_state * state) {
if (state->shared->n_threads == 1) {
return;
}

#pragma omp barrier
UNUSED(state);
}
#else
static void ggml_barrier(struct ggml_compute_state * state) {
if (state->shared->n_threads == 1) {
return;
}

atomic_int * n_barrier = &state->shared->n_barrier;
atomic_int * n_barrier_passed = &state->shared->n_barrier_passed;

Expand Down

0 comments on commit 4d8a0c2

Please sign in to comment.