MLIR  19.0.0git
Typedefs | Functions
Interfaces.h File Reference
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"

Go to the source code of this file.

Typedefs

typedef void(* MlirTypesCallback) (intptr_t, MlirType *, void *)
 These callbacks are used to return multiple types from functions while transferring ownership to the caller. More...
 
typedef void(* MlirShapedTypeComponentsCallback) (bool, intptr_t, const int64_t *, MlirType, MlirAttribute, void *)
 These callbacks are used to return multiple shaped type components from functions while transferring ownership to the caller. More...
 

Functions

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

Typedef Documentation

◆ MlirShapedTypeComponentsCallback

typedef void(* MlirShapedTypeComponentsCallback) (bool, intptr_t, const int64_t *, MlirType, MlirAttribute, void *)

These callbacks are used to return multiple shaped type components from functions while transferring ownership to the caller.

The first argument is the has rank boolean followed by the the rank and a pointer to the shape (if applicable). The next argument is the element type, then the attribute. The last argument is an opaque pointer forwarded to the callback by the caller. This callback will be called potentially multiple times for each shaped type components.

Definition at line 77 of file Interfaces.h.

◆ MlirTypesCallback

typedef void(* MlirTypesCallback) (intptr_t, MlirType *, void *)

These callbacks are used to return multiple types from functions while transferring ownership to the caller.

The first argument is the number of consecutive elements pointed to by the second argument. The third argument is an opaque pointer forwarded to the callback by the caller.

Definition at line 51 of file Interfaces.h.

Function Documentation

◆ mlirInferShapedTypeOpInterfaceInferReturnTypes()

MLIR_CAPI_EXPORTED 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 mlir::failed(), mlirLogicalResultFailure(), mlirLogicalResultSuccess(), unwrap(), and wrap().

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

◆ mlirInferShapedTypeOpInterfaceTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirInferShapedTypeOpInterfaceTypeID ( )

Returns the interface TypeID of the InferShapedTypeOpInterface.

Definition at line 123 of file Interfaces.cpp.

References wrap().

◆ mlirInferTypeOpInterfaceInferReturnTypes()

MLIR_CAPI_EXPORTED 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, mlir::failed(), MlirStringRef::length, mlirLogicalResultFailure(), mlirLogicalResultSuccess(), unwrap(), and wrap().

Referenced by mlir::python::PyInferTypeOpInterface::inferReturnTypes().

◆ mlirInferTypeOpInterfaceTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirInferTypeOpInterfaceTypeID ( )

Returns the interface TypeID of the InferTypeOpInterface.

Definition at line 88 of file Interfaces.cpp.

References wrap().

◆ mlirOperationImplementsInterface()

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

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