MLIR  19.0.0git
Macros | Functions
Interop.h File Reference
#include <Python.h>
#include "mlir-c/AffineExpr.h"
#include "mlir-c/AffineMap.h"
#include "mlir-c/ExecutionEngine.h"
#include "mlir-c/IR.h"
#include "mlir-c/IntegerSet.h"
#include "mlir-c/Pass.h"

Go to the source code of this file.

Macros

#define MLIR_PYTHON_PACKAGE_PREFIX   mlir.
 
#define MLIR_PYTHON_STRINGIZE(s)   #s
 
#define MLIR_PYTHON_STRINGIZE_ARG(arg)   MLIR_PYTHON_STRINGIZE(arg)
 
#define MAKE_MLIR_PYTHON_QUALNAME(local)    MLIR_PYTHON_STRINGIZE_ARG(MLIR_PYTHON_PACKAGE_PREFIX) local
 
#define MLIR_PYTHON_CAPSULE_AFFINE_EXPR    MAKE_MLIR_PYTHON_QUALNAME("ir.AffineExpr._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_AFFINE_MAP    MAKE_MLIR_PYTHON_QUALNAME("ir.AffineMap._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_ATTRIBUTE    MAKE_MLIR_PYTHON_QUALNAME("ir.Attribute._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_BLOCK   MAKE_MLIR_PYTHON_QUALNAME("ir.Block._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_CONTEXT    MAKE_MLIR_PYTHON_QUALNAME("ir.Context._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_DIALECT_REGISTRY    MAKE_MLIR_PYTHON_QUALNAME("ir.DialectRegistry._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_EXECUTION_ENGINE    MAKE_MLIR_PYTHON_QUALNAME("execution_engine.ExecutionEngine._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_INTEGER_SET    MAKE_MLIR_PYTHON_QUALNAME("ir.IntegerSet._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_LOCATION    MAKE_MLIR_PYTHON_QUALNAME("ir.Location._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_MODULE    MAKE_MLIR_PYTHON_QUALNAME("ir.Module._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_OPERATION    MAKE_MLIR_PYTHON_QUALNAME("ir.Operation._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_TYPE   MAKE_MLIR_PYTHON_QUALNAME("ir.Type._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_PASS_MANAGER    MAKE_MLIR_PYTHON_QUALNAME("passmanager.PassManager._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_VALUE   MAKE_MLIR_PYTHON_QUALNAME("ir.Value._CAPIPtr")
 
#define MLIR_PYTHON_CAPSULE_TYPEID    MAKE_MLIR_PYTHON_QUALNAME("ir.TypeID._CAPIPtr")
 
#define MLIR_PYTHON_CAPI_PTR_ATTR   "_CAPIPtr"
 Attribute on MLIR Python objects that expose their C-API pointer. More...
 
#define MLIR_PYTHON_CAPI_FACTORY_ATTR   "_CAPICreate"
 Attribute on MLIR Python objects that exposes a factory function for constructing the corresponding Python object from a type-specific capsule wrapping the C-API pointer. More...
 
#define MLIR_PYTHON_MAYBE_DOWNCAST_ATTR   "maybe_downcast"
 Attribute on MLIR Python objects that expose a function for downcasting the corresponding Python object to a subclass if the object is in fact a subclass (Concrete or mlir_type_subclass) of ir.Type. More...
 
#define MLIR_PYTHON_CAPI_TYPE_CASTER_REGISTER_ATTR   "register_type_caster"
 Attribute on main C extension module (_mlir) that corresponds to the type caster registration binding. More...
 
#define MLIR_PYTHON_CAPI_VALUE_CASTER_REGISTER_ATTR   "register_value_caster"
 Attribute on main C extension module (_mlir) that corresponds to the value caster registration binding. More...
 
#define MLIR_PYTHON_GET_WRAPPED_POINTER(object)   (void *)(object.ptr)
 Gets a void* from a wrapped struct. More...
 

Functions

static PyObject * mlirPythonAffineExprToCapsule (MlirAffineExpr expr)
 Creates a capsule object encapsulating the raw C-API MlirAffineExpr. More...
 
static MlirAffineExpr mlirPythonCapsuleToAffineExpr (PyObject *capsule)
 Extracts an MlirAffineExpr from a capsule as produced from mlirPythonAffineExprToCapsule. More...
 
static PyObject * mlirPythonAttributeToCapsule (MlirAttribute attribute)
 Creates a capsule object encapsulating the raw C-API MlirAttribute. More...
 
static MlirAttribute mlirPythonCapsuleToAttribute (PyObject *capsule)
 Extracts an MlirAttribute from a capsule as produced from mlirPythonAttributeToCapsule. More...
 
static PyObject * mlirPythonBlockToCapsule (MlirBlock block)
 Creates a capsule object encapsulating the raw C-API MlirBlock. More...
 
static MlirBlock mlirPythonCapsuleToBlock (PyObject *capsule)
 Extracts an MlirBlock from a capsule as produced from mlirPythonBlockToCapsule. More...
 
static PyObject * mlirPythonContextToCapsule (MlirContext context)
 Creates a capsule object encapsulating the raw C-API MlirContext. More...
 
static MlirContext mlirPythonCapsuleToContext (PyObject *capsule)
 Extracts a MlirContext from a capsule as produced from mlirPythonContextToCapsule. More...
 
static PyObject * mlirPythonDialectRegistryToCapsule (MlirDialectRegistry registry)
 Creates a capsule object encapsulating the raw C-API MlirDialectRegistry. More...
 
static MlirDialectRegistry mlirPythonCapsuleToDialectRegistry (PyObject *capsule)
 Extracts an MlirDialectRegistry from a capsule as produced from mlirPythonDialectRegistryToCapsule. More...
 
static PyObject * mlirPythonLocationToCapsule (MlirLocation loc)
 Creates a capsule object encapsulating the raw C-API MlirLocation. More...
 
static MlirLocation mlirPythonCapsuleToLocation (PyObject *capsule)
 Extracts an MlirLocation from a capsule as produced from mlirPythonLocationToCapsule. More...
 
static PyObject * mlirPythonModuleToCapsule (MlirModule module)
 Creates a capsule object encapsulating the raw C-API MlirModule. More...
 
static MlirModule mlirPythonCapsuleToModule (PyObject *capsule)
 Extracts an MlirModule from a capsule as produced from mlirPythonModuleToCapsule. More...
 
static PyObject * mlirPythonPassManagerToCapsule (MlirPassManager pm)
 Creates a capsule object encapsulating the raw C-API MlirPassManager. More...
 
static MlirPassManager mlirPythonCapsuleToPassManager (PyObject *capsule)
 Extracts an MlirPassManager from a capsule as produced from mlirPythonPassManagerToCapsule. More...
 
static PyObject * mlirPythonOperationToCapsule (MlirOperation operation)
 Creates a capsule object encapsulating the raw C-API MlirOperation. More...
 
static MlirOperation mlirPythonCapsuleToOperation (PyObject *capsule)
 Extracts an MlirOperations from a capsule as produced from mlirPythonOperationToCapsule. More...
 
static PyObject * mlirPythonTypeIDToCapsule (MlirTypeID typeID)
 Creates a capsule object encapsulating the raw C-API MlirTypeID. More...
 
static MlirTypeID mlirPythonCapsuleToTypeID (PyObject *capsule)
 Extracts an MlirTypeID from a capsule as produced from mlirPythonTypeIDToCapsule. More...
 
static PyObject * mlirPythonTypeToCapsule (MlirType type)
 Creates a capsule object encapsulating the raw C-API MlirType. More...
 
static MlirType mlirPythonCapsuleToType (PyObject *capsule)
 Extracts an MlirType from a capsule as produced from mlirPythonTypeToCapsule. More...
 
static PyObject * mlirPythonAffineMapToCapsule (MlirAffineMap affineMap)
 Creates a capsule object encapsulating the raw C-API MlirAffineMap. More...
 
static MlirAffineMap mlirPythonCapsuleToAffineMap (PyObject *capsule)
 Extracts an MlirAffineMap from a capsule as produced from mlirPythonAffineMapToCapsule. More...
 
static PyObject * mlirPythonIntegerSetToCapsule (MlirIntegerSet integerSet)
 Creates a capsule object encapsulating the raw C-API MlirIntegerSet. More...
 
static MlirIntegerSet mlirPythonCapsuleToIntegerSet (PyObject *capsule)
 Extracts an MlirIntegerSet from a capsule as produced from mlirPythonIntegerSetToCapsule. More...
 
static PyObject * mlirPythonExecutionEngineToCapsule (MlirExecutionEngine jit)
 Creates a capsule object encapsulating the raw C-API MlirExecutionEngine. More...
 
static MlirExecutionEngine mlirPythonCapsuleToExecutionEngine (PyObject *capsule)
 Extracts an MlirExecutionEngine from a capsule as produced from mlirPythonIntegerSetToCapsule. More...
 
static PyObject * mlirPythonValueToCapsule (MlirValue value)
 Creates a capsule object encapsulating the raw C-API MlirValue. More...
 
static MlirValue mlirPythonCapsuleToValue (PyObject *capsule)
 Extracts an MlirValue from a capsule as produced from mlirPythonValueToCapsule. More...
 

Macro Definition Documentation

◆ MAKE_MLIR_PYTHON_QUALNAME

#define MAKE_MLIR_PYTHON_QUALNAME (   local)     MLIR_PYTHON_STRINGIZE_ARG(MLIR_PYTHON_PACKAGE_PREFIX) local

Definition at line 56 of file Interop.h.

◆ MLIR_PYTHON_CAPI_FACTORY_ATTR

#define MLIR_PYTHON_CAPI_FACTORY_ATTR   "_CAPICreate"

Attribute on MLIR Python objects that exposes a factory function for constructing the corresponding Python object from a type-specific capsule wrapping the C-API pointer.

The signature of the function is: def _CAPICreate(capsule) -> object Calling such a function implies a transfer of ownership of the object the capsule wraps: after such a call, the capsule should be considered invalid, and its wrapped pointer must not be destroyed.

Only a very small number of Python objects can be created in such a fashion (i.e. top-level types such as Context where the lifetime can be cleanly delineated).

Definition at line 109 of file Interop.h.

◆ MLIR_PYTHON_CAPI_PTR_ATTR

#define MLIR_PYTHON_CAPI_PTR_ATTR   "_CAPIPtr"

Attribute on MLIR Python objects that expose their C-API pointer.

This will be a type-specific capsule created as per one of the helpers below.

Ownership is not transferred by acquiring a capsule in this way: the validity of the pointer wrapped by the capsule will be bounded by the lifetime of the Python object that produced it. Only the name and pointer of the capsule are set. The caller is free to set a destructor and context as needed to manage anything further.

Definition at line 96 of file Interop.h.

◆ MLIR_PYTHON_CAPI_TYPE_CASTER_REGISTER_ATTR

#define MLIR_PYTHON_CAPI_TYPE_CASTER_REGISTER_ATTR   "register_type_caster"

Attribute on main C extension module (_mlir) that corresponds to the type caster registration binding.

The signature of the function is: def register_type_caster(MlirTypeID mlirTypeID, *, bool replace) which then takes a typeCaster (register_type_caster is meant to be used as a decorator from python), and where replace indicates the typeCaster should replace any existing registered type casters (such as those for upstream ConcreteTypes). The interface of the typeCaster is: def type_caster(ir.Type) -> SubClassTypeT where SubClassTypeT indicates the result should be a subclass (inherit from) ir.Type.

Definition at line 129 of file Interop.h.

◆ MLIR_PYTHON_CAPI_VALUE_CASTER_REGISTER_ATTR

#define MLIR_PYTHON_CAPI_VALUE_CASTER_REGISTER_ATTR   "register_value_caster"

Attribute on main C extension module (_mlir) that corresponds to the value caster registration binding.

The signature of the function is: def register_value_caster(MlirTypeID mlirTypeID, *, bool replace) which then takes a valueCaster (register_value_caster is meant to be used as a decorator, from python), and where replace indicates the valueCaster should replace any existing registered value casters. The interface of the valueCaster is: def value_caster(ir.Value) -> SubClassValueT where SubClassValueT indicates the result should be a subclass (inherit from) ir.Value.

Definition at line 141 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_AFFINE_EXPR

#define MLIR_PYTHON_CAPSULE_AFFINE_EXPR    MAKE_MLIR_PYTHON_QUALNAME("ir.AffineExpr._CAPIPtr")

Definition at line 59 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_AFFINE_MAP

#define MLIR_PYTHON_CAPSULE_AFFINE_MAP    MAKE_MLIR_PYTHON_QUALNAME("ir.AffineMap._CAPIPtr")

Definition at line 61 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_ATTRIBUTE

#define MLIR_PYTHON_CAPSULE_ATTRIBUTE    MAKE_MLIR_PYTHON_QUALNAME("ir.Attribute._CAPIPtr")

Definition at line 63 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_BLOCK

#define MLIR_PYTHON_CAPSULE_BLOCK   MAKE_MLIR_PYTHON_QUALNAME("ir.Block._CAPIPtr")

Definition at line 65 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_CONTEXT

#define MLIR_PYTHON_CAPSULE_CONTEXT    MAKE_MLIR_PYTHON_QUALNAME("ir.Context._CAPIPtr")

Definition at line 66 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_DIALECT_REGISTRY

#define MLIR_PYTHON_CAPSULE_DIALECT_REGISTRY    MAKE_MLIR_PYTHON_QUALNAME("ir.DialectRegistry._CAPIPtr")

Definition at line 68 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_EXECUTION_ENGINE

#define MLIR_PYTHON_CAPSULE_EXECUTION_ENGINE    MAKE_MLIR_PYTHON_QUALNAME("execution_engine.ExecutionEngine._CAPIPtr")

Definition at line 70 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_INTEGER_SET

#define MLIR_PYTHON_CAPSULE_INTEGER_SET    MAKE_MLIR_PYTHON_QUALNAME("ir.IntegerSet._CAPIPtr")

Definition at line 72 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_LOCATION

#define MLIR_PYTHON_CAPSULE_LOCATION    MAKE_MLIR_PYTHON_QUALNAME("ir.Location._CAPIPtr")

Definition at line 74 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_MODULE

#define MLIR_PYTHON_CAPSULE_MODULE    MAKE_MLIR_PYTHON_QUALNAME("ir.Module._CAPIPtr")

Definition at line 76 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_OPERATION

#define MLIR_PYTHON_CAPSULE_OPERATION    MAKE_MLIR_PYTHON_QUALNAME("ir.Operation._CAPIPtr")

Definition at line 78 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_PASS_MANAGER

#define MLIR_PYTHON_CAPSULE_PASS_MANAGER    MAKE_MLIR_PYTHON_QUALNAME("passmanager.PassManager._CAPIPtr")

Definition at line 81 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_TYPE

#define MLIR_PYTHON_CAPSULE_TYPE   MAKE_MLIR_PYTHON_QUALNAME("ir.Type._CAPIPtr")

Definition at line 80 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_TYPEID

#define MLIR_PYTHON_CAPSULE_TYPEID    MAKE_MLIR_PYTHON_QUALNAME("ir.TypeID._CAPIPtr")

Definition at line 84 of file Interop.h.

◆ MLIR_PYTHON_CAPSULE_VALUE

#define MLIR_PYTHON_CAPSULE_VALUE   MAKE_MLIR_PYTHON_QUALNAME("ir.Value._CAPIPtr")

Definition at line 83 of file Interop.h.

◆ MLIR_PYTHON_GET_WRAPPED_POINTER

#define MLIR_PYTHON_GET_WRAPPED_POINTER (   object)    (void *)(object.ptr)

Gets a void* from a wrapped struct.

Needed because const cast is different between C/C++.

Definition at line 149 of file Interop.h.

◆ MLIR_PYTHON_MAYBE_DOWNCAST_ATTR

#define MLIR_PYTHON_MAYBE_DOWNCAST_ATTR   "maybe_downcast"

Attribute on MLIR Python objects that expose a function for downcasting the corresponding Python object to a subclass if the object is in fact a subclass (Concrete or mlir_type_subclass) of ir.Type.

The signature of the function is: def maybe_downcast(self) -> object where the resulting object will (possibly) be an instance of the subclass.

Definition at line 117 of file Interop.h.

◆ MLIR_PYTHON_PACKAGE_PREFIX

#define MLIR_PYTHON_PACKAGE_PREFIX   mlir.

Definition at line 50 of file Interop.h.

◆ MLIR_PYTHON_STRINGIZE

#define MLIR_PYTHON_STRINGIZE (   s)    #s

Definition at line 54 of file Interop.h.

◆ MLIR_PYTHON_STRINGIZE_ARG

#define MLIR_PYTHON_STRINGIZE_ARG (   arg)    MLIR_PYTHON_STRINGIZE(arg)

Definition at line 55 of file Interop.h.

Function Documentation

◆ mlirPythonAffineExprToCapsule()

static PyObject* mlirPythonAffineExprToCapsule ( MlirAffineExpr  expr)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirAffineExpr.

The returned capsule does not extend or affect ownership of any Python objects that reference the expression in any way.

Definition at line 160 of file Interop.h.

References MLIR_PYTHON_CAPSULE_AFFINE_EXPR, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by mlir::python::PyAffineExpr::getCapsule().

◆ mlirPythonAffineMapToCapsule()

static PyObject* mlirPythonAffineMapToCapsule ( MlirAffineMap  affineMap)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirAffineMap.

The returned capsule does not extend or affect ownership of any Python objects that reference the type in any way.

Definition at line 365 of file Interop.h.

References MLIR_PYTHON_CAPSULE_AFFINE_MAP, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirAffineMap >::cast(), and mlir::python::PyAffineMap::getCapsule().

◆ mlirPythonAttributeToCapsule()

static PyObject* mlirPythonAttributeToCapsule ( MlirAttribute  attribute)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirAttribute.

The returned capsule does not extend or affect ownership of any Python objects that reference the attribute in any way.

Definition at line 179 of file Interop.h.

References MLIR_PYTHON_CAPSULE_ATTRIBUTE, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirAttribute >::cast(), and mlir::python::PyAttribute::getCapsule().

◆ mlirPythonBlockToCapsule()

static PyObject* mlirPythonBlockToCapsule ( MlirBlock  block)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirBlock.

The returned capsule does not extend or affect ownership of any Python objects that reference the module in any way.

Definition at line 197 of file Interop.h.

References MLIR_PYTHON_CAPSULE_BLOCK, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by mlir::python::PyBlock::getCapsule().

◆ mlirPythonCapsuleToAffineExpr()

static MlirAffineExpr mlirPythonCapsuleToAffineExpr ( PyObject *  capsule)
inlinestatic

Extracts an MlirAffineExpr from a capsule as produced from mlirPythonAffineExprToCapsule.

If the capsule is not of the right type, then a null expression is returned (as checked via mlirAffineExprIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 169 of file Interop.h.

References MLIR_PYTHON_CAPSULE_AFFINE_EXPR.

Referenced by mlir::python::PyAffineExpr::createFromCapsule().

◆ mlirPythonCapsuleToAffineMap()

static MlirAffineMap mlirPythonCapsuleToAffineMap ( PyObject *  capsule)
inlinestatic

Extracts an MlirAffineMap from a capsule as produced from mlirPythonAffineMapToCapsule.

If the capsule is not of the right type, then a null type is returned (as checked via mlirAffineMapIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 374 of file Interop.h.

References MLIR_PYTHON_CAPSULE_AFFINE_MAP.

Referenced by mlir::python::PyAffineMap::createFromCapsule(), and pybind11::detail::type_caster< MlirAffineMap >::load().

◆ mlirPythonCapsuleToAttribute()

static MlirAttribute mlirPythonCapsuleToAttribute ( PyObject *  capsule)
inlinestatic

Extracts an MlirAttribute from a capsule as produced from mlirPythonAttributeToCapsule.

If the capsule is not of the right type, then a null attribute is returned (as checked via mlirAttributeIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 188 of file Interop.h.

References MLIR_PYTHON_CAPSULE_ATTRIBUTE.

Referenced by mlir::python::PyAttribute::createFromCapsule(), and pybind11::detail::type_caster< MlirAttribute >::load().

◆ mlirPythonCapsuleToBlock()

static MlirBlock mlirPythonCapsuleToBlock ( PyObject *  capsule)
inlinestatic

Extracts an MlirBlock from a capsule as produced from mlirPythonBlockToCapsule.

If the capsule is not of the right type, then a null pass manager is returned (as checked via mlirBlockIsNull).

Definition at line 205 of file Interop.h.

References MLIR_PYTHON_CAPSULE_BLOCK.

Referenced by pybind11::detail::type_caster< MlirBlock >::load().

◆ mlirPythonCapsuleToContext()

static MlirContext mlirPythonCapsuleToContext ( PyObject *  capsule)
inlinestatic

Extracts a MlirContext from a capsule as produced from mlirPythonContextToCapsule.

If the capsule is not of the right type, then a null context is returned (as checked via mlirContextIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 223 of file Interop.h.

References MLIR_PYTHON_CAPSULE_CONTEXT.

Referenced by mlir::python::PyMlirContext::createFromCapsule(), and pybind11::detail::type_caster< MlirContext >::load().

◆ mlirPythonCapsuleToDialectRegistry()

static MlirDialectRegistry mlirPythonCapsuleToDialectRegistry ( PyObject *  capsule)
inlinestatic

Extracts an MlirDialectRegistry from a capsule as produced from mlirPythonDialectRegistryToCapsule.

If the capsule is not of the right type, then a null context is returned (as checked via mlirContextIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 244 of file Interop.h.

References MLIR_PYTHON_CAPSULE_DIALECT_REGISTRY.

Referenced by mlir::python::PyDialectRegistry::createFromCapsule(), and pybind11::detail::type_caster< MlirDialectRegistry >::load().

◆ mlirPythonCapsuleToExecutionEngine()

static MlirExecutionEngine mlirPythonCapsuleToExecutionEngine ( PyObject *  capsule)
inlinestatic

Extracts an MlirExecutionEngine from a capsule as produced from mlirPythonIntegerSetToCapsule.

If the capsule is not of the right type, then a null set is returned (as checked via mlirExecutionEngineIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 413 of file Interop.h.

References MLIR_PYTHON_CAPSULE_EXECUTION_ENGINE.

◆ mlirPythonCapsuleToIntegerSet()

static MlirIntegerSet mlirPythonCapsuleToIntegerSet ( PyObject *  capsule)
inlinestatic

Extracts an MlirIntegerSet from a capsule as produced from mlirPythonIntegerSetToCapsule.

If the capsule is not of the right type, then a null set is returned (as checked via mlirIntegerSetIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 393 of file Interop.h.

References MLIR_PYTHON_CAPSULE_INTEGER_SET.

Referenced by mlir::python::PyIntegerSet::createFromCapsule().

◆ mlirPythonCapsuleToLocation()

static MlirLocation mlirPythonCapsuleToLocation ( PyObject *  capsule)
inlinestatic

Extracts an MlirLocation from a capsule as produced from mlirPythonLocationToCapsule.

If the capsule is not of the right type, then a null module is returned (as checked via mlirLocationIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 263 of file Interop.h.

References MLIR_PYTHON_CAPSULE_LOCATION.

Referenced by mlir::python::PyLocation::createFromCapsule(), and pybind11::detail::type_caster< MlirLocation >::load().

◆ mlirPythonCapsuleToModule()

static MlirModule mlirPythonCapsuleToModule ( PyObject *  capsule)
inlinestatic

Extracts an MlirModule from a capsule as produced from mlirPythonModuleToCapsule.

If the capsule is not of the right type, then a null module is returned (as checked via mlirModuleIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 281 of file Interop.h.

References MLIR_PYTHON_CAPSULE_MODULE.

Referenced by mlir::python::PyModule::createFromCapsule(), and pybind11::detail::type_caster< MlirModule >::load().

◆ mlirPythonCapsuleToOperation()

static MlirOperation mlirPythonCapsuleToOperation ( PyObject *  capsule)
inlinestatic

Extracts an MlirOperations from a capsule as produced from mlirPythonOperationToCapsule.

If the capsule is not of the right type, then a null type is returned (as checked via mlirOperationIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 317 of file Interop.h.

References MLIR_PYTHON_CAPSULE_OPERATION.

Referenced by mlir::python::PyOperation::createFromCapsule(), and pybind11::detail::type_caster< MlirOperation >::load().

◆ mlirPythonCapsuleToPassManager()

static MlirPassManager mlirPythonCapsuleToPassManager ( PyObject *  capsule)
inlinestatic

Extracts an MlirPassManager from a capsule as produced from mlirPythonPassManagerToCapsule.

If the capsule is not of the right type, then a null pass manager is returned (as checked via mlirPassManagerIsNull).

Definition at line 299 of file Interop.h.

References MLIR_PYTHON_CAPSULE_PASS_MANAGER.

Referenced by pybind11::detail::type_caster< MlirPassManager >::load().

◆ mlirPythonCapsuleToType()

static MlirType mlirPythonCapsuleToType ( PyObject *  capsule)
inlinestatic

Extracts an MlirType from a capsule as produced from mlirPythonTypeToCapsule.

If the capsule is not of the right type, then a null type is returned (as checked via mlirTypeIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 355 of file Interop.h.

References MLIR_PYTHON_CAPSULE_TYPE.

Referenced by mlir::python::PyType::createFromCapsule(), and pybind11::detail::type_caster< MlirType >::load().

◆ mlirPythonCapsuleToTypeID()

static MlirTypeID mlirPythonCapsuleToTypeID ( PyObject *  capsule)
inlinestatic

Extracts an MlirTypeID from a capsule as produced from mlirPythonTypeIDToCapsule.

If the capsule is not of the right type, then a null type is returned (as checked via mlirTypeIDIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 336 of file Interop.h.

References MLIR_PYTHON_CAPSULE_TYPEID.

Referenced by mlir::python::PyTypeID::createFromCapsule(), and pybind11::detail::type_caster< MlirTypeID >::load().

◆ mlirPythonCapsuleToValue()

static MlirValue mlirPythonCapsuleToValue ( PyObject *  capsule)
inlinestatic

Extracts an MlirValue from a capsule as produced from mlirPythonValueToCapsule.

If the capsule is not of the right type, then a null type is returned (as checked via mlirValueIsNull). In such a case, the Python APIs will have already set an error.

Definition at line 433 of file Interop.h.

References MLIR_PYTHON_CAPSULE_VALUE.

Referenced by mlir::python::PyValue::createFromCapsule(), and pybind11::detail::type_caster< MlirValue >::load().

◆ mlirPythonContextToCapsule()

static PyObject* mlirPythonContextToCapsule ( MlirContext  context)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirContext.

The returned capsule does not extend or affect ownership of any Python objects that reference the context in any way.

Definition at line 215 of file Interop.h.

References MLIR_PYTHON_CAPSULE_CONTEXT.

Referenced by mlir::python::PyMlirContext::getCapsule().

◆ mlirPythonDialectRegistryToCapsule()

static PyObject* mlirPythonDialectRegistryToCapsule ( MlirDialectRegistry  registry)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirDialectRegistry.

The returned capsule does not extend or affect ownership of any Python objects that reference the context in any way.

Definition at line 234 of file Interop.h.

References MLIR_PYTHON_CAPSULE_DIALECT_REGISTRY.

Referenced by pybind11::detail::type_caster< MlirDialectRegistry >::cast(), and mlir::python::PyDialectRegistry::getCapsule().

◆ mlirPythonExecutionEngineToCapsule()

static PyObject* mlirPythonExecutionEngineToCapsule ( MlirExecutionEngine  jit)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirExecutionEngine.

The returned capsule does not extend or affect ownership of any Python objects that reference the set in any way.

Definition at line 403 of file Interop.h.

References MLIR_PYTHON_CAPSULE_EXECUTION_ENGINE, and MLIR_PYTHON_GET_WRAPPED_POINTER.

◆ mlirPythonIntegerSetToCapsule()

static PyObject* mlirPythonIntegerSetToCapsule ( MlirIntegerSet  integerSet)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirIntegerSet.

The returned capsule does not extend or affect ownership of any Python objects that reference the set in any way.

Definition at line 384 of file Interop.h.

References MLIR_PYTHON_CAPSULE_INTEGER_SET, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by mlir::python::PyIntegerSet::getCapsule().

◆ mlirPythonLocationToCapsule()

static PyObject* mlirPythonLocationToCapsule ( MlirLocation  loc)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirLocation.

The returned capsule does not extend or affect ownership of any Python objects that reference the location in any way.

Definition at line 254 of file Interop.h.

References MLIR_PYTHON_CAPSULE_LOCATION, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirLocation >::cast(), and mlir::python::PyLocation::getCapsule().

◆ mlirPythonModuleToCapsule()

static PyObject* mlirPythonModuleToCapsule ( MlirModule  module)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirModule.

The returned capsule does not extend or affect ownership of any Python objects that reference the module in any way.

Definition at line 272 of file Interop.h.

References MLIR_PYTHON_CAPSULE_MODULE, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirModule >::cast(), and mlir::python::PyModule::getCapsule().

◆ mlirPythonOperationToCapsule()

static PyObject* mlirPythonOperationToCapsule ( MlirOperation  operation)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirOperation.

The returned capsule does not extend or affect ownership of any Python objects that reference the operation in any way.

Definition at line 309 of file Interop.h.

References MLIR_PYTHON_CAPSULE_OPERATION.

Referenced by pybind11::detail::type_caster< MlirOperation >::cast(), and mlir::python::PyOperation::getCapsule().

◆ mlirPythonPassManagerToCapsule()

static PyObject* mlirPythonPassManagerToCapsule ( MlirPassManager  pm)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirPassManager.

The returned capsule does not extend or affect ownership of any Python objects that reference the module in any way.

Definition at line 290 of file Interop.h.

References MLIR_PYTHON_CAPSULE_PASS_MANAGER, and MLIR_PYTHON_GET_WRAPPED_POINTER.

◆ mlirPythonTypeIDToCapsule()

static PyObject* mlirPythonTypeIDToCapsule ( MlirTypeID  typeID)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirTypeID.

The returned capsule does not extend or affect ownership of any Python objects that reference the type in any way.

Definition at line 327 of file Interop.h.

References MLIR_PYTHON_CAPSULE_TYPEID, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirTypeID >::cast(), and mlir::python::PyTypeID::getCapsule().

◆ mlirPythonTypeToCapsule()

static PyObject* mlirPythonTypeToCapsule ( MlirType  type)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirType.

The returned capsule does not extend or affect ownership of any Python objects that reference the type in any way.

Definition at line 346 of file Interop.h.

References MLIR_PYTHON_CAPSULE_TYPE, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirType >::cast(), and mlir::python::PyType::getCapsule().

◆ mlirPythonValueToCapsule()

static PyObject* mlirPythonValueToCapsule ( MlirValue  value)
inlinestatic

Creates a capsule object encapsulating the raw C-API MlirValue.

The returned capsule does not extend or affect ownership of any Python objects that reference the operation in any way.

Definition at line 424 of file Interop.h.

References MLIR_PYTHON_CAPSULE_VALUE, and MLIR_PYTHON_GET_WRAPPED_POINTER.

Referenced by pybind11::detail::type_caster< MlirValue >::cast(), and mlir::python::PyValue::getCapsule().