MLIR 23.0.0git
Interfaces.h File Reference
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"

Go to the source code of this file.

Classes

struct  MlirMemoryEffectsOpInterfaceCallbacks
 Callbacks for implementing MemoryEffectsOpInterface from external code. More...

Macros

#define DEFINE_C_API_STRUCT(name, storage)

Typedefs

typedef void(* MlirTypesCallback) (intptr_t, MlirType *, void *)
 These callbacks are used to return multiple types from functions while transferring ownership to the caller.
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.

Functions

 DEFINE_C_API_STRUCT (MlirMemoryEffectInstancesList, void)
MLIR_CAPI_EXPORTED bool mlirOperationImplementsInterface (MlirOperation operation, MlirTypeID interfaceTypeID)
 Returns true if the given operation implements an interface identified by its TypeID.
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.
MLIR_CAPI_EXPORTED MlirTypeID mlirInferTypeOpInterfaceTypeID (void)
 Returns the interface TypeID of the InferTypeOpInterface.
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.
MLIR_CAPI_EXPORTED MlirTypeID mlirInferShapedTypeOpInterfaceTypeID (void)
 Returns the interface TypeID of the InferShapedTypeOpInterface.
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.
MLIR_CAPI_EXPORTED MlirTypeID mlirMemoryEffectsOpInterfaceTypeID (void)
 Returns the interface TypeID of the MemoryEffectsOpInterface.
MLIR_CAPI_EXPORTED void mlirMemoryEffectsOpInterfaceAttachFallbackModel (MlirContext ctx, MlirStringRef opName, MlirMemoryEffectsOpInterfaceCallbacks callbacks)
 Attach a new FallbackModel for the MemoryEffectsOpInterface to the named operation.

Macro Definition Documentation

◆ DEFINE_C_API_STRUCT

#define DEFINE_C_API_STRUCT ( name,
storage )
Value:
struct name { \
storage *ptr; \
}; \
typedef struct name name

Definition at line 25 of file Interfaces.h.

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 87 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 61 of file Interfaces.h.

Function Documentation

◆ DEFINE_C_API_STRUCT()

DEFINE_C_API_STRUCT ( MlirMemoryEffectInstancesList ,
void  )

References MLIR_CAPI_EXPORTED.

◆ 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 mlirLogicalResultFailure(), mlirLogicalResultSuccess(), unwrap(), and wrap().

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

◆ mlirInferShapedTypeOpInterfaceTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirInferShapedTypeOpInterfaceTypeID ( void )

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

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

◆ mlirInferTypeOpInterfaceTypeID()

MLIR_CAPI_EXPORTED MlirTypeID mlirInferTypeOpInterfaceTypeID ( void )

Returns the interface TypeID of the InferTypeOpInterface.

Definition at line 88 of file Interfaces.cpp.

References wrap().

◆ mlirMemoryEffectsOpInterfaceAttachFallbackModel()

MLIR_CAPI_EXPORTED void mlirMemoryEffectsOpInterfaceAttachFallbackModel ( MlirContext ctx,
MlirStringRef opName,
MlirMemoryEffectsOpInterfaceCallbacks callbacks )

Attach a new FallbackModel for the MemoryEffectsOpInterface to the named operation.

The FallbackModel will call the provided callbacks.

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

MLIR_CAPI_EXPORTED MlirTypeID mlirMemoryEffectsOpInterfaceTypeID ( void )

Returns the interface TypeID of the MemoryEffectsOpInterface.

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