[Mlir-commits] [mlir] b9cfb6f - [mlir][tosa] Add apply scale flags to TosaToArith creation API
Diego Caballero
llvmlistbot at llvm.org
Thu Sep 8 13:13:51 PDT 2022
Author: Diego Caballero
Date: 2022-09-08T20:11:47Z
New Revision: b9cfb6f7e082b57d8a1c5fc577dd357da60238db
URL: https://github.com/llvm/llvm-project/commit/b9cfb6f7e082b57d8a1c5fc577dd357da60238db
DIFF: https://github.com/llvm/llvm-project/commit/b9cfb6f7e082b57d8a1c5fc577dd357da60238db.diff
LOG: [mlir][tosa] Add apply scale flags to TosaToArith creation API
TosaToArith has two flags to enable/disable 'tosa.apply_scale' ops and
to use a 64-bit/32-bit implementation for it. This patch makes the flags
available from the pass creation API.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D133515
Added:
Modified:
mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h b/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
index 95b815a15cc01..e7158ee3852e1 100644
--- a/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
+++ b/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
@@ -22,7 +22,8 @@ namespace mlir {
namespace tosa {
-std::unique_ptr<Pass> createTosaToArith();
+std::unique_ptr<Pass> createTosaToArith(bool includeApplyRescale = false,
+ bool use32BitApplyRescale = false);
void populateTosaToArithConversionPatterns(RewritePatternSet *patterns);
diff --git a/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp b/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
index 788e2846d4516..85f7c8d79194c 100644
--- a/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
+++ b/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
@@ -31,6 +31,8 @@ using namespace tosa;
namespace {
struct TosaToArith : public impl::TosaToArithBase<TosaToArith> {
public:
+ TosaToArith(TosaToArithOptions &options) : TosaToArithBase(options) {}
+
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
@@ -52,6 +54,8 @@ struct TosaToArith : public impl::TosaToArithBase<TosaToArith> {
};
} // namespace
-std::unique_ptr<Pass> mlir::tosa::createTosaToArith() {
- return std::make_unique<TosaToArith>();
+std::unique_ptr<Pass> mlir::tosa::createTosaToArith(bool includeApplyRescale,
+ bool use32BitApplyRescale) {
+ TosaToArithOptions options = {includeApplyRescale, use32BitApplyRescale};
+ return std::make_unique<TosaToArith>(options);
}
More information about the Mlir-commits
mailing list