MLIR  22.0.0git
DialectIRDL.cpp
Go to the documentation of this file.
1 //===--- DialectIRDL.cpp - Pybind module for IRDL dialect API support ---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir-c/Dialect/IRDL.h"
10 #include "mlir-c/IR.h"
11 #include "mlir-c/Support.h"
14 
15 namespace nb = nanobind;
16 using namespace mlir;
17 using namespace mlir::python;
18 using namespace mlir::python::nanobind_adaptors;
19 
20 static void populateDialectIRDLSubmodule(nb::module_ &m) {
21  m.def(
22  "load_dialects",
23  [](MlirModule module) {
25  throw std::runtime_error(
26  "failed to load IRDL dialects from the input module");
27  },
28  nb::arg("module"), "Load IRDL dialects from the given module.");
29 }
30 
31 NB_MODULE(_mlirDialectsIRDL, m) {
32  m.doc() = "MLIR IRDL dialect.";
33 
35 }
NB_MODULE(_mlirDialectsIRDL, m)
Definition: DialectIRDL.cpp:31
static void populateDialectIRDLSubmodule(nb::module_ &m)
Definition: DialectIRDL.cpp:20
MLIR_CAPI_EXPORTED MlirLogicalResult mlirLoadIRDLDialects(MlirModule module)
Loads all IRDL dialects in the provided module, registering the dialects in the module's associated c...
Definition: IRDL.cpp:16
static bool mlirLogicalResultIsFailure(MlirLogicalResult res)
Checks if the given logical result represents a failure.
Definition: Support.h:127
Include the generated interface declarations.