sched yield fix again
This commit is contained in:
parent
1f9e36c733
commit
a64d182b8b
1 changed files with 6 additions and 10 deletions
16
ggml.c
16
ggml.c
|
@ -17290,18 +17290,14 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
||||||
} else {
|
} else {
|
||||||
// wait for other threads to finish
|
// wait for other threads to finish
|
||||||
const int last = node_n;
|
const int last = node_n;
|
||||||
while (true) {
|
do {
|
||||||
// TODO: this sched_yield can have significant impact on the performance - either positive or negative
|
#if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_METAL)
|
||||||
// depending on the workload and the operating system.
|
//apple does nothing
|
||||||
// since it is not clear what is the best approach, it should potentially become user-configurable
|
#else
|
||||||
// ref: https://github.com/ggerganov/ggml/issues/291
|
|
||||||
#if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_OPENBLAS)
|
|
||||||
sched_yield();
|
sched_yield();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
node_n = atomic_load(&state->shared->node_n);
|
node_n = atomic_load(&state->shared->node_n);
|
||||||
if (node_n != last) break;
|
} while (node_n == last);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we should stop
|
// check if we should stop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue