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

Spenser Bauman llvmlistbot at llvm.org
Sun Dec 17 05:19:20 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)))
----------------
sabauma wrote:

Is there any reason to not delete the existing lowering in `TosaToLinalg` as well? This rewrite looks like it supports the same set of cases, and I think it is required to run `TosaToLinalgNamed` to `TosaToLinalg`, so the old lowering would effectively be dead code.

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


More information about the Mlir-commits mailing list