Skip to content

Commit 4a4fb93

Browse files
authored
Use the new ThreadPoolInterface base class instead of the concrete implementation (NFC) (#84056)
1 parent eccc717 commit 4a4fb93

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

bolt/include/bolt/Core/ParallelUtilities.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ enum SchedulingPolicy {
4949
SP_BB_QUADRATIC, /// cost is estimated by the square of the BB count
5050
};
5151

52-
/// Return the managed thread pool and initialize it if not initiliazed.
53-
ThreadPool &getThreadPool();
52+
/// Return the managed thread pool and initialize it if not initialized.
53+
ThreadPoolInterface &getThreadPool();
5454

5555
/// Perform the work on each BinaryFunction except those that are accepted
5656
/// by SkipPredicate, scheduling heuristic is based on SchedPolicy.

bolt/lib/Core/ParallelUtilities.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ inline unsigned estimateTotalCost(const BinaryContext &BC,
102102

103103
} // namespace
104104

105-
ThreadPool &getThreadPool() {
105+
ThreadPoolInterface &getThreadPool() {
106106
if (ThreadPoolPtr.get())
107107
return *ThreadPoolPtr;
108108

@@ -145,7 +145,7 @@ void runOnEachFunction(BinaryContext &BC, SchedulingPolicy SchedPolicy,
145145
TotalCost > BlocksCount ? TotalCost / BlocksCount : 1;
146146

147147
// Divide work into blocks of equal cost
148-
ThreadPool &Pool = getThreadPool();
148+
ThreadPoolInterface &Pool = getThreadPool();
149149
auto BlockBegin = BC.getBinaryFunctions().begin();
150150
unsigned CurrentCost = 0;
151151

@@ -202,7 +202,7 @@ void runOnEachFunctionWithUniqueAllocId(
202202
TotalCost > BlocksCount ? TotalCost / BlocksCount : 1;
203203

204204
// Divide work into blocks of equal cost
205-
ThreadPool &Pool = getThreadPool();
205+
ThreadPoolInterface &Pool = getThreadPool();
206206
auto BlockBegin = BC.getBinaryFunctions().begin();
207207
unsigned CurrentCost = 0;
208208
unsigned AllocId = 1;

bolt/lib/Passes/IdenticalCodeFolding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Error IdenticalCodeFolding::runOnFunctions(BinaryContext &BC) {
397397
Timer SinglePass("single fold pass", "single fold pass");
398398
LLVM_DEBUG(SinglePass.startTimer());
399399

400-
ThreadPool *ThPool;
400+
ThreadPoolInterface *ThPool;
401401
if (!opts::NoThreads)
402402
ThPool = &ParallelUtilities::getThreadPool();
403403

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ void DWARFRewriter::updateDebugInfo() {
784784
}
785785
} else {
786786
// Update unit debug info in parallel
787-
ThreadPool &ThreadPool = ParallelUtilities::getThreadPool();
787+
ThreadPoolInterface &ThreadPool = ParallelUtilities::getThreadPool();
788788
for (std::unique_ptr<DWARFUnit> &CU : BC.DwCtx->compile_units())
789789
ThreadPool.async(processUnitDIE, CU.get(), &DIEBlder);
790790
ThreadPool.wait();

llvm/tools/llvm-reduce/deltas/Delta.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
219219
}
220220

221221
std::atomic<bool> AnyReduced;
222-
std::unique_ptr<ThreadPool> ChunkThreadPoolPtr;
222+
std::unique_ptr<ThreadPoolInterface> ChunkThreadPoolPtr;
223223
if (NumJobs > 1)
224224
ChunkThreadPoolPtr =
225225
std::make_unique<ThreadPool>(hardware_concurrency(NumJobs));
@@ -251,7 +251,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
251251
unsigned NumInitialTasks = std::min(WorkLeft, unsigned(NumJobs));
252252
unsigned NumChunksProcessed = 0;
253253

254-
ThreadPool &ChunkThreadPool = *ChunkThreadPoolPtr;
254+
ThreadPoolInterface &ChunkThreadPool = *ChunkThreadPoolPtr;
255255
assert(TaskQueue.empty());
256256

257257
AnyReduced = false;

mlir/lib/ExecutionEngine/AsyncRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class AsyncRuntime {
5757
return numRefCountedObjects.load(std::memory_order_relaxed);
5858
}
5959

60-
llvm::ThreadPool &getThreadPool() { return threadPool; }
60+
llvm::ThreadPoolInterface &getThreadPool() { return threadPool; }
6161

6262
private:
6363
friend class RefCounted;

0 commit comments

Comments
 (0)