MLIR 22.0.0git
BufferOptimizations.cpp File Reference

Go to the source code of this file.

Classes

class  mlir::bufferization::impl::BufferHoistingPassBase< DerivedT >
class  mlir::bufferization::impl::BufferLoopHoistingPassBase< DerivedT >
class  mlir::bufferization::impl::PromoteBuffersToStackPassBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::bufferization
namespace  mlir::bufferization::impl

Macros

#define GEN_PASS_DEF_BUFFERHOISTINGPASS
#define GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS
#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS

Functions

std::unique_ptr<::mlir::Passmlir::bufferization::impl::createBufferHoistingPass ()
std::unique_ptr<::mlir::Passmlir::bufferization::createBufferHoistingPass ()
std::unique_ptr<::mlir::Passmlir::bufferization::impl::createBufferLoopHoistingPass ()
std::unique_ptr<::mlir::Passmlir::bufferization::createBufferLoopHoistingPass ()
std::unique_ptr<::mlir::Passmlir::bufferization::impl::createPromoteBuffersToStackPass ()
std::unique_ptr<::mlir::Passmlir::bufferization::impl::createPromoteBuffersToStackPass (PromoteBuffersToStackPassOptions options)
std::unique_ptr<::mlir::Passmlir::bufferization::createPromoteBuffersToStackPass ()
std::unique_ptr<::mlir::Passmlir::bufferization::createPromoteBuffersToStackPass (PromoteBuffersToStackPassOptions options)
static bool isKnownControlFlowInterface (Operation *op)
 Returns true if the given operation implements a known high-level region- based control-flow interface.
static bool isLoop (Operation *op)
 Returns true if the given operation represents a loop by testing whether it implements the LoopLikeOpInterface or the RegionBranchOpInterface.
static bool isSequentialLoop (Operation *op)
 Return whether the given operation is a loop with sequential execution semantics.
static bool allowAllocDominateBlockHoisting (Operation *op)
 Returns true if the given operation implements the AllocationOpInterface and it supports the dominate block hoisting.
static bool allowAllocLoopHoisting (Operation *op)
 Returns true if the given operation implements the AllocationOpInterface and it supports the loop hoisting.
static bool defaultIsSmallAlloc (Value alloc, unsigned maximumSizeInBytes, unsigned maxRankOfAllocatedMemRef)
 Check if the size of the allocation is less than the given size.
static bool leavesAllocationScope (Region *parentRegion, const BufferViewFlowAnalysis::ValueSetT &aliases)
 Checks whether the given aliases leave the allocation scope.
static bool hasAllocationScope (Value alloc, const BufferViewFlowAnalysis &aliasAnalysis)
 Checks, if an automated allocation scope for a given alloc value exists.

Macro Definition Documentation

◆ GEN_PASS_DEF_BUFFERHOISTINGPASS

#define GEN_PASS_DEF_BUFFERHOISTINGPASS

Definition at line 27 of file BufferOptimizations.cpp.

◆ GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS

#define GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS

Definition at line 28 of file BufferOptimizations.cpp.

◆ GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS

#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS

Definition at line 29 of file BufferOptimizations.cpp.

Function Documentation

◆ allowAllocDominateBlockHoisting()

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.

References mlir::Block.

◆ allowAllocLoopHoisting()

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.

References mlir::Loop.

◆ defaultIsSmallAlloc()

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

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

Checks, if an automated allocation scope for a given alloc value exists.

Definition at line 129 of file BufferOptimizations.cpp.

◆ isKnownControlFlowInterface()

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 mlir::bufferization::createBufferLoopHoistingPass().

◆ isLoop()

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

◆ isSequentialLoop()

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.

References mlir::Operation::hasTrait(), and isLoop().

◆ leavesAllocationScope()

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 mlir::bufferization::impl::BufferHoistingPassBase< DerivedT >::getName().