forked from OSchip/llvm-project
[mlir] Async: Add numWorkerThreads argument to createAsyncParallelForPass
Add an option to pass the number of worker threads to select the number of async regions for parallel for transformation. ``` std::unique_ptr<OperationPass<FuncOp>> createAsyncParallelForPass(int numWorkerThreads); ``` Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D92835
This commit is contained in:
parent
4fede8bc8a
commit
94e645f9cc
|
@ -19,6 +19,9 @@ namespace mlir {
|
|||
|
||||
std::unique_ptr<OperationPass<FuncOp>> createAsyncParallelForPass();
|
||||
|
||||
std::unique_ptr<OperationPass<FuncOp>>
|
||||
createAsyncParallelForPass(int numWorkerThreads);
|
||||
|
||||
std::unique_ptr<OperationPass<FuncOp>> createAsyncRefCountingPass();
|
||||
|
||||
std::unique_ptr<OperationPass<FuncOp>> createAsyncRefCountingOptimizationPass();
|
||||
|
|
|
@ -96,6 +96,10 @@ private:
|
|||
struct AsyncParallelForPass
|
||||
: public AsyncParallelForBase<AsyncParallelForPass> {
|
||||
AsyncParallelForPass() = default;
|
||||
AsyncParallelForPass(int numWorkerThreads) {
|
||||
assert(numWorkerThreads >= 1);
|
||||
numConcurrentAsyncExecute = numWorkerThreads;
|
||||
}
|
||||
void runOnFunction() override;
|
||||
};
|
||||
|
||||
|
@ -276,3 +280,8 @@ void AsyncParallelForPass::runOnFunction() {
|
|||
std::unique_ptr<OperationPass<FuncOp>> mlir::createAsyncParallelForPass() {
|
||||
return std::make_unique<AsyncParallelForPass>();
|
||||
}
|
||||
|
||||
std::unique_ptr<OperationPass<FuncOp>>
|
||||
mlir::createAsyncParallelForPass(int numWorkerThreads) {
|
||||
return std::make_unique<AsyncParallelForPass>(numWorkerThreads);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue