MLIR  17.0.0git
Namespaces | Macros | Functions
BufferOptimizations.cpp File Reference
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Operation.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 This header declares functions that assist transformations in the MemRef dialect.
 
 mlir::bufferization
 

Macros

#define GEN_PASS_DEF_BUFFERHOISTING
 
#define GEN_PASS_DEF_BUFFERLOOPHOISTING
 
#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK
 

Functions

static bool isKnownControlFlowInterface (Operation *op)
 Returns true if the given operation implements a known high-level region- based control-flow interface. More...
 
static bool defaultIsSmallAlloc (Value alloc, unsigned maximumSizeInBytes, unsigned maxRankOfAllocatedMemRef)
 Check if the size of the allocation is less than the given size. More...
 
static bool leavesAllocationScope (Region *parentRegion, const BufferViewFlowAnalysis::ValueSetT &aliases)
 Checks whether the given aliases leave the allocation scope. More...
 
static bool hasAllocationScope (Value alloc, const BufferViewFlowAnalysis &aliasAnalysis)
 Checks, if an automated allocation scope for a given alloc value exists. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_BUFFERHOISTING

#define GEN_PASS_DEF_BUFFERHOISTING

Definition at line 25 of file BufferOptimizations.cpp.

◆ GEN_PASS_DEF_BUFFERLOOPHOISTING

#define GEN_PASS_DEF_BUFFERLOOPHOISTING

Definition at line 26 of file BufferOptimizations.cpp.

◆ GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK

#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK

Definition at line 27 of file BufferOptimizations.cpp.

Function Documentation

◆ defaultIsSmallAlloc()

static bool defaultIsSmallAlloc ( Value  alloc,
unsigned  maximumSizeInBytes,
unsigned  maxRankOfAllocatedMemRef 
)
static

Check if the size of the allocation is less than the given size.

The transformation is only applied to small buffers since large buffers could exceed the stack space.

Definition at line 44 of file BufferOptimizations.cpp.

References mlir::DataLayout::closest(), mlir::Value::getDefiningOp(), mlir::Operation::getOperands(), mlir::Value::getType(), and mlir::DataLayout::getTypeSizeInBits().

◆ hasAllocationScope()

static bool hasAllocationScope ( Value  alloc,
const BufferViewFlowAnalysis aliasAnalysis 
)
static

◆ isKnownControlFlowInterface()

static bool isKnownControlFlowInterface ( Operation op)
static

Returns true if the given operation implements a known high-level region- based control-flow interface.

Definition at line 37 of file BufferOptimizations.cpp.

Referenced by hasAllocationScope().

◆ leavesAllocationScope()

static bool leavesAllocationScope ( Region parentRegion,
const BufferViewFlowAnalysis::ValueSetT aliases 
)
static

Checks whether the given aliases leave the allocation scope.

Definition at line 70 of file BufferOptimizations.cpp.

References mlir::isRegionReturnLike().

Referenced by hasAllocationScope().