-
Notifications
You must be signed in to change notification settings - Fork 14.2k
[MLIR][NFC] Retire let constructor for Async #137461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MLIR][NFC] Retire let constructor for Async #137461
Conversation
@llvm/pr-subscribers-mlir-async @llvm/pr-subscribers-mlir Author: lorenzo chelini (chelini) Changeslet constructor is legacy (do not use in tree!) since the tableGen Note: The following constructor has been retired: std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,
int32_t numWorkerThreads,
int32_t minTaskSize); To update your codebase, replace it with the new options-based API: AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/};
createAsyncParallelForPass(options); Full diff: https://github.com/llvm/llvm-project/pull/137461.diff 6 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Async/Passes.h b/mlir/include/mlir/Dialect/Async/Passes.h
index 090768cd0209c..20831d2a71187 100644
--- a/mlir/include/mlir/Dialect/Async/Passes.h
+++ b/mlir/include/mlir/Dialect/Async/Passes.h
@@ -22,25 +22,9 @@ class ConversionTarget;
#define GEN_PASS_DECL
#include "mlir/Dialect/Async/Passes.h.inc"
-std::unique_ptr<Pass> createAsyncParallelForPass();
-
-std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,
- int32_t numWorkerThreads,
- int32_t minTaskSize);
-
void populateAsyncFuncToAsyncRuntimeConversionPatterns(
RewritePatternSet &patterns, ConversionTarget &target);
-std::unique_ptr<OperationPass<ModuleOp>> createAsyncFuncToAsyncRuntimePass();
-
-std::unique_ptr<OperationPass<ModuleOp>> createAsyncToAsyncRuntimePass();
-
-std::unique_ptr<Pass> createAsyncRuntimeRefCountingPass();
-
-std::unique_ptr<Pass> createAsyncRuntimeRefCountingOptPass();
-
-std::unique_ptr<Pass> createAsyncRuntimePolicyBasedRefCountingPass();
-
//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/Async/Passes.td b/mlir/include/mlir/Dialect/Async/Passes.td
index f0ef83ca3fd4f..8bbb542d3acf4 100644
--- a/mlir/include/mlir/Dialect/Async/Passes.td
+++ b/mlir/include/mlir/Dialect/Async/Passes.td
@@ -11,10 +11,9 @@
include "mlir/Pass/PassBase.td"
-def AsyncParallelFor : Pass<"async-parallel-for", "ModuleOp"> {
+def AsyncParallelForPass : Pass<"async-parallel-for", "ModuleOp"> {
let summary = "Convert scf.parallel operations to multiple async compute ops "
"executed concurrently for non-overlapping iteration ranges";
- let constructor = "mlir::createAsyncParallelForPass()";
let options = [
Option<"asyncDispatch", "async-dispatch",
@@ -41,21 +40,20 @@ def AsyncParallelFor : Pass<"async-parallel-for", "ModuleOp"> {
];
}
-def AsyncToAsyncRuntime : Pass<"async-to-async-runtime", "ModuleOp"> {
+def AsyncToAsyncRuntimePass : Pass<"async-to-async-runtime", "ModuleOp"> {
let summary = "Lower all high level async operations (e.g. async.execute) to"
"the explicit async.runtime and async.coro operations";
- let constructor = "mlir::createAsyncToAsyncRuntimePass()";
let dependentDialects = ["async::AsyncDialect", "func::FuncDialect", "cf::ControlFlowDialect"];
}
-def AsyncFuncToAsyncRuntime : Pass<"async-func-to-async-runtime", "ModuleOp"> {
+def AsyncFuncToAsyncRuntimePass
+ : Pass<"async-func-to-async-runtime", "ModuleOp"> {
let summary = "Lower async.func operations to the explicit async.runtime and"
"async.coro operations";
- let constructor = "mlir::createAsyncFuncToAsyncRuntimePass()";
let dependentDialects = ["async::AsyncDialect", "func::FuncDialect"];
}
-def AsyncRuntimeRefCounting : Pass<"async-runtime-ref-counting"> {
+def AsyncRuntimeRefCountingPass : Pass<"async-runtime-ref-counting"> {
let summary = "Automatic reference counting for Async runtime operations";
let description = [{
This pass works at the async runtime abtraction level, after all
@@ -68,18 +66,17 @@ def AsyncRuntimeRefCounting : Pass<"async-runtime-ref-counting"> {
See: https://llvm.org/docs/Coroutines.html#switched-resume-lowering
}];
- let constructor = "mlir::createAsyncRuntimeRefCountingPass()";
let dependentDialects = ["async::AsyncDialect"];
}
-def AsyncRuntimeRefCountingOpt : Pass<"async-runtime-ref-counting-opt"> {
+def AsyncRuntimeRefCountingOptPass : Pass<"async-runtime-ref-counting-opt"> {
let summary = "Optimize automatic reference counting operations for the"
"Async runtime by removing redundant operations";
- let constructor = "mlir::createAsyncRuntimeRefCountingOptPass()";
+
let dependentDialects = ["async::AsyncDialect"];
}
-def AsyncRuntimePolicyBasedRefCounting
+def AsyncRuntimePolicyBasedRefCountingPass
: Pass<"async-runtime-policy-based-ref-counting"> {
let summary = "Policy based reference counting for Async runtime operations";
let description = [{
@@ -107,7 +104,6 @@ def AsyncRuntimePolicyBasedRefCounting
automatic reference counting.
}];
- let constructor = "mlir::createAsyncRuntimePolicyBasedRefCountingPass()";
let dependentDialects = ["async::AsyncDialect"];
}
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
index 1320523aa989d..9c776dfa176a4 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
@@ -28,7 +28,7 @@
#include <utility>
namespace mlir {
-#define GEN_PASS_DEF_ASYNCPARALLELFOR
+#define GEN_PASS_DEF_ASYNCPARALLELFORPASS
#include "mlir/Dialect/Async/Passes.h.inc"
} // namespace mlir
@@ -99,15 +99,8 @@ namespace {
// }
//
struct AsyncParallelForPass
- : public impl::AsyncParallelForBase<AsyncParallelForPass> {
- AsyncParallelForPass() = default;
-
- AsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads,
- int32_t minTaskSize) {
- this->asyncDispatch = asyncDispatch;
- this->numWorkerThreads = numWorkerThreads;
- this->minTaskSize = minTaskSize;
- }
+ : public impl::AsyncParallelForPassBase<AsyncParallelForPass> {
+ using Base::Base;
void runOnOperation() override;
};
@@ -935,17 +928,6 @@ void AsyncParallelForPass::runOnOperation() {
signalPassFailure();
}
-std::unique_ptr<Pass> mlir::createAsyncParallelForPass() {
- return std::make_unique<AsyncParallelForPass>();
-}
-
-std::unique_ptr<Pass> mlir::createAsyncParallelForPass(bool asyncDispatch,
- int32_t numWorkerThreads,
- int32_t minTaskSize) {
- return std::make_unique<AsyncParallelForPass>(asyncDispatch, numWorkerThreads,
- minTaskSize);
-}
-
void mlir::async::populateAsyncParallelForPatterns(
RewritePatternSet &patterns, bool asyncDispatch, int32_t numWorkerThreads,
const AsyncMinTaskSizeComputationFunction &computeMinTaskSize) {
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
index 5cc30b629aef4..27a51c8cba769 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
@@ -23,8 +23,8 @@
#include "llvm/ADT/SmallSet.h"
namespace mlir {
-#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTING
-#define GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING
+#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGPASS
+#define GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTINGPASS
#include "mlir/Dialect/Async/Passes.h.inc"
} // namespace mlir
@@ -109,7 +109,8 @@ static LogicalResult walkReferenceCountedValues(
namespace {
class AsyncRuntimeRefCountingPass
- : public impl::AsyncRuntimeRefCountingBase<AsyncRuntimeRefCountingPass> {
+ : public impl::AsyncRuntimeRefCountingPassBase<
+ AsyncRuntimeRefCountingPass> {
public:
AsyncRuntimeRefCountingPass() = default;
void runOnOperation() override;
@@ -468,7 +469,7 @@ void AsyncRuntimeRefCountingPass::runOnOperation() {
namespace {
class AsyncRuntimePolicyBasedRefCountingPass
- : public impl::AsyncRuntimePolicyBasedRefCountingBase<
+ : public impl::AsyncRuntimePolicyBasedRefCountingPassBase<
AsyncRuntimePolicyBasedRefCountingPass> {
public:
AsyncRuntimePolicyBasedRefCountingPass() { initializeDefaultPolicy(); }
@@ -553,13 +554,3 @@ void AsyncRuntimePolicyBasedRefCountingPass::runOnOperation() {
if (failed(walkReferenceCountedValues(getOperation(), functor)))
signalPassFailure();
}
-
-//----------------------------------------------------------------------------//
-
-std::unique_ptr<Pass> mlir::createAsyncRuntimeRefCountingPass() {
- return std::make_unique<AsyncRuntimeRefCountingPass>();
-}
-
-std::unique_ptr<Pass> mlir::createAsyncRuntimePolicyBasedRefCountingPass() {
- return std::make_unique<AsyncRuntimePolicyBasedRefCountingPass>();
-}
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
index e4504df93b82d..48e2cf8e2b006 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
@@ -18,7 +18,7 @@
#include "llvm/Support/Debug.h"
namespace mlir {
-#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPT
+#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPTPASS
#include "mlir/Dialect/Async/Passes.h.inc"
} // namespace mlir
@@ -30,7 +30,7 @@ using namespace mlir::async;
namespace {
class AsyncRuntimeRefCountingOptPass
- : public impl::AsyncRuntimeRefCountingOptBase<
+ : public impl::AsyncRuntimeRefCountingOptPassBase<
AsyncRuntimeRefCountingOptPass> {
public:
AsyncRuntimeRefCountingOptPass() = default;
@@ -230,7 +230,3 @@ void AsyncRuntimeRefCountingOptPass::runOnOperation() {
kv.second->erase();
}
}
-
-std::unique_ptr<Pass> mlir::createAsyncRuntimeRefCountingOptPass() {
- return std::make_unique<AsyncRuntimeRefCountingOptPass>();
-}
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 402be0f29e5c7..6b993d0fdf23f 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -32,8 +32,8 @@
#include <optional>
namespace mlir {
-#define GEN_PASS_DEF_ASYNCTOASYNCRUNTIME
-#define GEN_PASS_DEF_ASYNCFUNCTOASYNCRUNTIME
+#define GEN_PASS_DEF_ASYNCTOASYNCRUNTIMEPASS
+#define GEN_PASS_DEF_ASYNCFUNCTOASYNCRUNTIMEPASS
#include "mlir/Dialect/Async/Passes.h.inc"
} // namespace mlir
@@ -47,7 +47,7 @@ static constexpr const char kAsyncFnPrefix[] = "async_execute_fn";
namespace {
class AsyncToAsyncRuntimePass
- : public impl::AsyncToAsyncRuntimeBase<AsyncToAsyncRuntimePass> {
+ : public impl::AsyncToAsyncRuntimePassBase<AsyncToAsyncRuntimePass> {
public:
AsyncToAsyncRuntimePass() = default;
void runOnOperation() override;
@@ -58,7 +58,8 @@ class AsyncToAsyncRuntimePass
namespace {
class AsyncFuncToAsyncRuntimePass
- : public impl::AsyncFuncToAsyncRuntimeBase<AsyncFuncToAsyncRuntimePass> {
+ : public impl::AsyncFuncToAsyncRuntimePassBase<
+ AsyncFuncToAsyncRuntimePass> {
public:
AsyncFuncToAsyncRuntimePass() = default;
void runOnOperation() override;
@@ -895,13 +896,4 @@ void AsyncFuncToAsyncRuntimePass::runOnOperation() {
signalPassFailure();
return;
}
-}
-
-std::unique_ptr<OperationPass<ModuleOp>> mlir::createAsyncToAsyncRuntimePass() {
- return std::make_unique<AsyncToAsyncRuntimePass>();
-}
-
-std::unique_ptr<OperationPass<ModuleOp>>
-mlir::createAsyncFuncToAsyncRuntimePass() {
- return std::make_unique<AsyncFuncToAsyncRuntimePass>();
-}
+}
\ No newline at end of file
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
let constructor is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass. Note: The following constructor has been retired: ```cpp std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads, int32_t minTaskSize); ``` To update your codebase, replace it with the new options-based API: ```cpp AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/}; createAsyncParallelForPass(options); ```
let constructor is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass. Note: The following constructor has been retired: ```cpp std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads, int32_t minTaskSize); ``` To update your codebase, replace it with the new options-based API: ```cpp AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/}; createAsyncParallelForPass(options); ```
let constructor is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass. Note: The following constructor has been retired: ```cpp std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads, int32_t minTaskSize); ``` To update your codebase, replace it with the new options-based API: ```cpp AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/}; createAsyncParallelForPass(options); ```
let constructor is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass. Note: The following constructor has been retired: ```cpp std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads, int32_t minTaskSize); ``` To update your codebase, replace it with the new options-based API: ```cpp AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/}; createAsyncParallelForPass(options); ```
let constructor is legacy (do not use in tree!) since the tableGen backend emits most of the glue logic to build a pass. Note: The following constructor has been retired: ```cpp std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads, int32_t minTaskSize); ``` To update your codebase, replace it with the new options-based API: ```cpp AsyncParallelForPassOptions options{/*asyncDispatch=*/, /*numWorkerThreads=*/, /*minTaskSize=*/}; createAsyncParallelForPass(options); ```
let constructor is legacy (do not use in tree!) since the tableGen
backend emits most of the glue logic to build a pass.
Note: The following constructor has been retired:
To update your codebase, replace it with the new options-based API: