MLIR 23.0.0git
Interfaces.cpp File Reference
#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  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 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.

Function Documentation

◆ mlirInferShapedTypeOpInterfaceInferReturnTypes()

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 127 of file Interfaces.cpp.

References mlirLogicalResultFailure(), mlirLogicalResultSuccess(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyInferShapedTypeOpInterface::inferReturnTypeComponents().

◆ mlirInferShapedTypeOpInterfaceTypeID()

MlirTypeID mlirInferShapedTypeOpInterfaceTypeID ( void )

Returns the interface TypeID of the InferShapedTypeOpInterface.

Definition at line 123 of file Interfaces.cpp.

References wrap().

◆ mlirInferTypeOpInterfaceInferReturnTypes()

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().

◆ mlirInferTypeOpInterfaceTypeID()

MlirTypeID mlirInferTypeOpInterfaceTypeID ( void )

Returns the interface TypeID of the InferTypeOpInterface.

Definition at line 88 of file Interfaces.cpp.

References wrap().

◆ mlirMemoryEffectsOpInterfaceAttachFallbackModel()

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 222 of file Interfaces.cpp.

References mlir::RegisteredOperationName::lookup(), MemoryEffectOpInterfaceFallbackModel::setCallbacks(), and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyMemoryEffectsOpInterface::attach().

◆ mlirMemoryEffectsOpInterfaceTypeID()

MlirTypeID mlirMemoryEffectsOpInterfaceTypeID ( void )

Returns the interface TypeID of the MemoryEffectsOpInterface.

Definition at line 175 of file Interfaces.cpp.

References wrap().

◆ mlirOperationImplementsInterface()

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().

◆ mlirOperationImplementsInterfaceStatic()

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().