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

Kojo Acquah llvmlistbot at llvm.org
Thu Mar 21 15:04:29 PDT 2024


================
@@ -399,13 +399,28 @@ mlir::vector::castAwayContractionLeadingOneDim(vector::ContractionOp contractOp,
           transposeResults.push_back(targetExpr);
         }
       }
+
+      // Check if the transpose effects outer unit dims only. Such transposes do
+      // not materially effect the underlying vector and can be omitted.
+      bool tranposeNonOuterUnitDims = false;
+      for (int64_t i = 0; i < (int64_t)perm.size(); ++i) {
+        if (perm[i] != i && i != (int64_t)perm.size() - 1) {
----------------
KoolJBlack wrote:

it checks if only the outer, unit dimensions (of size 1) are permuted. Updated the check and the comment to explain

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


More information about the Mlir-commits mailing list