[Mlir-commits] [mlir] [mlir][linalg] fix OuterUnitDims linalg.pack decomposition pattern (PR #141613)

Christopher McGirr llvmlistbot at llvm.org
Wed May 28 00:28:35 PDT 2025


================
@@ -1205,16 +1205,23 @@ LogicalResult DecomposeOuterUnitDimsPackOpPattern::matchAndRewrite(
   //    %init = tensor.empty()
   //    %transposed_tile = linalg.transpose ins(%source_or_padded_source),
   //                                        outs(%init)
-  // Two assumptions are made:
-  //  1. All outer dims are 1 - the corresponding transposition doesn't matter.
-  //  2. Inner dims position correspond to the trailing `numTiles` dims.
-  SmallVector<int64_t> tilesPermNormalized =
-      getPackUnpackNormalizedPerm(srcRank, packOp.getInnerDimsPos());
+  // Assumptions made:
+  //  1. Inner dims position correspond to the trailing `numTiles` dims.
----------------
chrsmcgrr wrote:

@banach-space thank you for the explanation :)

Would then modifying the [check for trailing dimensions](https://github.com/llvm/llvm-project/blob/8adcc8a669f093d6fe74645900515e4561102248/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp#L1182-L1187) make more sense? To then block my use-case and handle it in another pattern? 

Or would you be ok in supporting my use case in this pattern? I would also then update the comments to reflect this explanation.  

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


More information about the Mlir-commits mailing list