Skip to content

Commit b858309

Browse files
committed
[mlir] Only attempt to vectorize conv if conv.
Avoids hitting assertions due to unsupported convolution patterns. See iree-org/iree#15207 (comment)
1 parent d6a9261 commit b858309

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,11 +1693,16 @@ LogicalResult mlir::linalg::vectorize(RewriterBase &rewriter, Operation *op,
16931693
.Case<linalg::LinalgOp>([&](auto linalgOp) {
16941694
// TODO: isaConvolutionOpInterface that can also infer from generic
16951695
// features. Will require stride/dilation attributes inference.
1696-
FailureOr<Operation *> convOr =
1697-
vectorizeConvolution(rewriter, linalgOp);
1698-
if (succeeded(convOr)) {
1699-
llvm::append_range(results, (*convOr)->getResults());
1700-
return success();
1696+
if (isa<ConvolutionOpInterface>(linalgOp.getOperation())) {
1697+
FailureOr<Operation *> convOr =
1698+
vectorizeConvolution(rewriter, linalgOp);
1699+
if (succeeded(convOr)) {
1700+
llvm::append_range(results, (*convOr)->getResults());
1701+
return success();
1702+
}
1703+
1704+
LDBG("Unsupported convolution can't be vectorized.\n");
1705+
return failure();
17011706
}
17021707

17031708
LDBG("Vectorize generic by broadcasting to the canonical vector "

0 commit comments

Comments
 (0)