Skip to content

Commit ac7e703

Browse files
committed
Revert scheduling to the old method for CPU perf
1 parent d1aff0e commit ac7e703

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ggml.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -16900,9 +16900,7 @@ static void ggml_graph_compute_thread_sync_node(int * node_n, struct ggml_comput
1690016900
const int last_node_n = * node_n;
1690116901

1690216902
while (true) {
16903-
if (do_yield) {
16904-
sched_yield();
16905-
}
16903+
sched_yield();
1690616904

1690716905
* node_n = atomic_load(&state->shared->node_n);
1690816906
if (* node_n != last_node_n) break;
@@ -16914,9 +16912,7 @@ static void ggml_graph_compute_thread_sync_task(int * task_phase, struct ggml_co
1691416912
const int last_task_phase = * task_phase;
1691516913

1691616914
while (true) {
16917-
if (do_yield) {
16918-
sched_yield();
16919-
}
16915+
sched_yield();
1692016916

1692116917
* task_phase = atomic_load(&state->shared->node_task);
1692216918
if (* task_phase != last_task_phase) break;
@@ -17042,7 +17038,7 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
1704217038
// since it is not clear what is the best approach, it should potentially become user-configurable
1704317039
// ref: https://github.com/ggerganov/ggml/issues/291
1704417040
// UPD: adding the do_yield flag seems to resolve the issue universally
17045-
const bool do_yield = node_n < 0 || cgraph->nodes[node_n]->op == GGML_OP_MUL_MAT;
17041+
const bool do_yield = true;
1704617042
ggml_graph_compute_thread_sync_task(&task_phase, state, do_yield);
1704717043
}
1704817044

0 commit comments

Comments
 (0)