[Mlir-commits] [mlir] [MLIR] Allowing unsupported conv2d op to fail gracefully from vectorization (PR #130181)
Zhuoran Yin
llvmlistbot at llvm.org
Thu Mar 6 14:15:21 PST 2025
================
@@ -1990,8 +1990,18 @@ static LogicalResult vectorizeLinalgOpPrecondition(
// TODO: isaConvolutionOpInterface that can also infer from generic
// features. But we will still need stride/dilation attributes that will be
// annoying to reverse-engineer...
- if (isa<ConvolutionOpInterface>(linalgOp.getOperation()))
+ if (isa<ConvolutionOpInterface>(linalgOp.getOperation())) {
+ // Check if it is 2d+ convolution. If it is, return failure because we don't
+ // support it. To use this pass on a 2d+ convolution, it should have already
+ // been decomposed to 1d convolution via
+ // DecomposeConvolutionToLowerDimOpsPass.
+ if (linalgOp.getNumParallelLoops() >= 4) {
+ LDBG("precondition failed: Regular 2d+ convolutions not supported.\n");
+ return failure();
+ }
----------------
jerryyin wrote:
That sounds like a decent refactor. `Conv1DGenerator`'s constructor indeed is a more robust check compared with `getNumParallelLoops()`. Thanks for the pointers!
https://github.com/llvm/llvm-project/pull/130181
More information about the Mlir-commits
mailing list