From 27ceff33d3bc5acc4d7fa8d9fd0a9610d85b7006 Mon Sep 17 00:00:00 2001 From: Hanyu Deng Date: Thu, 10 Apr 2025 22:37:36 +0800 Subject: [PATCH] Revert changes in pocketfft.h --- mlx/3rdparty/pocketfft.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mlx/3rdparty/pocketfft.h b/mlx/3rdparty/pocketfft.h index dc15c61be..03a45897a 100644 --- a/mlx/3rdparty/pocketfft.h +++ b/mlx/3rdparty/pocketfft.h @@ -537,11 +537,7 @@ inline size_t &num_threads() static thread_local size_t num_threads_=1; return num_threads_; } -inline const size_t &max_threads() - { - static thread_local const size_t max_threads_ = std::max(1u, std::thread::hardware_concurrency()); - return max_threads_; - } +static const size_t max_threads = std::max(1u, std::thread::hardware_concurrency()); class latch { @@ -725,7 +721,7 @@ class thread_pool workers_(nthreads) { create_threads(); } - thread_pool(): thread_pool(max_threads()) {} + thread_pool(): thread_pool(max_threads) {} ~thread_pool() { shutdown(); } @@ -790,7 +786,7 @@ template void thread_map(size_t nthreads, Func f) { if (nthreads == 0) - nthreads = max_threads(); + nthreads = max_threads; if (nthreads == 1) { f(); return; }