MLIR  20.0.0git
Functions
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.

Functions

bool mlirOperationImplementsInterface (MlirOperation operation, MlirTypeID interfaceTypeID)
 Returns true if the given operation implements an interface identified by its TypeID. More...
 
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. More...
 
MlirTypeID mlirInferTypeOpInterfaceTypeID ()
 Returns the interface TypeID of the InferTypeOpInterface. More...
 
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. More...
 
MlirTypeID mlirInferShapedTypeOpInterfaceTypeID ()
 Returns the interface TypeID of the InferShapedTypeOpInterface. More...
 
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. More...
 

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::PyInferShapedTypeOpInterface::inferReturnTypeComponents().

◆ mlirInferShapedTypeOpInterfaceTypeID()

MlirTypeID mlirInferShapedTypeOpInterfaceTypeID ( )

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::PyInferTypeOpInterface::inferReturnTypes().

◆ mlirInferTypeOpInterfaceTypeID()

MlirTypeID mlirInferTypeOpInterfaceTypeID ( )

Returns the interface TypeID of the InferTypeOpInterface.

Definition at line 88 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::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::PyConcreteOpInterface< ConcreteIface >::PyConcreteOpInterface().