[Mlir-commits] [mlir] 094689f - [mlir] Expose Arith::ExpandOps options in constructor
Robert Suderman
llvmlistbot at llvm.org
Thu Apr 20 11:20:53 PDT 2023
Author: Robert Suderman
Date: 2023-04-20T18:18:52Z
New Revision: 094689fe10db0a7149ff8f71f265822cd8500cb8
URL: https://github.com/llvm/llvm-project/commit/094689fe10db0a7149ff8f71f265822cd8500cb8
DIFF: https://github.com/llvm/llvm-project/commit/094689fe10db0a7149ff8f71f265822cd8500cb8.diff
LOG: [mlir] Expose Arith::ExpandOps options in constructor
ExpandOpsPass could only be configured via command line flags. Updated
to allowed constructing using the specified Options structure.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D148820
Added:
Modified:
mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h b/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
index 6d60f8aefd63c..1aa2e55dfdc98 100644
--- a/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
@@ -47,6 +47,10 @@ void populateArithExpandOpsPatterns(RewritePatternSet &patterns);
/// Create a pass to legalize Arith ops.
std::unique_ptr<Pass> createArithExpandOpsPass();
+/// Create a pass to legalize Arith ops with specified configuration.
+std::unique_ptr<Pass>
+createArithExpandOpsPass(const ArithExpandOpsOptions &options);
+
/// Create a pass to replace signed ops with unsigned ones where they are proven
/// equivalent.
std::unique_ptr<Pass> createArithUnsignedWhenEquivalentPass();
diff --git a/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
index 78fc8a51080c4..9810d2923da40 100644
--- a/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
@@ -304,6 +304,11 @@ struct BFloat16TruncFOpConverter : public OpRewritePattern<arith::TruncFOp> {
struct ArithExpandOpsPass
: public arith::impl::ArithExpandOpsBase<ArithExpandOpsPass> {
+ ArithExpandOpsPass() = default;
+ ArithExpandOpsPass(const arith::ArithExpandOpsOptions& options) {
+ this->includeBf16 = options.includeBf16;
+ }
+
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
@@ -371,3 +376,8 @@ void mlir::arith::populateArithExpandOpsPatterns(RewritePatternSet &patterns) {
std::unique_ptr<Pass> mlir::arith::createArithExpandOpsPass() {
return std::make_unique<ArithExpandOpsPass>();
}
+
+std::unique_ptr<Pass> mlir::arith::createArithExpandOpsPass(
+ const ArithExpandOpsOptions& options) {
+ return std::make_unique<ArithExpandOpsPass>(options);
+}
More information about the Mlir-commits
mailing list