aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMehdi Amini <joker.eph@gmail.com>2024-03-05 12:37:11 -0800
committerGitHub <noreply@github.com>2024-03-05 12:37:11 -0800
commit4a4fb930a539c91eb4e9d8b1ea427a7cef72d054 (patch)
tree3b65e34f46ce46fa0b2c3f1dce737d930d061e3c
parenteccc71783c4a7682e4cc876f62feca74889fb192 (diff)
downloadllvm-4a4fb930a539c91eb4e9d8b1ea427a7cef72d054.zip
llvm-4a4fb930a539c91eb4e9d8b1ea427a7cef72d054.tar.gz
llvm-4a4fb930a539c91eb4e9d8b1ea427a7cef72d054.tar.bz2
Use the new ThreadPoolInterface base class instead of the concrete implementation (NFC) (#84056)
-rw-r--r--bolt/include/bolt/Core/ParallelUtilities.h4
-rw-r--r--bolt/lib/Core/ParallelUtilities.cpp6
-rw-r--r--bolt/lib/Passes/IdenticalCodeFolding.cpp2
-rw-r--r--bolt/lib/Rewrite/DWARFRewriter.cpp2
-rw-r--r--llvm/tools/llvm-reduce/deltas/Delta.cpp4
-rw-r--r--mlir/lib/ExecutionEngine/AsyncRuntime.cpp2
6 files changed, 10 insertions, 10 deletions
diff --git a/bolt/include/bolt/Core/ParallelUtilities.h b/bolt/include/bolt/Core/ParallelUtilities.h
index e510525..e7b35a7 100644
--- a/bolt/include/bolt/Core/ParallelUtilities.h
+++ b/bolt/include/bolt/Core/ParallelUtilities.h
@@ -49,8 +49,8 @@ enum SchedulingPolicy {
SP_BB_QUADRATIC, /// cost is estimated by the square of the BB count
};
-/// Return the managed thread pool and initialize it if not initiliazed.
-ThreadPool &getThreadPool();
+/// Return the managed thread pool and initialize it if not initialized.
+ThreadPoolInterface &getThreadPool();
/// Perform the work on each BinaryFunction except those that are accepted
/// by SkipPredicate, scheduling heuristic is based on SchedPolicy.
diff --git a/bolt/lib/Core/ParallelUtilities.cpp b/bolt/lib/Core/ParallelUtilities.cpp
index 1a28bc4..88d9444 100644
--- a/bolt/lib/Core/ParallelUtilities.cpp
+++ b/bolt/lib/Core/ParallelUtilities.cpp
@@ -102,7 +102,7 @@ inline unsigned estimateTotalCost(const BinaryContext &BC,
} // namespace
-ThreadPool &getThreadPool() {
+ThreadPoolInterface &getThreadPool() {
if (ThreadPoolPtr.get())
return *ThreadPoolPtr;
@@ -145,7 +145,7 @@ void runOnEachFunction(BinaryContext &BC, SchedulingPolicy SchedPolicy,
TotalCost > BlocksCount ? TotalCost / BlocksCount : 1;
// Divide work into blocks of equal cost
- ThreadPool &Pool = getThreadPool();
+ ThreadPoolInterface &Pool = getThreadPool();
auto BlockBegin = BC.getBinaryFunctions().begin();
unsigned CurrentCost = 0;
@@ -202,7 +202,7 @@ void runOnEachFunctionWithUniqueAllocId(
TotalCost > BlocksCount ? TotalCost / BlocksCount : 1;
// Divide work into blocks of equal cost
- ThreadPool &Pool = getThreadPool();
+ ThreadPoolInterface &Pool = getThreadPool();
auto BlockBegin = BC.getBinaryFunctions().begin();
unsigned CurrentCost = 0;
unsigned AllocId = 1;
diff --git a/bolt/lib/Passes/IdenticalCodeFolding.cpp b/bolt/lib/Passes/IdenticalCodeFolding.cpp
index 9f8d82b..87eba10 100644
--- a/bolt/lib/Passes/IdenticalCodeFolding.cpp
+++ b/bolt/lib/Passes/IdenticalCodeFolding.cpp
@@ -397,7 +397,7 @@ Error IdenticalCodeFolding::runOnFunctions(BinaryContext &BC) {
Timer SinglePass("single fold pass", "single fold pass");
LLVM_DEBUG(SinglePass.startTimer());
- ThreadPool *ThPool;
+ ThreadPoolInterface *ThPool;
if (!opts::NoThreads)
ThPool = &ParallelUtilities::getThreadPool();
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index ca9d242..85c2397 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -784,7 +784,7 @@ void DWARFRewriter::updateDebugInfo() {
}
} else {
// Update unit debug info in parallel
- ThreadPool &ThreadPool = ParallelUtilities::getThreadPool();
+ ThreadPoolInterface &ThreadPool = ParallelUtilities::getThreadPool();
for (std::unique_ptr<DWARFUnit> &CU : BC.DwCtx->compile_units())
ThreadPool.async(processUnitDIE, CU.get(), &DIEBlder);
ThreadPool.wait();
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 62dfd62..569117e 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -219,7 +219,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
}
std::atomic<bool> AnyReduced;
- std::unique_ptr<ThreadPool> ChunkThreadPoolPtr;
+ std::unique_ptr<ThreadPoolInterface> ChunkThreadPoolPtr;
if (NumJobs > 1)
ChunkThreadPoolPtr =
std::make_unique<ThreadPool>(hardware_concurrency(NumJobs));
@@ -251,7 +251,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
unsigned NumInitialTasks = std::min(WorkLeft, unsigned(NumJobs));
unsigned NumChunksProcessed = 0;
- ThreadPool &ChunkThreadPool = *ChunkThreadPoolPtr;
+ ThreadPoolInterface &ChunkThreadPool = *ChunkThreadPoolPtr;
assert(TaskQueue.empty());
AnyReduced = false;
diff --git a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
index 1899029..ec4a81c 100644
--- a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
@@ -57,7 +57,7 @@ public:
return numRefCountedObjects.load(std::memory_order_relaxed);
}
- llvm::ThreadPool &getThreadPool() { return threadPool; }
+ llvm::ThreadPoolInterface &getThreadPool() { return threadPool; }
private:
friend class RefCounted;