Fixed a segment fault when n_threads == 1 and GGML_GLOBAL_THREADS is defined
This commit is contained in:
parent
f57ff961fd
commit
481c6d517b
1 changed files with 7 additions and 5 deletions
12
ggml.c
12
ggml.c
|
@ -10273,11 +10273,13 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GGML_GLOBAL_THREADS
|
#ifdef GGML_GLOBAL_THREADS
|
||||||
// wakeup threads.
|
if (n_threads > 1) {
|
||||||
pthread_mutex_lock(&state_shared->mutex);
|
// wakeup threads.
|
||||||
state_shared->wait_cmd = false;
|
pthread_mutex_lock(&state_shared->mutex);
|
||||||
pthread_cond_broadcast(&state_shared->cond);
|
state_shared->wait_cmd = false;
|
||||||
pthread_mutex_unlock(&state_shared->mutex);
|
pthread_cond_broadcast(&state_shared->cond);
|
||||||
|
pthread_mutex_unlock(&state_shared->mutex);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GGML_PERF
|
#ifdef GGML_PERF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue