Adds __str__ support to python mlir.ir.MlirModule.

* Also raises an exception on parse error.
* Removes placeholder smoketest.
* Adds docstrings.

Differential Revision: https://reviews.llvm.org/D86046
This commit is contained in:
Stella Laurenzo
2020-08-16 20:53:45 -07:00
parent cb6e6936db
commit 95b77f2eac
10 changed files with 180 additions and 35 deletions

View File

@@ -11,21 +11,14 @@
#include <pybind11/pybind11.h>
#include "IRModules.h"
#include "mlir/IR/MLIRContext.h"
namespace py = pybind11;
using namespace mlir;
using namespace mlir::python;
PYBIND11_MODULE(_mlir, m) {
m.doc() = "MLIR Python Native Extension";
m.def("get_test_value", []() {
// This is just calling a method on the MLIRContext as a smoketest
// for linkage.
MLIRContext context;
return std::make_tuple(std::string("From the native module"),
context.isMultithreadingEnabled());
});
// Define and populate IR submodule.
auto irModule = m.def_submodule("ir", "MLIR IR Bindings");
populateIRSubmodule(irModule);