|
MLIR 22.0.0git
|
#include "mlir/Bindings/Python/IRCore.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 |
|
delete |
References PyMlirContext().
Referenced by PyMlirContext(), PyMlirContext(), and PyMlirContext().
| mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::PyMlirContext | ( | MlirContext | context | ) |
Definition at line 443 of file IRCore.cpp.
|
delete |
References PyMlirContext().
|
delete |
References forContext(), and PyMlirContext().
| mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::~PyMlirContext | ( | ) |
Definition at line 450 of file IRCore.cpp.
| nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::attachDiagnosticHandler | ( | nanobind::object | callback | ) |
Attaches a Python callback as a diagnostic handler, returning a registration object (internally a PyDiagnosticHandler).
Definition at line 517 of file IRCore.cpp.
References mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::popContext().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
static |
Enter and exit the context manager.
Definition at line 507 of file IRCore.cpp.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
| void mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::contextExit | ( | const nanobind::object & | excType, |
| const nanobind::object & | excVal, | ||
| const nanobind::object & | excTb ) |
Definition at line 511 of file IRCore.cpp.
References mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyThreadContextEntry::pushContext().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
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 470 of file IRCore.cpp.
References get(), and mlirPythonContextToCapsule().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
static |
Returns a context reference for the singleton PyMlirContext wrapper for the given context.
Definition at line 477 of file IRCore.cpp.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyRewritePatternSet::add(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyLocation::contextEnter(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::createFromCapsule(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineMap::createFromCapsule(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyIntegerSet::createFromCapsule(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyDiagnostic::getMessage(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyDenseElementsAttribute::getSplat(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAttribute::maybeDownCast(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyType::maybeDownCast(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::maybeInsertOperation(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore(), and PyMlirContext().
|
inline |
Accesses the underlying MlirContext.
Definition at line 213 of file IRCore.h.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyArrayAttribute::bindDerived(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyFloatAttribute::bindDerived(), createFromCapsule(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::ErrorCapture::ErrorCapture(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PySymbolRefAttribute::fromList(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInferShapedTypeOpInterface::inferReturnTypeComponents(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInferTypeOpInterface::inferReturnTypes(), mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateRewriteSubmodule(), and mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().
| nb::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::getCapsule | ( | ) |
Gets a capsule wrapping the void* within the MlirContext.
Definition at line 466 of file IRCore.cpp.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
inline |
Definition at line 248 of file IRCore.h.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
static |
Gets the count of live context objects. Used for testing.
Definition at line 502 of file IRCore.cpp.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
| size_t mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::getLiveModuleCount | ( | ) |
Gets the count of live modules associated with this context.
Used for testing.
Definition at line 1883 of file IRCore.cpp.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
| PyMlirContextRef mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMlirContext::getRef | ( | ) |
Gets a strong reference to this context, which will ensure it is kept alive for the life of the reference.
Definition at line 462 of file IRCore.cpp.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PySymbolRefAttribute::fromList(), and mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
inline |
Controls whether error diagnostics should be propagated to diagnostic handlers, instead of being captured by ErrorCapture.
Definition at line 247 of file IRCore.h.
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().
|
friend |