|
MLIR 24.0.0git
|
#include "mlir-c/Interfaces.h"#include "mlir/CAPI/IR.h"#include "mlir/CAPI/Interfaces.h"#include "mlir/CAPI/Support.h"#include "mlir/CAPI/Wrap.h"#include "mlir/IR/ValueRange.h"#include "mlir/Interfaces/InferTypeOpInterface.h"#include "llvm/ADT/ScopeExit.h"#include <optional>Go to the source code of this file.
Classes | |
| class | ConditionallySpeculatableOpInterfaceFallbackModel |
| Fallback model for the ConditionallySpeculatable interface that uses C API callbacks. More... | |
| class | MemoryEffectOpInterfaceFallbackModel |
| Fallback model for the MemoryEffectsOpInterface that uses C API callbacks. More... | |
Functions | |
| bool | mlirOperationImplementsInterface (MlirOperation operation, MlirTypeID interfaceTypeID) |
| Returns true if the given operation implements an interface identified by its TypeID. | |
| bool | mlirOperationImplementsInterfaceStatic (MlirStringRef operationName, MlirContext context, MlirTypeID interfaceTypeID) |
| Returns true if the operation identified by its canonical string name implements the interface identified by its TypeID in the given context. | |
| MlirTypeID | mlirInferTypeOpInterfaceTypeID () |
| Returns the interface TypeID of the InferTypeOpInterface. | |
| MlirLogicalResult | mlirInferTypeOpInterfaceInferReturnTypes (MlirStringRef opName, MlirContext context, MlirLocation location, intptr_t nOperands, MlirValue *operands, MlirAttribute attributes, void *properties, intptr_t nRegions, MlirRegion *regions, MlirTypesCallback callback, void *userData) |
| Infers the return types of the operation identified by its canonical given the arguments that will be supplied to its generic builder. | |
| MlirTypeID | mlirInferShapedTypeOpInterfaceTypeID () |
| Returns the interface TypeID of the InferShapedTypeOpInterface. | |
| MlirLogicalResult | mlirInferShapedTypeOpInterfaceInferReturnTypes (MlirStringRef opName, MlirContext context, MlirLocation location, intptr_t nOperands, MlirValue *operands, MlirAttribute attributes, void *properties, intptr_t nRegions, MlirRegion *regions, MlirShapedTypeComponentsCallback callback, void *userData) |
| Infers the return shaped type components of the operation. | |
| MlirTypeID | mlirConditionallySpeculatableOpInterfaceTypeID () |
| Returns the interface TypeID of the ConditionallySpeculatable interface. | |
| void | mlirConditionallySpeculatableOpInterfaceAttachFallbackModel (MlirContext ctx, MlirStringRef opName, MlirConditionallySpeculatableOpInterfaceCallbacks callbacks) |
| Attach a ConditionallySpeculatable FallbackModel to the given named op. | |
| MlirSpeculatability | mlirConditionallySpeculatableOpInterfaceGetSpeculatability (MlirOperation operation) |
| Returns the speculatability of the given operation. | |
| MlirMemoryEffect | mlirMemoryEffectsAllocateGet () |
| Returns the borrowed singleton instance of the allocate memory effect. | |
| MlirMemoryEffect | mlirMemoryEffectsFreeGet () |
| Returns the borrowed singleton instance of the free memory effect. | |
| MlirMemoryEffect | mlirMemoryEffectsReadGet () |
| Returns the borrowed singleton instance of the read memory effect. | |
| MlirMemoryEffect | mlirMemoryEffectsWriteGet () |
| Returns the borrowed singleton instance of the write memory effect. | |
| MlirSideEffectResource | mlirSideEffectsDefaultResourceGet () |
| Returns the borrowed singleton instance of the default side effect resource. | |
| MlirMemoryEffectInstance | mlirMemoryEffectInstanceCreate (MlirMemoryEffect effect, MlirAttribute parameters, int stage, bool effectOnFullRegion, MlirSideEffectResource resource) |
| Creates a memory effect instance without an associated IR entity. | |
| MlirMemoryEffectInstance | mlirMemoryEffectInstanceCreateForOpOperand (MlirMemoryEffect effect, MlirOpOperand opOperand, MlirAttribute parameters, int stage, bool effectOnFullRegion, MlirSideEffectResource resource) |
| Creates a memory effect instance associated with an operation operand. | |
| MlirMemoryEffectInstance | mlirMemoryEffectInstanceCreateForOpResult (MlirMemoryEffect effect, MlirValue result, MlirAttribute parameters, int stage, bool effectOnFullRegion, MlirSideEffectResource resource) |
| Creates a memory effect instance associated with an operation result. | |
| MlirMemoryEffectInstance | mlirMemoryEffectInstanceCreateForBlockArgument (MlirMemoryEffect effect, MlirValue blockArgument, MlirAttribute parameters, int stage, bool effectOnFullRegion, MlirSideEffectResource resource) |
| Creates a memory effect instance associated with a block argument. | |
| MlirMemoryEffectInstance | mlirMemoryEffectInstanceCreateForSymbol (MlirMemoryEffect effect, MlirAttribute symbol, MlirAttribute parameters, int stage, bool effectOnFullRegion, MlirSideEffectResource resource) |
| Creates a memory effect instance associated with a symbol. | |
| void | mlirMemoryEffectInstanceDestroy (MlirMemoryEffectInstance instance) |
| Destroys a memory effect instance created by one of the functions above. | |
| void | mlirMemoryEffectInstancesListAppend (MlirMemoryEffectInstancesList list, MlirMemoryEffectInstance instance) |
| Appends a copy of instance to the given list. | |
| MlirTypeID | mlirMemoryEffectsOpInterfaceTypeID () |
| Returns the interface TypeID of the MemoryEffectsOpInterface. | |
| void | mlirMemoryEffectsOpInterfaceAttachFallbackModel (MlirContext ctx, MlirStringRef opName, MlirMemoryEffectsOpInterfaceCallbacks callbacks) |
| Attach a MemoryEffectsOpInterface FallbackModel to the given named op. | |
| void mlirConditionallySpeculatableOpInterfaceAttachFallbackModel | ( | MlirContext | ctx, |
| MlirStringRef | opName, | ||
| MlirConditionallySpeculatableOpInterfaceCallbacks | callbacks ) |
Attach a ConditionallySpeculatable FallbackModel to the given named op.
Attach a new FallbackModel for the ConditionallySpeculatable interface to the named operation.
The FallbackModel uses the provided callbacks to implement the interface.
Definition at line 242 of file Interfaces.cpp.
References mlir::RegisteredOperationName::lookup(), ConditionallySpeculatableOpInterfaceFallbackModel::setCallbacks(), and unwrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConditionallySpeculatableOpInterface::attach().
| MlirSpeculatability mlirConditionallySpeculatableOpInterfaceGetSpeculatability | ( | MlirOperation | operation | ) |
Returns the speculatability of the given operation.
The operation must implement the ConditionallySpeculatable interface.
Definition at line 263 of file Interfaces.cpp.
References MlirSpeculatabilityNotSpeculatable, MlirSpeculatabilityRecursivelySpeculatable, MlirSpeculatabilitySpeculatable, mlir::Speculation::NotSpeculatable, mlir::Speculation::RecursivelySpeculatable, mlir::Speculation::Speculatable, and unwrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConditionallySpeculatableOpInterface::bindDerived().
| MlirTypeID mlirConditionallySpeculatableOpInterfaceTypeID | ( | void | ) |
Returns the interface TypeID of the ConditionallySpeculatable interface.
Definition at line 186 of file Interfaces.cpp.
References wrap().
| MlirLogicalResult mlirInferShapedTypeOpInterfaceInferReturnTypes | ( | MlirStringRef | opName, |
| MlirContext | context, | ||
| MlirLocation | location, | ||
| intptr_t | nOperands, | ||
| MlirValue * | operands, | ||
| MlirAttribute | attributes, | ||
| void * | properties, | ||
| intptr_t | nRegions, | ||
| MlirRegion * | regions, | ||
| MlirShapedTypeComponentsCallback | callback, | ||
| void * | userData ) |
Infers the return shaped type components of the operation.
Calls callback with the types of inferred arguments on success. Returns failure otherwise.
Definition at line 133 of file Interfaces.cpp.
References mlirLogicalResultFailure(), mlirLogicalResultSuccess(), unwrap(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInferShapedTypeOpInterface::inferReturnTypeComponents().
| MlirTypeID mlirInferShapedTypeOpInterfaceTypeID | ( | void | ) |
Returns the interface TypeID of the InferShapedTypeOpInterface.
Definition at line 129 of file Interfaces.cpp.
References wrap().
| MlirLogicalResult mlirInferTypeOpInterfaceInferReturnTypes | ( | MlirStringRef | opName, |
| MlirContext | context, | ||
| MlirLocation | location, | ||
| intptr_t | nOperands, | ||
| MlirValue * | operands, | ||
| MlirAttribute | attributes, | ||
| void * | properties, | ||
| intptr_t | nRegions, | ||
| MlirRegion * | regions, | ||
| MlirTypesCallback | callback, | ||
| void * | userData ) |
Infers the return types of the operation identified by its canonical given the arguments that will be supplied to its generic builder.
Calls callback with the types of inferred arguments, potentially several times, on success. Returns failure otherwise.
Definition at line 92 of file Interfaces.cpp.
References MlirStringRef::data, MlirStringRef::length, mlirLogicalResultFailure(), mlirLogicalResultSuccess(), unwrap(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInferTypeOpInterface::inferReturnTypes().
| MlirTypeID mlirInferTypeOpInterfaceTypeID | ( | void | ) |
Returns the interface TypeID of the InferTypeOpInterface.
Definition at line 88 of file Interfaces.cpp.
References wrap().
| MlirMemoryEffectInstance mlirMemoryEffectInstanceCreate | ( | MlirMemoryEffect | effect, |
| MlirAttribute | parameters, | ||
| int | stage, | ||
| bool | effectOnFullRegion, | ||
| MlirSideEffectResource | resource ) |
Creates a memory effect instance without an associated IR entity.
parameters may be a null attribute. The caller owns the returned instance and must destroy it with mlirMemoryEffectInstanceDestroy.
Definition at line 306 of file Interfaces.cpp.
| MlirMemoryEffectInstance mlirMemoryEffectInstanceCreateForBlockArgument | ( | MlirMemoryEffect | effect, |
| MlirValue | blockArgument, | ||
| MlirAttribute | parameters, | ||
| int | stage, | ||
| bool | effectOnFullRegion, | ||
| MlirSideEffectResource | resource ) |
Creates a memory effect instance associated with a block argument.
blockArgument must wrap a BlockArgument. parameters may be a null attribute. The caller owns the returned instance and must destroy it with mlirMemoryEffectInstanceDestroy.
Definition at line 330 of file Interfaces.cpp.
| MlirMemoryEffectInstance mlirMemoryEffectInstanceCreateForOpOperand | ( | MlirMemoryEffect | effect, |
| MlirOpOperand | opOperand, | ||
| MlirAttribute | parameters, | ||
| int | stage, | ||
| bool | effectOnFullRegion, | ||
| MlirSideEffectResource | resource ) |
Creates a memory effect instance associated with an operation operand.
parameters may be a null attribute. The caller owns the returned instance and must destroy it with mlirMemoryEffectInstanceDestroy.
Definition at line 314 of file Interfaces.cpp.
| MlirMemoryEffectInstance mlirMemoryEffectInstanceCreateForOpResult | ( | MlirMemoryEffect | effect, |
| MlirValue | result, | ||
| MlirAttribute | parameters, | ||
| int | stage, | ||
| bool | effectOnFullRegion, | ||
| MlirSideEffectResource | resource ) |
Creates a memory effect instance associated with an operation result.
result must wrap an OpResult. parameters may be a null attribute. The caller owns the returned instance and must destroy it with mlirMemoryEffectInstanceDestroy.
Definition at line 322 of file Interfaces.cpp.
| MlirMemoryEffectInstance mlirMemoryEffectInstanceCreateForSymbol | ( | MlirMemoryEffect | effect, |
| MlirAttribute | symbol, | ||
| MlirAttribute | parameters, | ||
| int | stage, | ||
| bool | effectOnFullRegion, | ||
| MlirSideEffectResource | resource ) |
Creates a memory effect instance associated with a symbol.
symbol must be a SymbolRefAttr. parameters may be a null attribute. The caller owns the returned instance and must destroy it with mlirMemoryEffectInstanceDestroy.
Definition at line 338 of file Interfaces.cpp.
| void mlirMemoryEffectInstanceDestroy | ( | MlirMemoryEffectInstance | instance | ) |
Destroys a memory effect instance created by one of the functions above.
Definition at line 346 of file Interfaces.cpp.
References unwrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMemoryEffectInstance::~PyMemoryEffectInstance().
| void mlirMemoryEffectInstancesListAppend | ( | MlirMemoryEffectInstancesList | list, |
| MlirMemoryEffectInstance | instance ) |
Appends a copy of instance to the given list.
This does not take ownership of instance; the caller remains responsible for destroying it.
Definition at line 350 of file Interfaces.cpp.
References unwrap().
| MlirMemoryEffect mlirMemoryEffectsAllocateGet | ( | void | ) |
Returns the borrowed singleton instance of the allocate memory effect.
Definition at line 283 of file Interfaces.cpp.
References mlir::SideEffects::Effect::Base< DerivedEffect, Effect >::get(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRInterfaces().
| MlirMemoryEffect mlirMemoryEffectsFreeGet | ( | void | ) |
Returns the borrowed singleton instance of the free memory effect.
Definition at line 288 of file Interfaces.cpp.
References mlir::SideEffects::Effect::Base< DerivedEffect, Effect >::get(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRInterfaces().
| void mlirMemoryEffectsOpInterfaceAttachFallbackModel | ( | MlirContext | ctx, |
| MlirStringRef | opName, | ||
| MlirMemoryEffectsOpInterfaceCallbacks | callbacks ) |
Attach a MemoryEffectsOpInterface FallbackModel to the given named op.
Attach a new FallbackModel for the MemoryEffectsOpInterface to the named operation.
The FallbackModel uses the provided callbacks to implement the interface.
Definition at line 402 of file Interfaces.cpp.
References mlir::RegisteredOperationName::lookup(), MemoryEffectOpInterfaceFallbackModel::setCallbacks(), and unwrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMemoryEffectsOpInterface::attach().
| MlirTypeID mlirMemoryEffectsOpInterfaceTypeID | ( | void | ) |
Returns the interface TypeID of the MemoryEffectsOpInterface.
Definition at line 355 of file Interfaces.cpp.
References wrap().
| MlirMemoryEffect mlirMemoryEffectsReadGet | ( | void | ) |
Returns the borrowed singleton instance of the read memory effect.
Definition at line 292 of file Interfaces.cpp.
References mlir::SideEffects::Effect::Base< DerivedEffect, Effect >::get(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRInterfaces().
| MlirMemoryEffect mlirMemoryEffectsWriteGet | ( | void | ) |
Returns the borrowed singleton instance of the write memory effect.
Definition at line 296 of file Interfaces.cpp.
References mlir::SideEffects::Effect::Base< DerivedEffect, Effect >::get(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRInterfaces().
| bool mlirOperationImplementsInterface | ( | MlirOperation | operation, |
| MlirTypeID | interfaceTypeID ) |
Returns true if the given operation implements an interface identified by its TypeID.
Definition at line 73 of file Interfaces.cpp.
References unwrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().
| bool mlirOperationImplementsInterfaceStatic | ( | MlirStringRef | operationName, |
| MlirContext | context, | ||
| MlirTypeID | interfaceTypeID ) |
Returns true if the operation identified by its canonical string name implements the interface identified by its TypeID in the given context.
Note that interfaces may be attached to operations in some contexts and not others.
Definition at line 80 of file Interfaces.cpp.
References MlirStringRef::data, MlirStringRef::length, mlir::RegisteredOperationName::lookup(), and unwrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().
| MlirSideEffectResource mlirSideEffectsDefaultResourceGet | ( | void | ) |
Returns the borrowed singleton instance of the default side effect resource.
Definition at line 301 of file Interfaces.cpp.
References mlir::SideEffects::Resource::Base< DefaultResource >::get(), and wrap().
Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRInterfaces().