[Mlir-commits] [mlir] [MLIR] Fix canonicalization of extract_slice(unpack) (PR #181840)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Feb 18 12:52:10 PST 2026


================
@@ -6407,6 +6409,15 @@ bool UnPackOp::canFoldSliceOp(tensor::ExtractSliceOp sliceOp) {
     if (paddingSize >= tileSize)
       return false;
   }
+  for (int64_t pos = 0, e = outerShapeWithoutTranspose.size(); pos < e; ++pos) {
+    if (areOuterDimsTiled[pos])
+      continue;
+    int64_t dim = outerShapeWithoutTranspose[pos];
+    if (ShapedType::isDynamic(dim))
+      return false;
+    if (dim != unpackedTypeAfterFold.getDimSize(pos))
+      return false;
----------------
banach-space wrote:

Please add comments explaining _why_ we need these conditions. This is quite non-trivial IMO

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


More information about the Mlir-commits mailing list