diff options
author | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2025-10-03 14:42:33 -0400 |
---|---|---|
committer | Yaxun (Sam) Liu <yaxun.liu@amd.com> | 2025-10-03 17:38:37 -0400 |
commit | fb458aa91f8fa614086e855ab29749e81e834194 (patch) | |
tree | 31837de688c86b78ada2a253485fc12ea0b0fe2b /llvm/lib/Support/Threading.cpp | |
parent | 9c118aa6a6fedb1006a3a81ebca40f226e5abf93 (diff) | |
download | llvm-fb458aa91f8fa614086e855ab29749e81e834194.zip llvm-fb458aa91f8fa614086e855ab29749e81e834194.tar.gz llvm-fb458aa91f8fa614086e855ab29749e81e834194.tar.bz2 |
Reland "[LLVM] Add GNU make jobserver support (#145131)"
With fix for JobServerTest where default parallel scheduling
strategy is saved/restored.
Diffstat (limited to 'llvm/lib/Support/Threading.cpp')
-rw-r--r-- | llvm/lib/Support/Threading.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp index 693de0e..9da357a 100644 --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/Threading.h" #include "llvm/Config/config.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Support/Jobserver.h" #include <cassert> #include <optional> @@ -51,6 +52,10 @@ int llvm::get_physical_cores() { return -1; } static int computeHostNumHardwareThreads(); unsigned llvm::ThreadPoolStrategy::compute_thread_count() const { + if (UseJobserver) + if (auto JS = JobserverClient::getInstance()) + return JS->getNumJobs(); + int MaxThreadCount = UseHyperThreads ? computeHostNumHardwareThreads() : get_physical_cores(); if (MaxThreadCount <= 0) |