[Mlir-commits] [mlir] [mlir][vector] Update `castAwayContractionLeadingOneDim` to omit transposes solely on leading unit dims. (PR #85694)

Han-Chung Wang llvmlistbot at llvm.org
Mon Mar 25 16:08:31 PDT 2024


================
@@ -399,13 +399,29 @@ mlir::vector::castAwayContractionLeadingOneDim(vector::ContractionOp contractOp,
           transposeResults.push_back(targetExpr);
         }
       }
+
+      // Checks if only the outer, unit dimensions (of size 1) are permuted.
+      // Such transposes do not materially effect the underlying vector and can
+      // be omitted. EG: perm [1, 0, 2] applied to vector<1x1x8xi32>
+      bool tranposeNonOuterUnitDims = false;
+      for (auto [index, dim] :
----------------
hanhanW wrote:

Thanks for the example, I now understand why we need this.. Instead of adding the ad-hoc logic here, would it make sense to add the canonicalization pattern to vector.transpose op?

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


More information about the Mlir-commits mailing list