[Mlir-commits] [mlir] [mlir][linalg] Morphism across linalg named, category and generic ops. (PR #148424)

Renato Golin llvmlistbot at llvm.org
Wed Jul 23 07:39:02 PDT 2025


================
@@ -89,6 +89,44 @@ def LinalgInlineScalarOperandsPass : Pass<"linalg-inline-scalar-operands"> {
   ];
 }
 
+def LinalgMorphOpsPass : Pass<"linalg-morph-ops"> {
+  let summary = "Convert named op to category ops or generic and vice-versa";
+
+  let description = [{
+    Convert a linalg op from one representation to another equivalent.
+    For example, a linalg named op `linalg.add` can also be written as an
+    category op `linalg.elementwise`, and can also be re-written as
+    a `linalg.generic`, giving the morphism:
+
+      named-op <--> category_op (elementwise, contraction, ..) <--> generic
+
+    Generic is a bigger set than named and category ops and so not all generics
+    can be converted to single category-op or named-op. Similarly,  category
+     ops are  bigger set than named ops.
----------------
rengolin wrote:

nit: not sure `bigger` is a good term here. The relevant part is that the `generic` set subsumes the `named` set, not the size difference.

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


More information about the Mlir-commits mailing list