[Mlir-commits] [mlir] [mlir][vector] Handle corner cases in DropUnitDimsFromTransposeOp. (PR #102518)
Han-Chung Wang
llvmlistbot at llvm.org
Thu Aug 8 11:35:03 PDT 2024
================
@@ -1771,6 +1771,14 @@ struct DropUnitDimsFromTransposeOp final
newPerm.push_back(idx - droppedDimsBefore[idx]);
}
+ // Fixup for `newPerm`. The `sourceTypeWithoutUnitDims` could be vector<1xT>
+ // type when the dimensions are unit dimensions. In this case, the newPerm
+ // should be [0].
+ if (sourceTypeWithoutUnitDims.getRank() == 1 &&
+ sourceTypeWithoutUnitDims.getShape()[0] == 1 && newPerm.empty()) {
----------------
hanhanW wrote:
Yes, it could be. My concern was that it could be wrong if someone updates `dropNonScalableUnitDimFromType`. The test should be able to capture the case I guess, so I'm okay with just checking `newPerm.empty()`.
https://github.com/llvm/llvm-project/pull/102518
More information about the Mlir-commits
mailing list