[Mlir-commits] [mlir] 67c3429 - [mlir][docs] dialect interfaces and mlir reduce documentation fix (#189258)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Mar 31 08:23:20 PDT 2026
Author: AidinT
Date: 2026-03-31T15:23:13Z
New Revision: 67c34294a6b3e161a84ed4697c326d04d651d7ff
URL: https://github.com/llvm/llvm-project/commit/67c34294a6b3e161a84ed4697c326d04d651d7ff
DIFF: https://github.com/llvm/llvm-project/commit/67c34294a6b3e161a84ed4697c326d04d651d7ff.diff
LOG: [mlir][docs] dialect interfaces and mlir reduce documentation fix (#189258)
Two modifications:
1. Reflect newly added dialect interface methods in the documentation
2. Remove the bug in the `MLIR Reduce` documentation
Added:
Modified:
mlir/docs/Interfaces.md
mlir/docs/Tools/mlir-reduce.md
Removed:
################################################################################
diff --git a/mlir/docs/Interfaces.md b/mlir/docs/Interfaces.md
index d3e1888c48baf..2de79eadd0052 100644
--- a/mlir/docs/Interfaces.md
+++ b/mlir/docs/Interfaces.md
@@ -133,7 +133,7 @@ def DialectInlinerInterface : DialectInterface<"DialectInlinerInterface"> {
- The C++ namespace that the interface class should be generated in.
* Methods (`methods`)
- The list of interface hook methods that are defined by the IR object.
- - The structure of these methods is defined [here](#interface-methods).
+ - The structure of these methods is defined [here](#dialect-interface-methods).
The header file can be generated via the following command:
@@ -151,6 +151,28 @@ mlir_tablegen(DialectInlinerInterface.h.inc -gen-dialect-interface-decls)
An example of this can be found in the DialectInlinerInterface implementation
and the related `CMakeLists.txt` under `mlir/include/mlir/Transforms`.
+##### Dialect Interface Methods
+
+There are three types of methods that can be used with a dialect interface,
+`InterfaceMethod`, `InterfaceMethodDeclaration` and `PureVirtualInterfaceMethod`.
+They are all comprised of the same core components, with the distinction that
+`InterfaceMethod` also supports a default method body.
+
+Interface methods are comprised of the following components:
+
+* Description: a string description of this method, its invariants, example usages,
+etc.
+* ReturnType: a string corresponding to the C++ return type of the method.
+* MethodName: a string corresponding to the C++ name of the method.
+* Arguments (Optional): a dag of strings that correspond to a C++ type and variable name
+respectively.
+* MethodBody (Optional, only in `InterfaceMethod`): an optional explicit implementation
+of the interface method.
+
+`InterfaceMethodDeclaration` will only declare the class method. On the other hand,
+`PureVirtualInterfaceMethod` marks the method as pure virtual, but also makes the
+constructor of the dialect calss protected.
+
#### DialectInterfaceCollection
An additional utility is provided via `DialectInterfaceCollection`. This class
@@ -510,7 +532,7 @@ comprised of the following components:
##### Interface Methods
-There are two types of methods that can be used with an interface,
+There are two types of methods that can be used with an attr/op/type interface,
`InterfaceMethod` and `StaticInterfaceMethod`. They are both comprised of the
same core components, with the distinction that `StaticInterfaceMethod` models a
static method on the derived IR object.
diff --git a/mlir/docs/Tools/mlir-reduce.md b/mlir/docs/Tools/mlir-reduce.md
index b60cdd799ba0c..ed6172f76a337 100644
--- a/mlir/docs/Tools/mlir-reduce.md
+++ b/mlir/docs/Tools/mlir-reduce.md
@@ -76,6 +76,9 @@ example,
#include "mlir/Reducer/ReductionPatternInterface.h"
struct MyReductionPatternInterface : public DialectReductionPatternInterface {
+ MyReductionPatternInterface(Dialect *dialect)
+ : DialectReductionPatternInterface(dialect) {};
+
virtual void
populateReductionPatterns(RewritePatternSet &patterns) const final {
populateMyReductionPatterns(patterns);
More information about the Mlir-commits
mailing list