MLIR  19.0.0git
Namespaces | Macros | Functions
BufferOptimizations.cpp File Reference
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"
#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
#include "mlir/Dialect/Bufferization/Transforms/Transforms.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
 Include the generated interface declarations.
 
 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 isLoop (Operation *op)
 Returns true if the given operation represents a loop by testing whether it implements the LoopLikeOpInterface or the RegionBranchOpInterface. More...
 
static bool isSequentialLoop (Operation *op)
 Return whether the given operation is a loop with sequential execution semantics. More...
 
static bool allowAllocDominateBlockHoisting (Operation *op)
 Returns true if the given operation implements the AllocationOpInterface and it supports the dominate block hoisting. More...
 
static bool allowAllocLoopHoisting (Operation *op)
 Returns true if the given operation implements the AllocationOpInterface and it supports the loop hoisting. 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 27 of file BufferOptimizations.cpp.

◆ GEN_PASS_DEF_BUFFERLOOPHOISTING

#define GEN_PASS_DEF_BUFFERLOOPHOISTING

Definition at line 28 of file BufferOptimizations.cpp.

◆ GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK

#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACK

Definition at line 29 of file BufferOptimizations.cpp.

Function Documentation

◆ allowAllocDominateBlockHoisting()

static bool allowAllocDominateBlockHoisting ( Operation op)
static

Returns true if the given operation implements the AllocationOpInterface and it supports the dominate block hoisting.

Definition at line 70 of file BufferOptimizations.cpp.

◆ allowAllocLoopHoisting()

static bool allowAllocLoopHoisting ( Operation op)
static

Returns true if the given operation implements the AllocationOpInterface and it supports the loop hoisting.

Definition at line 78 of file BufferOptimizations.cpp.

◆ 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 87 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 39 of file BufferOptimizations.cpp.

Referenced by hasAllocationScope().

◆ isLoop()

static bool isLoop ( Operation op)
static

Returns true if the given operation represents a loop by testing whether it implements the LoopLikeOpInterface or the RegionBranchOpInterface.

In the case of a RegionBranchOpInterface, it checks all region-based control- flow edges for cycles.

Definition at line 47 of file BufferOptimizations.cpp.

Referenced by hasAllocationScope().

◆ isSequentialLoop()

static bool isSequentialLoop ( Operation op)
static

Return whether the given operation is a loop with sequential execution semantics.

Definition at line 64 of file BufferOptimizations.cpp.

◆ leavesAllocationScope()

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

Checks whether the given aliases leave the allocation scope.

Definition at line 113 of file BufferOptimizations.cpp.

Referenced by hasAllocationScope().