[Mlir-commits] [mlir] [NFC][Linalg] Introduce ConvMatchBuilder + refactor Conv matchers (PR #169704)

Abhishek Varma llvmlistbot at llvm.org
Sun Nov 30 23:34:53 PST 2025


================
@@ -434,6 +430,91 @@ static bool convLayoutMatches(ArrayRef<ArrayRef<AffineExpr>> mapListExpected,
                           })));
 }
 
+/// Enum of all kinds of Pooling Op's type.
+enum PoolingType {
+  NONE,
+  MAX_SIGNED,
+  MAX_UNSIGNED,
+  MIN_SIGNED,
+  MIN_UNSIGNED,
+  SUM
+};
+
+/// Helper class for building convolution op matchers with minimal boilerplate.
+/// Reduces repetitive code across Conv1D/2D/3D and Depthwise variants as well
+/// as Pooling ops.
+class ConvMatcherBuilder {
+  LinalgOp op;
+  MLIRContext *ctx;
+  SmallVector<int64_t> *dilations, *strides;
+  ArrayAttr indexingMaps;
+  PoolingType poolingType;
+  bool matched = true;
----------------
Abhishek-Varma wrote:

Hi @banach-space - I've added this as part of the doc comment too to explain the rationale as part of https://github.com/llvm/llvm-project/pull/170080 now.

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


More information about the Mlir-commits mailing list