Skip to content

Commit ba51026

Browse files
Don't fail the pass if we can't make shapes more static.
Also, only allow tensor::PadOp and tensor::ConcatOp for now as more extensive testing showed that other ops are not ready yet (e.g. at least tensor::ExtractSliceOp / tensor::InsertSliceOp).
1 parent 1f4fba7 commit ba51026

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

mlir/lib/Dialect/MemRef/Transforms/ReifyResultShapes.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mlir::memref::reifyOpResultShapes(RewriterBase &rewriter,
4040
ReifiedRankedShapedTypeDims reifiedResultShapes;
4141
if (failed(mlir::reifyResultShapes(rewriter, op, reifiedResultShapes)) ||
4242
reifiedResultShapes.empty()) {
43-
return op.emitError() << "failed to get the reified shapes";
43+
return op->emitWarning() << "failed to get the reified shapes";
4444
}
4545

4646
bool modified = false;
@@ -133,12 +133,16 @@ struct ReifyResultShapesPass final
133133

134134
void ReifyResultShapesPass::runOnOperation() {
135135
SmallVector<ReifyRankedShapedTypeOpInterface> ops;
136-
getOperation()->walk(
137-
[&](ReifyRankedShapedTypeOpInterface op) { ops.push_back(op); });
136+
getOperation()->walk([&](ReifyRankedShapedTypeOpInterface op) {
137+
// Some ops have rigid type checkers and need to update their operands.
138+
// Only admit the ones that are explicitly supported for now.
139+
if (!isa<tensor::PadOp, tensor::ConcatOp>(op.getOperation()))
140+
return;
141+
ops.push_back(op);
142+
});
138143
IRRewriter rewriter(&getContext());
139144
for (ReifyRankedShapedTypeOpInterface op : ops) {
140145
rewriter.setInsertionPoint(op);
141-
if (failed(memref::reifyOpResultShapes(rewriter, op)))
142-
return signalPassFailure();
146+
(void)memref::reifyOpResultShapes(rewriter, op);
143147
}
144148
}

0 commit comments

Comments
 (0)