Introduce an ODS/Tablegen backend producing Op wrappers for Python bindings
based on the ODS operation definition. Usage:
mlir-tblgen -gen-python-op-bindings -Iinclude <path/to/Ops.td> \ -bind-dialect=<dialect-name>
Paths
| Differential D90960
[mlir] ODS-backed python binding generator for custom op classes ClosedPublic Authored by ftynse on Nov 6 2020, 10:38 AM.
Details Summary Introduce an ODS/Tablegen backend producing Op wrappers for Python bindings mlir-tblgen -gen-python-op-bindings -Iinclude <path/to/Ops.td> \ -bind-dialect=<dialect-name>
Diff Detail
Event TimelineHerald added subscribers: stephenneuendorffer, nicolasvasilache. · View Herald TranscriptNov 6 2020, 10:38 AM ftynse added a parent revision: D90936: [mlir] Support slicing for operands in results in Python bindings.Nov 6 2020, 10:39 AM ftynse retitled this revision from [mlir] WIP: ODS-backed python binding generator for custom op classes to [mlir] ODS-backed python binding generator for custom op classes. Comment Actions LGTM overall.
I think that'd require a bit more CMake/build plumbing to get there.
Comment Actions
Added a "some-check" test.
My changes actually crossed in-flight with your comment. I added build support for testing, but not yet for the installation. Let's check if this work for more dialects before enabling by default. PTAL. This revision is now accepted and ready to land.Nov 9 2020, 8:37 PM Comment Actions Nice, thanks
This revision was landed with ongoing or failed builds.Nov 10 2020, 1:58 AM Closed by commit rGfd407e1f1eed: [mlir] ODS-backed python binding generator for custom op classes (authored by ftynse). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 304107 mlir/CMakeLists.txt
mlir/cmake/modules/AddMLIRPythonExtension.cmake
mlir/include/mlir/Dialect/StandardOps/IR/CMakeLists.txt
mlir/lib/Bindings/Python/CMakeLists.txt
mlir/lib/Bindings/Python/mlir/dialects/__init__.py
mlir/lib/Bindings/Python/mlir/dialects/std.py
mlir/test/Bindings/Python/dialects.py
mlir/test/Bindings/Python/dialects/std.py
mlir/test/mlir-tblgen/op-python-bindings.td
mlir/tools/mlir-tblgen/CMakeLists.txt
mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp
|
There is nothing in these that is dependent on the ODS content, can we have some Python helpers in mlir.ir and import them instead of regenerating these for every dialect?