[Mlir-commits] [mlir] [mlir][linalg] Use ub.poison in data layout propagation if a packed operand requires padding. (PR #159467)

Han-Chung Wang llvmlistbot at llvm.org
Fri Sep 19 14:17:54 PDT 2025


================
@@ -287,12 +288,24 @@ getOrCreatePackedViewOfOperand(OpBuilder &b, Location loc, PackInfo packInfo,
   // The operand does not have dimensions that relates to pack op.
   if (innerDimsPos.empty() && outerDimsPerm.empty())
     return std::make_tuple(opOperand->get(), indexingMap);
-
+  auto inputType = cast<RankedTensorType>(opOperand->get().getType());
+  auto maybeIntInnerTileSizes = getConstantIntValues(innerTileSizes);
+  if (!maybeIntInnerTileSizes.has_value()) {
+    return failure();
+  }
----------------
hanhanW wrote:

Then we don't need the check.

And then what you want is something like

```cpp
  llvm::map_to_vector(innerTileSizes, [](OpFoldResult ofr) {
      std::optional<int64_t> maybeCst = getConstantIntValue(ofr);
      return maybeCst.value_or(ShapedType::kDynamic);
  });
```

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


More information about the Mlir-commits mailing list