Thanks Alex - that's very helpful.I'm developing a program analysis tool, which is currently Python-based. My expectation was to use Python in:- converting AST->MLIR (seems like that's supported by the bindings)
- converting back from final MLIR form into AST (would this be supported by the bindings?). This is required because my back-end is an SMT solver that I'm using with Python bindings, not LLVM
- ideally I wanted to express MLIR operations for custom dialects using a high-level DSL in Python or Table gen
- ideally wanted to build compiler passes in Python (as I already have existing IR transformation code), but understand the motivation for reusability- I have a Python back-end that currently processes custom IRs into a UI for debugging purposesBased on your description, I can use the Python bindings to get into MLIR form, but would have to build additional bindings to 1) invoke mlir-opt 2) convert back intermediate dialects from MLIR into my Python AST for custom debugging/rewriting to final back-end?
Best regardsPeteris Erins
On Tuesday, May 7, 2019 at 10:04:16 PM UTC+1, Alex Zinenko wrote:Hi Peteris,we have Python bindings that let you construct MLIR modules (functions, operations, types), which were mostly developed for Python-based tools that want to lower their representation (e.g., AST) into MLIR. Further transformations on MLIR are expected to be run using `mlir-opt` to invoke MLIR->MLIR passes. Currently, we prefer passes and analyses to be written in C++ for the sake of reusability. The bindings require the "pybind11" library to compile, but they are localized in a single file https://github.com/tensorflow/mlir/blob/master/bindings/python/pybind.cpp. It should be possible to compile using a single command of the style "c++ -O3 -shared -fPIC -I/path/to/mlir/includes -I/path/to/llvm/includes -I/path/to/pybind11 -L/path/to/mlir/lib -L/path/to/llvm/lib -lMLIRIR -lMLIREDSC -lMLIRSupport -lLLVM -o mlir_bindings", or using cmake https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake after setting up the include/link locations so that MLIR and LLVM libraries can be found. It should give you a Python binary module that can be loaded as usual in Python.Could you please describe a specific use case where you need Python bindings?Alex
On Tuesday, May 7, 2019 at 10:21:15 PM UTC+2, Peteris Erins wrote:Dear All,What is the status for the Python bindings in terms of feature coverage and availability? Are there any instructions how to use the Python bindings/reproduce the tests? If not available what would be their current priority on the roadmap?Best regards--Peteris Erins
--
You received this message because you are subscribed to the Google Groups "MLIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mlir+uns...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/100b6dc3-2bb7-4bbf-8dc9-d9d9410e42d3%40tensorflow.org.
To unsubscribe from this group and stop receiving emails from it, send an email to ml...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/mlir/100b6dc3-2bb7-4bbf-8dc9-d9d9410e42d3%40tensorflow.org.
---- Alex