@@ -1188,6 +1188,19 @@ which can be `import`ed from the main dialect file, i.e.
11881188` python/mlir/dialects/<dialect-namespace>/passes.py ` if it is undesirable to
11891189make the passes available along with the dialect.
11901190
1191+ ### Other functionality
1192+
1193+ Dialect functionality other than IR objects or passes, such as helper functions,
1194+ can be exposed to Python similarly to attributes and types. C API is expected to
1195+ exist for this functionality, which can then be wrapped using pybind11 and
1196+ [ ` include/mlir/Bindings/Python/PybindAdaptors.h ` ] ( https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Bindings/Python/PybindAdaptors.h ) ,
1197+ or nanobind and
1198+ [ ` include/mlir/Bindings/Python/NanobindAdaptors.h ` ] ( https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h )
1199+ utilities to connect to the rest of Python API. The bindings can be located in a
1200+ separate module or in the same module as attributes and types, and
1201+ loaded along with the dialect.
1202+
1203+
11911204## Extending MLIR in Python
11921205
11931206The MLIR Python bindings provide support for defining custom components in Python,
@@ -1262,17 +1275,6 @@ This frozen set can then be applied to an operation
12621275using the greedy rewrite pattern driver via ` apply_patterns_and_fold_greedily ` .
12631276For further information, see [ the PDL dialect documentation] ( /docs/Dialects/PDLOps/ ) .
12641277
1265- ### Other functionality
1266-
1267- Dialect functionality other than IR objects or passes, such as helper functions,
1268- can be exposed to Python similarly to attributes and types. C API is expected to
1269- exist for this functionality, which can then be wrapped using pybind11 and
1270- [ ` include/mlir/Bindings/Python/PybindAdaptors.h ` ] ( https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Bindings/Python/PybindAdaptors.h ) ,
1271- or nanobind and
1272- [ ` include/mlir/Bindings/Python/NanobindAdaptors.h ` ] ( https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h )
1273- utilities to connect to the rest of Python API. The bindings can be located in a
1274- separate module or in the same module as attributes and types, and
1275- loaded along with the dialect.
12761278
12771279## Free-threading (No-GIL) support
12781280
0 commit comments