[Mlir-commits] [mlir] [MLIR][Linalg] pack, unpack to take memref inputs (PR #129036)
Han-Chung Wang
llvmlistbot at llvm.org
Tue Apr 1 15:22:10 PDT 2025
================
@@ -4426,15 +4428,30 @@ static LogicalResult commonVerifierPackAndUnPackOp(OpTy packOrUnPack) {
tiles, [](OpFoldResult tile) { return isConstantIntValue(tile, 0); });
};
+ // Verify that the source and destination are ranked types.
+ if (!packOrUnPack.getSourceType().hasRank() ||
+ !packOrUnPack.getDestType().hasRank()) {
+ return op->emitError(
+ "expected both source and destination to be shaped types");
+ }
+
// Verify tiles. Do not allow zero tiles.
SmallVector<OpFoldResult> mixedTiles = packOrUnPack.getMixedTiles();
if (hasZeros(mixedTiles))
return op->emitError("invalid zero tile factor");
+ // Verify that the Operation does not have mixed tensor/buffer semantics.
+ if (!packOrUnPack.hasPureBufferSemantics() &&
+ !packOrUnPack.hasPureTensorSemantics()) {
+ return op->emitError("mixing tensor and buffer semantics is not allowed");
----------------
hanhanW wrote:
Can you add a test to invalid.mlir which reflects the check?
https://github.com/llvm/llvm-project/blob/e55164ae1098bbf8ceb87b83a4b282b08bb7bef9/mlir/test/Dialect/Linalg/invalid.mlir#L1489-L1491
https://github.com/llvm/llvm-project/pull/129036
More information about the Mlir-commits
mailing list