skip barriers with 1 threads
This commit is contained in:
parent
e5c0c4e30d
commit
4d8a0c2b9f
1 changed files with 8 additions and 1 deletions
9
ggml.c
9
ggml.c
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue