[Mlir-commits] [mlir] [mlir][linalg] Implement `LinalgGroupedConvolutionOpInterface` to unify grouped convs (PR #94796)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jun 23 09:47:11 PDT 2025


================
@@ -175,7 +175,87 @@ def LinalgConvolutionOpInterface : OpInterface<"ConvolutionOpInterface"> {
         return $_op.getOperation()->getOperand(1);
       }]
     >,
+    InterfaceMethod<
+      /*desc=*/"Return the spatial rank.",
+      /*retTy=*/"int64_t",
+      /*methodName=*/"getSpatialRank",
+      /*args=*/(ins),
+      /*methodBody=*/"",
+      /*defaultImplementation=*/[{
+        // Most convolution's inputs have batch, channel and spatial dims
+        return cast<ShapedType>(image().getType()).getRank() - 2;
+      }]
+    >
+  ];
+}
+
+def LinalgGroupedConvolutionOpInterface : OpInterface<"GroupedConvolutionOpInterface", [
----------------
srcarroll wrote:

i remember why i made an interface now. it was to also support implementing quantized versions of grouped conv, since at the time i didn't think we should cram that into the same op definition.

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


More information about the Mlir-commits mailing list