Skip to content

Commit 0ce35a6

Browse files
committed
reset cpu affinity every time for main thread
1 parent 4675838 commit 0ce35a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ggml.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19586,8 +19586,6 @@ struct ggml_compute_threadpool * ggml_create_threadpool(struct ggml_threadpool_p
1958619586
}
1958719587
}
1958819588

19589-
// Set the main-thread's affinity last
19590-
__thread_affinity(workers[0].cpumask);
1959119589
// Ensure all threads entered the compute loop before returning.
1959219590
while (atomic_load(&threadpool->n_ready) != threadpool->n_threads_max) { ; }
1959319591

@@ -20119,6 +20117,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
2011920117
threadpool->workers[j].ith = j;
2012020118
}
2012120119

20120+
// Update main thread affinity to match the current threadpool
20121+
__thread_affinity(threadpool->workers[0].cpumask);
20122+
2012220123
// Set up work
2012320124
threadpool->cgraph = cgraph;
2012420125
threadpool->cplan = cplan;

0 commit comments

Comments
 (0)