[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
================
@@ -4471,12 +4488,17 @@ static LogicalResult commonVerifierPackAndUnPackOp(OpTy packOrUnPack) {
// Verify result shape is greater than the minimum expected
// by the pack operation, and that the output shape
// represents full tiles.
- RankedTensorType expectedPackedType = PackOp::inferPackedType(
- unpackedType, packOrUnPack.getStaticTiles(), innerDimsPos, outerDimPerm);
- if (!areAllInBound(expectedPackedType.getShape(), packedType.getShape())) {
- return op->emitError("the shape of output is not large enough to hold the "
- "packed data. Expected at least ")
- << expectedPackedType << ", got " << packedType;
+ if (hasTensorSemantics) {
+ RankedTensorType expectedPackedType = PackOp::inferPackedTensorType(
+ cast<RankedTensorType>(unpackedType), packOrUnPack.getStaticTiles(),
+ innerDimsPos, outerDimPerm);
+ if (!areAllInBound(expectedPackedType.getShape(), packedType.getShape())) {
+ return op->emitError(
+ "the shape of output is not large enough to hold the "
+ "packed data. Expected at least ")
+ << expectedPackedType << ", got " << packedType;
+ }
+ } else {
}
----------------
hanhanW wrote:
We should check if the shape from `inferPackedMemRefType` is compatible with the shape from `dest`. This makes me think that we should probably need `inferPackedShape` method instead. How about we keep the `inferPackedType` as what it is and we introduce the `inferPackedShape`. Then the new method can be used for both tensor types and memref types verification.
https://github.com/llvm/llvm-project/pull/129036
More information about the Mlir-commits
mailing list