MLIR
22.0.0git
|
Wrapper around the generic MlirAttribute. More...
#include "Bindings/Python/IRModule.h"
Public Member Functions | |
PyAttribute (PyMlirContextRef contextRef, MlirAttribute attr) | |
bool | operator== (const PyAttribute &other) const |
operator MlirAttribute () const | |
MlirAttribute | get () const |
nanobind::object | getCapsule () |
Gets a capsule wrapping the void* within the MlirAttribute. More... | |
nanobind::typed< nanobind::object, PyAttribute > | maybeDownCast () |
![]() | |
BaseContextObject (PyMlirContextRef ref) | |
PyMlirContextRef & | getContext () |
Accesses the context reference. More... | |
Static Public Member Functions | |
static PyAttribute | createFromCapsule (nanobind::object capsule) |
Creates a PyAttribute from the MlirAttribute wrapped by a capsule. More... | |
Wrapper around the generic MlirAttribute.
The lifetime of a type is bound by the PyContext that created it.
Definition at line 1006 of file IRModule.h.
|
inline |
Definition at line 1008 of file IRModule.h.
Referenced by createFromCapsule().
|
static |
Creates a PyAttribute from the MlirAttribute wrapped by a capsule.
Note that PyAttribute instances are uniqued, so the returned object may be a pre-existing object. Ownership of the underlying MlirAttribute is taken by calling this function.
Definition at line 2128 of file IRCore.cpp.
References mlir::python::PyMlirContext::forContext(), mlirAttributeGetContext(), mlirAttributeIsNull(), mlirPythonCapsuleToAttribute(), and PyAttribute().
|
inline |
Definition at line 1012 of file IRModule.h.
Referenced by maybeDownCast().
nb::object PyAttribute::getCapsule | ( | ) |
Gets a capsule wrapping the void* within the MlirAttribute.
Definition at line 2124 of file IRCore.cpp.
References mlirPythonAttributeToCapsule().
nb::typed< nb::object, PyAttribute > PyAttribute::maybeDownCast | ( | ) |
Definition at line 2136 of file IRCore.cpp.
References mlir::python::PyGlobals::get(), get(), mlir::python::PyGlobals::lookupTypeCaster(), mlirAttributeGetDialect(), mlirAttributeGetTypeID(), and mlirTypeIDIsNull().
|
inline |
Definition at line 1011 of file IRModule.h.
bool PyAttribute::operator== | ( | const PyAttribute & | other | ) | const |
Definition at line 2120 of file IRCore.cpp.
References mlirAttributeEqual().