[Mlir-commits] [mlir] [mlir][tosa] Add lowering of `tosa.transpose` to `tosa-to-linalg-named` (PR #75738)

Felix Schneider llvmlistbot at llvm.org
Sun Dec 17 05:23:30 PST 2023


================
@@ -984,6 +985,31 @@ class AvgPool2dConverter : public OpRewritePattern<tosa::AvgPool2dOp> {
   }
 };
 
+class TransposeConverter : public OpRewritePattern<tosa::TransposeOp> {
+public:
+  using OpRewritePattern<tosa::TransposeOp>::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(tosa::TransposeOp op,
+                                PatternRewriter &rewriter) const final {
+    SmallVector<int64_t> constantPerms;
+    if (failed(op.getConstantPerms(constantPerms)))
----------------
ubfx wrote:

> I think it is required to run `TosaToLinalgNamed` to `TosaToLinalg`

I wasn't aware of that requirement and kept the old Pattern mostly in case any downstream pipelines were relying on the direct `tosa.transpose`->`linalg.generic` pathway. But I agree, the two Patterns support the same cases and the old one can be deleted.

https://github.com/llvm/llvm-project/pull/75738


More information about the Mlir-commits mailing list