[Mlir-commits] [mlir] [mlir][linalg] Migrate elementwise named ops from OpDSL to tablegen multiclass (PR #216976)

Renato Golin llvmlistbot at llvm.org
Tue Aug 18 03:42:58 PDT 2026


================
@@ -798,4 +798,26 @@ def AggregatedOpInterface : OpInterface<"AggregatedOpInterface"> {
   ];
 }
 
+def ElementwiseOpInterface : OpInterface<"ElementwiseOpInterface"> {
+  let description = [{
+    Interface for operations that represent elementwise computations. This
+    includes both the generic `linalg.elementwise` op and its named
+    specializations a.k.a. linalg names ops (e.g. `linalg.add`, `linalg.exp`).
+
+    The interface exposes the kind of elementwise operation being performed,
+    allowing transforms to handle all elementwise ops uniformly.
+  }];
+  let cppNamespace = "::mlir::linalg";
+  let methods = [
+    InterfaceMethod<
+      /*desc=*/[{
+        Returns the kind of elementwise operation (e.g. add, exp, mul).
+      }],
+      /*retType=*/"::mlir::linalg::ElementwiseKind",
----------------
rengolin wrote:

Should we also have the arity here? I know there's the helper, so this could be a follow up change. 

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


More information about the Mlir-commits mailing list