[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 14:33:40 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) {
+ if (operands[it.index()].getType().cast<ShapedType>().getDimSize(i) !=
+ 1) {
----------------
KoolJBlack wrote:
Noted. I reformatted the if clauses into a single if which I think is best suited with braces for readability.
https://github.com/llvm/llvm-project/pull/85694
More information about the Mlir-commits
mailing list