Skip to content

Commit 62bed56

Browse files
authored
[mlir][tensor] Remove assertion in ExpandShapeOp::build (#91361)
Unblocking downstream integrate where an expected-to-fail test was expecting this to be a runtime verifier error, not a compiler crash: llvm/torch-mlir#3279.
1 parent b1bc1db commit 62bed56

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,10 +1676,12 @@ void ExpandShapeOp::build(OpBuilder &builder, OperationState &result,
16761676
auto tensorResultTy = cast<RankedTensorType>(resultType);
16771677
FailureOr<SmallVector<OpFoldResult>> outputShape = inferOutputShape(
16781678
builder, result.location, tensorResultTy, reassociation, inputShape);
1679-
// Failure of this assertion usually indicates presence of multiple
1680-
// dynamic dimensions in the same reassociation group.
1681-
assert(succeeded(outputShape) && "unable to infer output shape");
1682-
build(builder, result, tensorResultTy, src, reassociation, *outputShape);
1679+
SmallVector<OpFoldResult> outputShapeOrEmpty;
1680+
if (succeeded(outputShape)) {
1681+
outputShapeOrEmpty = *outputShape;
1682+
}
1683+
build(builder, result, tensorResultTy, src, reassociation,
1684+
outputShapeOrEmpty);
16831685
}
16841686

16851687
SmallVector<AffineMap, 4> CollapseShapeOp::getReassociationMaps() {

0 commit comments

Comments
 (0)