MLIR  16.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"
+ Include dependency graph for Interop.h:
+ This graph shows which files directly or indirectly include this file:

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_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_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_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 * 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 * 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

◆ 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 106 of file Interop.h.

Referenced by pybind11::detail::type_caster< MlirAffineMap >::cast(), pybind11::detail::type_caster< MlirAttribute >::cast(), pybind11::detail::type_caster< MlirDialectRegistry >::cast(), pybind11::detail::type_caster< MlirLocation >::cast(), pybind11::detail::type_caster< MlirModule >::cast(), pybind11::detail::type_caster< MlirOperation >::cast(), pybind11::detail::type_caster< MlirValue >::cast(), pybind11::detail::type_caster< MlirType >::cast(), mlir::python::PyIntegerSet::createFromCapsule(), PYBIND11_MODULE(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ 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 93 of file Interop.h.

Referenced by mlir::python::PyIntegerSet::createFromCapsule(), pybind11::detail::mlirApiObjectToCapsule(), PYBIND11_MODULE(), and mlir::python::PySymbolTable::walkSymbolTables().

◆ 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.

Referenced by mlirPythonAffineExprToCapsule(), and mlirPythonCapsuleToAffineExpr().

◆ 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.

Referenced by mlirPythonAffineMapToCapsule(), and mlirPythonCapsuleToAffineMap().

◆ MLIR_PYTHON_CAPSULE_ATTRIBUTE

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

Definition at line 63 of file Interop.h.

Referenced by mlirPythonAttributeToCapsule(), and mlirPythonCapsuleToAttribute().

◆ MLIR_PYTHON_CAPSULE_CONTEXT

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

Definition at line 65 of file Interop.h.

Referenced by mlirPythonCapsuleToContext(), and mlirPythonContextToCapsule().

◆ MLIR_PYTHON_CAPSULE_DIALECT_REGISTRY

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

◆ MLIR_PYTHON_CAPSULE_EXECUTION_ENGINE

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

◆ MLIR_PYTHON_CAPSULE_INTEGER_SET

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

Definition at line 71 of file Interop.h.

Referenced by mlirPythonCapsuleToIntegerSet(), and mlirPythonIntegerSetToCapsule().

◆ MLIR_PYTHON_CAPSULE_LOCATION

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

Definition at line 73 of file Interop.h.

Referenced by mlirPythonCapsuleToLocation(), and mlirPythonLocationToCapsule().

◆ MLIR_PYTHON_CAPSULE_MODULE

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

Definition at line 75 of file Interop.h.

Referenced by mlirPythonCapsuleToModule(), and mlirPythonModuleToCapsule().

◆ MLIR_PYTHON_CAPSULE_OPERATION

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

Definition at line 77 of file Interop.h.

Referenced by mlirPythonCapsuleToOperation(), and mlirPythonOperationToCapsule().

◆ MLIR_PYTHON_CAPSULE_PASS_MANAGER

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

Definition at line 80 of file Interop.h.

Referenced by mlirPythonCapsuleToPassManager(), and mlirPythonPassManagerToCapsule().

◆ MLIR_PYTHON_CAPSULE_TYPE

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

Definition at line 79 of file Interop.h.

Referenced by mlirPythonCapsuleToType(), and mlirPythonTypeToCapsule().

◆ MLIR_PYTHON_CAPSULE_VALUE

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

Definition at line 82 of file Interop.h.

Referenced by mlirPythonCapsuleToValue(), and mlirPythonValueToCapsule().

◆ MLIR_PYTHON_GET_WRAPPED_POINTER

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

◆ 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 125 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 294 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 144 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().

◆ 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 134 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 303 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 153 of file Interop.h.

References MLIR_PYTHON_CAPSULE_ATTRIBUTE.

Referenced by mlir::python::PyAttribute::createFromCapsule(), and pybind11::detail::type_caster< MlirAttribute >::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 171 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 192 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 342 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 322 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 211 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 229 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 265 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 247 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 284 of file Interop.h.

References MLIR_PYTHON_CAPSULE_TYPE.

Referenced by mlir::python::PyType::createFromCapsule(), and pybind11::detail::type_caster< MlirType >::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 362 of file Interop.h.

References MLIR_PYTHON_CAPSULE_VALUE, and 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 163 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 182 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 332 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 313 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 202 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 220 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 257 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 238 of file Interop.h.

References MLIR_PYTHON_CAPSULE_PASS_MANAGER, and MLIR_PYTHON_GET_WRAPPED_POINTER.

◆ 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 275 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 353 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().