1722475a3SStella Laurenzo //===- MainModule.cpp - Main pybind module --------------------------------===// 2722475a3SStella Laurenzo // 3722475a3SStella Laurenzo // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4722475a3SStella Laurenzo // See https://llvm.org/LICENSE.txt for license information. 5722475a3SStella Laurenzo // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6722475a3SStella Laurenzo // 7722475a3SStella Laurenzo //===----------------------------------------------------------------------===// 8722475a3SStella Laurenzo 9722475a3SStella Laurenzo #include <tuple> 10722475a3SStella Laurenzo 11722475a3SStella Laurenzo #include <pybind11/pybind11.h> 12722475a3SStella Laurenzo 13*fcd2969dSzhanghb97 #include "IRModules.h" 14722475a3SStella Laurenzo #include "mlir/IR/MLIRContext.h" 15722475a3SStella Laurenzo 16722475a3SStella Laurenzo using namespace mlir; 17722475a3SStella Laurenzo 18722475a3SStella Laurenzo PYBIND11_MODULE(_mlir, m) { 19722475a3SStella Laurenzo m.doc() = "MLIR Python Native Extension"; 20722475a3SStella Laurenzo 21722475a3SStella Laurenzo m.def("get_test_value", []() { 22722475a3SStella Laurenzo // This is just calling a method on the MLIRContext as a smoketest 23722475a3SStella Laurenzo // for linkage. 24722475a3SStella Laurenzo MLIRContext context; 25722475a3SStella Laurenzo return std::make_tuple(std::string("From the native module"), 26722475a3SStella Laurenzo context.isMultithreadingEnabled()); 27722475a3SStella Laurenzo }); 28*fcd2969dSzhanghb97 29*fcd2969dSzhanghb97 // Define and populate IR submodule. 30*fcd2969dSzhanghb97 auto irModule = m.def_submodule("ir", "MLIR IR Bindings"); 31*fcd2969dSzhanghb97 populateIRSubmodule(irModule); 32722475a3SStella Laurenzo } 33