@@ -219,6 +219,11 @@ struct PackedOperandsDimList {
219219FailureOr<LowerPackResult> linalg::lowerPack (RewriterBase &rewriter,
220220 linalg::PackOp packOp,
221221 bool lowerPadLikeWithInsertSlice) {
222+ // TODO(issues/129004): Support MemRef PackOp. Temporarily return failure.
223+ if (!packOp.hasPureTensorSemantics ()) {
224+ return failure ();
225+ }
226+
222227 // 1. Filter out NYI cases.
223228 auto packedTensorType =
224229 cast<RankedTensorType>(packOp->getResultTypes ().front ());
@@ -355,6 +360,11 @@ FailureOr<LowerPackResult> linalg::lowerPack(RewriterBase &rewriter,
355360FailureOr<LowerUnPackOpResult>
356361linalg::lowerUnPack (RewriterBase &rewriter, linalg::UnPackOp unPackOp,
357362 bool lowerUnpadLikeWithExtractSlice) {
363+ // TODO(issues/129004): Support MemRef UnPackOp. Temporarily return failure.
364+ if (!unPackOp.hasPureTensorSemantics ()) {
365+ return failure ();
366+ }
367+
358368 Location loc = unPackOp->getLoc ();
359369 OpBuilder::InsertionGuard g (rewriter);
360370 rewriter.setInsertionPoint (unPackOp);
@@ -1032,6 +1042,11 @@ static Value getPackOpSourceOrPaddedSource(OpBuilder &builder,
10321042 return input;
10331043 }
10341044
1045+ // TODO(issues/129004): Support MemRef PackOp. Temporarily return failure.
1046+ if (!packOp.hasPureTensorSemantics ()) {
1047+ return packOp.getSource ();
1048+ }
1049+
10351050 assert (llvm::all_of (packOp.getAllOuterDims (),
10361051 [](int64_t val) { return val == 1 ; }) &&
10371052 " some outer dims are != 1" );
@@ -1144,6 +1159,11 @@ getPackUnpackRankReducedPerm(ArrayRef<int64_t> shape,
11441159
11451160LogicalResult DecomposeOuterUnitDimsPackOpPattern::matchAndRewrite (
11461161 linalg::PackOp packOp, PatternRewriter &rewriter) const {
1162+ // TODO(issues/129004): Support MemRef PackOp. Temporarily return failure.
1163+ if (!packOp.hasPureTensorSemantics ()) {
1164+ return failure ();
1165+ }
1166+
11471167 // TODO: support the case that outer dimensions are not all 1s. A
11481168 // tensor.expand_shape will be generated in this case.
11491169 if (llvm::any_of (packOp.getAllOuterDims (),
@@ -1245,6 +1265,11 @@ LogicalResult DecomposeOuterUnitDimsPackOpPattern::matchAndRewrite(
12451265
12461266LogicalResult DecomposeOuterUnitDimsUnPackOpPattern::matchAndRewrite (
12471267 linalg::UnPackOp unpackOp, PatternRewriter &rewriter) const {
1268+ // TODO(issues/129004): Support MemRef UnPackOp. Temporarily return failure.
1269+ if (!unpackOp.hasPureTensorSemantics ()) {
1270+ return failure ();
1271+ }
1272+
12481273 int64_t srcRank = unpackOp.getSourceRank ();
12491274 int64_t destRank = unpackOp.getDestRank ();
12501275 ArrayRef<int64_t > srcShape = unpackOp.getSourceType ().getShape ();
0 commit comments