|
MLIR 22.0.0git
|
#include "Bindings/Python/IRModule.h"
Classes | |
| struct | ErrorCapture |
| RAII object that captures any error diagnostics emitted to the provided context. More... | |
Public Member Functions | |
| PyMlirContext ()=delete | |
| PyMlirContext (MlirContext context) | |
| PyMlirContext (const PyMlirContext &)=delete | |
| PyMlirContext (PyMlirContext &&)=delete | |
| ~PyMlirContext () | |
| MlirContext | get () |
| Accesses the underlying MlirContext. | |
| PyMlirContextRef | getRef () |
| Gets a strong reference to this context, which will ensure it is kept alive for the life of the reference. | |
| nanobind::object | getCapsule () |
| Gets a capsule wrapping the void* within the MlirContext. | |
| size_t | getLiveModuleCount () |
| Gets the count of live modules associated with this context. | |
| void | contextExit (const nanobind::object &excType, const nanobind::object &excVal, const nanobind::object &excTb) |
| nanobind::object | attachDiagnosticHandler (nanobind::object callback) |
| Attaches a Python callback as a diagnostic handler, returning a registration object (internally a PyDiagnosticHandler). | |
| void | setEmitErrorDiagnostics (bool value) |
| Controls whether error diagnostics should be propagated to diagnostic handlers, instead of being captured by ErrorCapture. | |
| bool | getEmitErrorDiagnostics () |
Static Public Member Functions | |
| static PyMlirContextRef | forContext (MlirContext context) |
| Returns a context reference for the singleton PyMlirContext wrapper for the given context. | |
| static nanobind::object | createFromCapsule (nanobind::object capsule) |
| Creates a PyMlirContext from the MlirContext wrapped by a capsule. | |
| static size_t | getLiveCount () |
| Gets the count of live context objects. Used for testing. | |
| static nanobind::object | contextEnter (nanobind::object context) |
| Enter and exit the context manager. | |
Friends | |
| class | PyModule |
| class | PyOperation |
Definition at line 191 of file IRModule.h.
|
delete |
Referenced by forContext(), PyMlirContext(), and PyMlirContext().
| PyMlirContext::PyMlirContext | ( | MlirContext | context | ) |
Definition at line 537 of file IRCore.cpp.
|
delete |
References PyMlirContext().
|
delete |
References PyMlirContext().
| PyMlirContext::~PyMlirContext | ( | ) |
Definition at line 544 of file IRCore.cpp.
References mlirContextDestroy().
| nb::object PyMlirContext::attachDiagnosticHandler | ( | nanobind::object | callback | ) |
Attaches a Python callback as a diagnostic handler, returning a registration object (internally a PyDiagnosticHandler).
Definition at line 607 of file IRCore.cpp.
References get(), mlir::python::PyDiagnostic::invalidate(), mlirContextAttachDiagnosticHandler(), mlirLogicalResultFailure(), mlirLogicalResultSuccess(), and result.
|
static |
Enter and exit the context manager.
Definition at line 597 of file IRCore.cpp.
References mlir::python::PyThreadContextEntry::pushContext().
| void PyMlirContext::contextExit | ( | const nanobind::object & | excType, |
| const nanobind::object & | excVal, | ||
| const nanobind::object & | excTb ) |
Definition at line 601 of file IRCore.cpp.
References mlir::python::PyThreadContextEntry::popContext().
|
static |
Creates a PyMlirContext from the MlirContext wrapped by a capsule.
Note that PyMlirContext instances are uniqued, so the returned object may be a pre-existing object. Ownership of the underlying MlirContext is taken by calling this function.
Definition at line 560 of file IRCore.cpp.
References forContext(), mlirContextIsNull(), mlirPythonCapsuleToContext(), and mlir::python::PyObjectRef< T >::releaseObject().
|
static |
Returns a context reference for the singleton PyMlirContext wrapper for the given context.
Definition at line 567 of file IRCore.cpp.
References PyMlirContext().
Referenced by mlir::python::PyAffineExpr::createFromCapsule(), mlir::python::PyAffineMap::createFromCapsule(), mlir::python::PyAttribute::createFromCapsule(), mlir::python::PyIntegerSet::createFromCapsule(), mlir::python::PyLocation::createFromCapsule(), createFromCapsule(), mlir::python::PyOperation::createFromCapsule(), mlir::python::PyType::createFromCapsule(), mlir::python::PyValue::createFromCapsule(), mlir::python::PyModule::forModule(), and mlir::python::PyDiagnostic::getLocation().
|
inline |
Accesses the underlying MlirContext.
Definition at line 204 of file IRModule.h.
Referenced by attachDiagnosticHandler(), mlir::python::PyOpView::buildGeneric(), mlir::python::PyMlirContext::ErrorCapture::ErrorCapture(), getCapsule(), mlir::python::PyInferShapedTypeOpInterface::inferReturnTypeComponents(), mlir::python::PyInferTypeOpInterface::inferReturnTypes(), and mlir::python::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().
| nb::object PyMlirContext::getCapsule | ( | ) |
Gets a capsule wrapping the void* within the MlirContext.
Definition at line 556 of file IRCore.cpp.
References get(), and mlirPythonContextToCapsule().
|
inline |
Definition at line 241 of file IRModule.h.
|
static |
Gets the count of live context objects. Used for testing.
Definition at line 592 of file IRCore.cpp.
| size_t PyMlirContext::getLiveModuleCount | ( | ) |
Gets the count of live modules associated with this context.
Used for testing.
Definition at line 2007 of file IRCore.cpp.
|
inline |
Gets a strong reference to this context, which will ensure it is kept alive for the life of the reference.
Definition at line 208 of file IRModule.h.
Referenced by getValueTypes().
Controls whether error diagnostics should be propagated to diagnostic handlers, instead of being captured by ErrorCapture.
Definition at line 240 of file IRModule.h.
|
friend |