[Mlir-commits] [mlir] [MLIR] Allowing unsupported conv2d op to fail gracefully from vectorization (PR #130181)
Diego Caballero
llvmlistbot at llvm.org
Fri Mar 7 14:50:57 PST 2025
================
@@ -3889,22 +3918,21 @@ struct Conv1DGenerator
}
}
};
+
+// Helper function to construct Conv1DGenerator
+bool validateConv1DGenerator(RewriterBase &rewriter, LinalgOp linalgOp) {
+ Conv1DGenerator conv1dGen(rewriter, linalgOp);
+ return conv1dGen.isValid();
+}
+
} // namespace
/// Helper function to vectorize a LinalgOp with convolution semantics.
// TODO: extend the generic vectorization to support windows and drop this.
static FailureOr<Operation *> vectorizeConvolution(
RewriterBase &rewriter, LinalgOp op, ArrayRef<int64_t> inputVecSizes,
ArrayRef<bool> inputScalableVecDims, bool flatten1DDepthwiseConv) {
- // The ConvolutionOpInterface gives us guarantees of existence for
- // strides/dilations. However, we do not need to rely on those, we can
- // simply use them if present, otherwise use the default and let the generic
- // conv. matcher in the ConvGenerator succeed or fail.
- auto strides = op->getAttrOfType<DenseIntElementsAttr>("strides");
- auto dilations = op->getAttrOfType<DenseIntElementsAttr>("dilations");
- auto stride = strides ? *strides.getValues<uint64_t>().begin() : 1;
- auto dilation = dilations ? *dilations.getValues<uint64_t>().begin() : 1;
- Conv1DGenerator e(rewriter, op, stride, dilation);
+ Conv1DGenerator e(rewriter, op);
----------------
dcaballe wrote:
nit: `e` -> `convGen`? (or any other name)
https://github.com/llvm/llvm-project/pull/130181
More information about the Mlir-commits
mailing list