File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -17283,10 +17283,18 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
1728317283 } else {
1728417284 // wait for other threads to finish
1728517285 const int last = node_n;
17286- do {
17287- //sched_yield();
17286+ while (true) {
17287+ // TODO: this sched_yield can have significant impact on the performance - either positive or negative
17288+ // depending on the workload and the operating system.
17289+ // since it is not clear what is the best approach, it should potentially become user-configurable
17290+ // ref: https://github.com/ggerganov/ggml/issues/291
17291+ #if defined(GGML_USE_ACCELERATE) || defined(GGML_USE_OPENBLAS)
17292+ sched_yield();
17293+ #endif
17294+
1728817295 node_n = atomic_load(&state->shared->node_n);
17289- } while (node_n == last);
17296+ if (node_n != last) break;
17297+ };
1729017298 }
1729117299
1729217300 // check if we should stop
You can’t perform that action at this time.
0 commit comments