From 286debc3bafa74d15e740696fc20ae078a5ebbbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 7 Nov 2026 12:05:12 +0100 Subject: [PATCH] Cap the number of thread again (at a very high count) --- Common/Thread/ThreadManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Common/Thread/ThreadManager.cpp b/Common/Thread/ThreadManager.cpp index acfcab7040..428f7ff438 100644 --- a/Common/Thread/ThreadManager.cpp +++ b/Common/Thread/ThreadManager.cpp @@ -207,14 +207,14 @@ void ThreadManager::Init(int numRealCores, int numLogicalCoresPerCpu) { Teardown(); } - numComputeThreads_ = numRealCores * numLogicalCoresPerCpu; + numComputeThreads_ = std::min(32, numRealCores * numLogicalCoresPerCpu); // Double it for the IO blocking threads. - int numThreads = numComputeThreads_ + std::max(MIN_IO_BLOCKING_THREADS, numComputeThreads_); - numThreads_ = numThreads; + const int numIOThreads = std::min(32, std::max(MIN_IO_BLOCKING_THREADS, numComputeThreads_) * 2); + numThreads_ = numComputeThreads_ + numIOThreads; INFO_LOG(Log::System, "ThreadManager::Init(compute threads: %d, all: %d)", numComputeThreads_, numThreads_); - for (int i = 0; i < numThreads; i++) { + for (int i = 0; i < numThreads_; i++) { TaskThreadContext *thread = new TaskThreadContext(); thread->cancelled.store(false); thread->type = i < numComputeThreads_ ? TaskType::CPU_COMPUTE : TaskType::IO_BLOCKING;