[Mlir-commits] [mlir] [MLIR][Linalg][Docs] Add forms to Linalg rationale docs (PR #156859)
Jacques Pienaar
llvmlistbot at llvm.org
Sun Sep 14 22:41:16 PDT 2025
================
@@ -506,6 +506,58 @@ potential by introducing lower-level IR ops and *smaller* Linalg ops.
This gradually reduces the potential, all the way to Loops + VectorOps
and LLVMIR.
+### Interchangeability of Forms<a name="forms"></a>
+
+#### The Linalg Forms
+
+The core Linalg operation tree has three forms:
+* **Generic:** Represented by `linalg.generic` and can encode all perfectly-nested
+loop operations.
+* **Category:** Represented by `linalg.contract` and `linalg.elementwise`,
+which are special (einsum) forms of the `generic` operation. In the future, other
+category operations are planned (e.g.: `linalg.convolution` and `linalg.pooling`).
+* **Named:** All _named_ forms that can lower to either _category_ or
+_generic_ forms. For example, `linalg.matmul`, `linalg.add`, etc.
+
+Unlike lowering to loops, the different Linalg forms that are derived from
+`linalg.generic` are *equivalent*. It should always be possible to convert
+a named operation into a generic and back to named, if the semantics are
----------------
jpienaar wrote:
This is assuming the named _can_ be lowered to generic correct? "if the semantics are preserved" makes this a little vacuous: one could say the same of raising back from LLVM dialect to Affine loops if semantics are retained. I think you are aiming for something stronger here.
https://github.com/llvm/llvm-project/pull/156859
More information about the Mlir-commits
mailing list