fixed a harmless race condition

This commit is contained in:
Faisal Zaghloul 2024-07-31 12:42:30 -04:00 committed by fmz
parent d5c9c14dea
commit 82224f84d7

View file

@ -19300,18 +19300,16 @@ enum ggml_status ggml_graph_compute(struct ggml_cgraph * cgraph, struct ggml_cpl
}; };
threadpool = ggml_create_threadpool_impl(&ttp, true, cgraph, cplan); threadpool = ggml_create_threadpool_impl(&ttp, true, cgraph, cplan);
} else if (n_threads > threadpool->n_threads_max) { } else {
GGML_PRINT("WARNING: cplan is requesting more threads than the threadpool contains. Expect a bad time!\n"); if (n_threads > threadpool->n_threads_max) {
} GGML_PRINT("WARNING: cplan is requesting more threads than the threadpool contains. Expect a bad time!\n");
}
// Set up work // Not a disposable threadpool:
threadpool->cgraph = cgraph;
threadpool->cplan = cplan;
threadpool->n_threads_cur = n_threads;
if (!disposable_threadpool) {
// Reset some of the paramters that need resetting // Reset some of the paramters that need resetting
// No worker threads should be accessing the parameters below at this stage // No worker threads should be accessing the parameters below at this stage
threadpool->cgraph = cgraph;
threadpool->cplan = cplan;
threadpool->n_threads_cur = n_threads;
threadpool->n_barrier = 0; threadpool->n_barrier = 0;
threadpool->n_barrier_passed = 0; threadpool->n_barrier_passed = 0;
threadpool->current_chunk = 0; threadpool->current_chunk = 0;