[Mlir-commits] [mlir] [mlir][vector] Handle corner cases in DropUnitDimsFromTransposeOp. (PR #102518)

Benjamin Maxwell llvmlistbot at llvm.org
Thu Aug 8 11:40:02 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()) {
----------------
MacDue wrote:

I think the test is okay :+1: 

Btw, to check for a unit dim you would have to do `sourceDims[0] == std::make_tuple(1, false)` (to check the scalability too).

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


More information about the Mlir-commits mailing list