[Mlir-commits] [mlir] [Linalg] Add `matchConvolutionOpOfType` API and make `isaConvolutionOpOfType` API a wrapper (PR #174722)
Han-Chung Wang
llvmlistbot at llvm.org
Tue Jan 13 10:04:27 PST 2026
================
@@ -106,12 +106,24 @@ getReassociationMapForFoldingUnitDims(ArrayRef<OpFoldResult> mixedSizes);
// Convolution matcher utility
//===----------------------------------------------------------------------===//
-/// Given a linalg `op` this function returns true if it is a convolution op of
-/// type `ConvOpTy` and populates `dilations` and `strides` with values inferred
-/// from the indexing maps.
+/// A struct containing dilations and strides inferred from convolution ops.
+struct DilationsAndStrides {
+ SmallVector<int64_t> dilations;
+ SmallVector<int64_t> strides;
+};
+
+/// Given a linalg `op` this function returns DilationsAndStrides if it is a
+/// convolution op of type `ConvOpTy`, otherwise returns std::nullopt. The
+/// dilations and strides are inferred from the indexing maps.
template <typename ConvOpTy>
-bool isaConvolutionOpOfType(LinalgOp op, SmallVector<int64_t> *dilations,
- SmallVector<int64_t> *strides);
+std::optional<DilationsAndStrides> matchConvolutionOpOfType(LinalgOp op);
----------------
hanhanW wrote:
I think it's worth documenting that for ops like Conv1DOp, Conv2DOp, etc that have no strides/dilations attributes, defaults of [1, ...] are returned.
https://github.com/llvm/llvm-project/pull/174722
More information about the Mlir-commits
mailing list