[Mlir-commits] [mlir] fbf719b - [mlir] Fix legal/illegal ops in TosaToTensor & TosaToLinalg

Maya Amrami llvmlistbot at llvm.org
Thu Mar 16 06:15:45 PDT 2023


Author: Maya Amrami
Date: 2023-03-16T15:15:38+02:00
New Revision: fbf719b86846fa35b6dd0e658e107afc9973fc86

URL: https://github.com/llvm/llvm-project/commit/fbf719b86846fa35b6dd0e658e107afc9973fc86
DIFF: https://github.com/llvm/llvm-project/commit/fbf719b86846fa35b6dd0e658e107afc9973fc86.diff

LOG: [mlir] Fix legal/illegal ops in TosaToTensor & TosaToLinalg

tosa.reshape and tosa.concat were moved from TosaToLinalg to TosaToTensor
(D145119 & D145952). So now they are legal after applying TosaToLinalg patterns,
and illegal after applying TosaToTensor patterns.

This includes D146174 (thanks @ramiro050!)

Reviewed By: krzysz00

Differential Revision: https://reviews.llvm.org/D146213

Added: 
    

Modified: 
    mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
    mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
index f3a76ddfcde78..820cadbf62b56 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
@@ -55,6 +55,7 @@ struct TosaToLinalg : public impl::TosaToLinalgBase<TosaToLinalg> {
     target.addLegalOp<tosa::IfOp>();
     target.addLegalOp<tosa::ConstOp>();
     target.addLegalOp<tosa::WhileOp>();
+    target.addLegalOp<tosa::ConcatOp>();
     target.addLegalOp<tosa::SliceOp>();
     target.addLegalOp<tosa::ReshapeOp>();
     target.addLegalOp<tosa::PadOp>();

diff  --git a/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp b/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
index af6a08e7bcf14..50dc55667fb94 100644
--- a/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
+++ b/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
@@ -35,6 +35,8 @@ struct TosaToTensor : public impl::TosaToTensorBase<TosaToTensor> {
   void runOnOperation() override {
     RewritePatternSet patterns(&getContext());
     ConversionTarget target(getContext());
+    target.addIllegalOp<tosa::ConcatOp>();
+    target.addIllegalOp<tosa::ReshapeOp>();
     target.addIllegalOp<tosa::SliceOp>();
     target.addIllegalOp<tosa::PadOp>();
     target.addLegalDialect<arith::ArithDialect>();


        


More information about the Mlir-commits mailing list