[Mlir-commits] [mlir] [Linalg] Update Conv Decomposition patterns to work with generic convolution ops as well (PR #174196)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jan 5 22:16:59 PST 2026


================
@@ -108,10 +108,12 @@ getReassociationMapForFoldingUnitDims(ArrayRef<OpFoldResult> mixedSizes);
 
 /// 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.
+/// from the indexing maps. If `dilations` or `strides` is nullptr, the
+/// corresponding values are not populated.
 template <typename ConvOpTy>
-bool isaConvolutionOpOfType(LinalgOp op, SmallVector<int64_t> *dilations,
-                            SmallVector<int64_t> *strides);
+bool isaConvolutionOpOfType(LinalgOp op,
+                            SmallVector<int64_t> *dilations = nullptr,
+                            SmallVector<int64_t> *strides = nullptr);
----------------
hanhanW wrote:

I prefer return value to passing pointers. How about we return `std::optional<DilationsAndStrides>` instead? If it does not match the conv type, `std::nullopt` is returned. Users can ignore dilations and strides if they don't care; we still can write `if (isaConv...)` for checks. What do you think?

https://github.com/llvm/llvm-project/pull/174196


More information about the Mlir-commits mailing list