reset cpu affinity every time for main thread

This commit is contained in:
fmz 2024-05-24 12:53:46 -07:00
parent 467583831c
commit 0ce35a6712

5
ggml.c
View file

@ -19586,8 +19586,6 @@ struct ggml_compute_threadpool * ggml_create_threadpool(struct ggml_threadpool_p
}
}
// Set the main-thread's affinity last
__thread_affinity(workers[0].cpumask);
// Ensure all threads entered the compute loop before returning.
while (atomic_load(&threadpool->n_ready) != threadpool->n_threads_max) { ; }
@ -20119,6 +20117,9 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
threadpool->workers[j].ith = j;
}
// Update main thread affinity to match the current threadpool
__thread_affinity(threadpool->workers[0].cpumask);
// Set up work
threadpool->cgraph = cgraph;
threadpool->cplan = cplan;