[Mlir-commits] [mlir] [Linalg] Add basic infra to add matchers for linalg.*conv*/*pool* ops (PR #163724)
Abhishek Varma
llvmlistbot at llvm.org
Fri Nov 7 12:53:02 PST 2025
================
@@ -110,6 +110,15 @@ GenericOp makeMemRefCopyOp(OpBuilder &b, Location loc, Value from, Value to);
std::optional<SmallVector<ReassociationIndices>>
getReassociationMapForFoldingUnitDims(ArrayRef<OpFoldResult> mixedSizes);
+//===----------------------------------------------------------------------===//
+// Convolution matcher utility
+//===----------------------------------------------------------------------===//
+
+template <typename ConvOpTy>
+bool isaConvolutionOpOfType(LinalgOp op,
+ SmallVector<int64_t> *dilations = nullptr,
+ SmallVector<int64_t> *strides = nullptr);
----------------
Abhishek-Varma wrote:
> Could you add a note that dilations and strides are output arguments?
Done.
> Also, nullptr as default implies that this arguments are optional, but the code breaks if you don't specify them.
I don't think the code would break if the user doesn't specify them. A user can invoke the API either as `isaConvolutionOpOfType<linalg::Conv1DOp>(op)` OR as `isaConvolutionOpOfType<linalg::Conv1DOp>(op, dilations, strides)` and these both should work fine.
Could you point me to the codebase which seems erroneous to you ?
https://github.com/llvm/llvm-project/pull/163724
More information about the Mlir-commits
mailing list