MLIR  22.0.0git
Namespaces | Macros | Typedefs | Functions
BufferResultsToOutParams.cpp File Reference
#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Operation.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::bufferization
 

Macros

#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS
 

Typedefs

using AllocationFn = bufferization::BufferResultsToOutParamsOpts::AllocationFn
 
using MemCpyFn = bufferization::BufferResultsToOutParamsOpts::MemCpyFn
 
using AllocDynamicSizesMap = llvm::DenseMap< func::FuncOp, SmallVector< SmallVector< Value > >>
 

Functions

static bool hasFullyDynamicLayoutMap (MemRefType type)
 Return true if the given MemRef type has a fully dynamic layout. More...
 
static bool hasStaticIdentityLayout (MemRefType type)
 Return true if the given MemRef type has a static identity layout (i.e., no layout). More...
 
static SmallVector< ValuegetDynamicSize (Value memref, func::FuncOp funcOp)
 Return the dynamic shapes of the memref based on the defining op. More...
 
static SmallVector< ValuemapDynamicSizeAtCaller (func::CallOp call, func::FuncOp callee, ValueRange dynamicSizes)
 Returns the dynamic sizes at the callee, through the call relationship between the caller and callee. More...
 
static LogicalResult updateFuncOp (func::FuncOp func, SmallVectorImpl< BlockArgument > &appendedEntryArgs, bool addResultAttribute)
 
static LogicalResult updateReturnOps (func::FuncOp func, ArrayRef< BlockArgument > appendedEntryArgs, AllocDynamicSizesMap &map, const bufferization::BufferResultsToOutParamsOpts &options)
 
static LogicalResult updateCalls (ModuleOp module, const AllocDynamicSizesMap &map, const bufferization::BufferResultsToOutParamsOpts &options)
 

Macro Definition Documentation

◆ GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS

#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS

Definition at line 18 of file BufferResultsToOutParams.cpp.

Typedef Documentation

◆ AllocationFn

Definition at line 24 of file BufferResultsToOutParams.cpp.

◆ AllocDynamicSizesMap

Definition at line 26 of file BufferResultsToOutParams.cpp.

◆ MemCpyFn

Definition at line 25 of file BufferResultsToOutParams.cpp.

Function Documentation

◆ getDynamicSize()

static SmallVector<Value> getDynamicSize ( Value  memref,
func::FuncOp  funcOp 
)
static

Return the dynamic shapes of the memref based on the defining op.

If the complete dynamic shape fails to be captured, return an empty value. Currently, only function block arguments are supported for capturing.

Definition at line 51 of file BufferResultsToOutParams.cpp.

References mlir::Value::getDefiningOp(), and mlir::Operation::getOperands().

Referenced by updateReturnOps().

◆ hasFullyDynamicLayoutMap()

static bool hasFullyDynamicLayoutMap ( MemRefType  type)
static

Return true if the given MemRef type has a fully dynamic layout.

Definition at line 30 of file BufferResultsToOutParams.cpp.

References mlir::remark::failed().

Referenced by updateCalls(), and updateFuncOp().

◆ hasStaticIdentityLayout()

static bool hasStaticIdentityLayout ( MemRefType  type)
static

Return true if the given MemRef type has a static identity layout (i.e., no layout).

Definition at line 44 of file BufferResultsToOutParams.cpp.

Referenced by updateCalls(), and updateFuncOp().

◆ mapDynamicSizeAtCaller()

static SmallVector<Value> mapDynamicSizeAtCaller ( func::CallOp  call,
func::FuncOp  callee,
ValueRange  dynamicSizes 
)
static

Returns the dynamic sizes at the callee, through the call relationship between the caller and callee.

Definition at line 75 of file BufferResultsToOutParams.cpp.

Referenced by updateCalls().

◆ updateCalls()

static LogicalResult updateCalls ( ModuleOp  module,
const AllocDynamicSizesMap map,
const bufferization::BufferResultsToOutParamsOpts options 
)
static

◆ updateFuncOp()

static LogicalResult updateFuncOp ( func::FuncOp  func,
SmallVectorImpl< BlockArgument > &  appendedEntryArgs,
bool  addResultAttribute 
)
static

◆ updateReturnOps()

static LogicalResult updateReturnOps ( func::FuncOp  func,
ArrayRef< BlockArgument appendedEntryArgs,
AllocDynamicSizesMap map,
const bufferization::BufferResultsToOutParamsOpts options 
)
static