CIRCT 24.0.0git
Loading...
Searching...
No Matches
MemoryBanking.cpp File Reference
#include "circt/Support/LLVM.h"
#include "circt/Transforms/Passes.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/FormatVariadic.h"
#include <numeric>
#include "circt/Transforms/Passes.h.inc"
Include dependency graph for MemoryBanking.cpp:

Go to the source code of this file.

Classes

struct  BankAffineLoadPattern
struct  BankAffineStorePattern
struct  BankReturnPattern

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.

Macros

#define GEN_PASS_DEF_MEMORYBANKING

Functions

BankingConfigAttributes getMemRefBankingConfig (Value originalMem)
DenseSet< Value > collectMemRefs (affine::AffineParallelOp affineParallelOp)
void verifyBankingConfigurations (unsigned bankingFactor, unsigned bankingDimension, MemRefType originalType)
MemRefType computeBankedMemRefType (MemRefType originalType, uint64_t bankingFactor, unsigned bankingDimension)
SmallVector< int64_t > decodeIndex (int64_t linIndex, ArrayRef< int64_t > shape)
SmallVector< SmallVector< Attribute > > sliceSubBlock (ArrayRef< Attribute > allAttrs, ArrayRef< int64_t > memShape, unsigned bankingDimension, unsigned bankingFactor)
SmallVector< Value, 4 > handleGetGlobalOp (memref::GetGlobalOp getGlobalOp, uint64_t bankingFactor, unsigned bankingDimension, MemRefType newMemRefType, OpBuilder &builder, DictionaryAttr remainingAttrs)
SmallVector< unsigned, 4 > getSpecifiedOrDefaultBankingDim (const ArrayRef< unsigned > bankingDimensions, int64_t rank, ArrayRef< int64_t > shape)
void updateFuncOpArgumentTypes (func::FuncOp funcOp, unsigned argIndex, MemRefType newMemRefType, unsigned numInsertedArgs)
void updateFuncOpArgAttrs (func::FuncOp funcOp, unsigned argIndex, unsigned numInsertedArgs, DictionaryAttr remainingAttrs)
unsigned getCurrBankingInfo (BankingConfigAttributes bankingConfigAttrs, StringRef attrName)
Attribute getRemainingBankingInfo (MLIRContext *context, BankingConfigAttributes bankingConfigAttrs, StringRef attrName)
LogicalResult cleanUpOldMemRefs (DenseSet< Value > &oldMemRefVals, DenseSet< Operation * > &opsToErase)
void verifyBankingAttributesSize (Attribute bankingFactorsAttr, Attribute bankingDimensionsAttr)
std::unique_ptr< mlir::Pass > circt::createMemoryBankingPass (ArrayRef< unsigned > bankingFactors={}, ArrayRef< unsigned > bankingDimensions={})

Macro Definition Documentation

◆ GEN_PASS_DEF_MEMORYBANKING

#define GEN_PASS_DEF_MEMORYBANKING

Definition at line 31 of file MemoryBanking.cpp.

Function Documentation

◆ cleanUpOldMemRefs()

LogicalResult cleanUpOldMemRefs ( DenseSet< Value > & oldMemRefVals,
DenseSet< Operation * > & opsToErase )

Definition at line 695 of file MemoryBanking.cpp.

References assert(), and success().

◆ collectMemRefs()

DenseSet< Value > collectMemRefs ( affine::AffineParallelOp affineParallelOp)

Definition at line 98 of file MemoryBanking.cpp.

◆ computeBankedMemRefType()

MemRefType computeBankedMemRefType ( MemRefType originalType,
uint64_t bankingFactor,
unsigned bankingDimension )

Definition at line 126 of file MemoryBanking.cpp.

◆ decodeIndex()

SmallVector< int64_t > decodeIndex ( int64_t linIndex,
ArrayRef< int64_t > shape )

Definition at line 142 of file MemoryBanking.cpp.

Referenced by sliceSubBlock().

◆ getCurrBankingInfo()

unsigned getCurrBankingInfo ( BankingConfigAttributes bankingConfigAttrs,
StringRef attrName )

◆ getMemRefBankingConfig()

BankingConfigAttributes getMemRefBankingConfig ( Value originalMem)

◆ getRemainingBankingInfo()

Attribute getRemainingBankingInfo ( MLIRContext * context,
BankingConfigAttributes bankingConfigAttrs,
StringRef attrName )

Definition at line 355 of file MemoryBanking.cpp.

References assert(), and context.

◆ getSpecifiedOrDefaultBankingDim()

SmallVector< unsigned, 4 > getSpecifiedOrDefaultBankingDim ( const ArrayRef< unsigned > bankingDimensions,
int64_t rank,
ArrayRef< int64_t > shape )

Definition at line 250 of file MemoryBanking.cpp.

References assert().

◆ handleGetGlobalOp()

SmallVector< Value, 4 > handleGetGlobalOp ( memref::GetGlobalOp getGlobalOp,
uint64_t bankingFactor,
unsigned bankingDimension,
MemRefType newMemRefType,
OpBuilder & builder,
DictionaryAttr remainingAttrs )

Definition at line 183 of file MemoryBanking.cpp.

References assert(), and sliceSubBlock().

◆ sliceSubBlock()

SmallVector< SmallVector< Attribute > > sliceSubBlock ( ArrayRef< Attribute > allAttrs,
ArrayRef< int64_t > memShape,
unsigned bankingDimension,
unsigned bankingFactor )

Definition at line 159 of file MemoryBanking.cpp.

References decodeIndex(), and numElements.

Referenced by handleGetGlobalOp().

◆ updateFuncOpArgAttrs()

void updateFuncOpArgAttrs ( func::FuncOp funcOp,
unsigned argIndex,
unsigned numInsertedArgs,
DictionaryAttr remainingAttrs )

Definition at line 303 of file MemoryBanking.cpp.

◆ updateFuncOpArgumentTypes()

void updateFuncOpArgumentTypes ( func::FuncOp funcOp,
unsigned argIndex,
MemRefType newMemRefType,
unsigned numInsertedArgs )

Definition at line 275 of file MemoryBanking.cpp.

◆ verifyBankingAttributesSize()

void verifyBankingAttributesSize ( Attribute bankingFactorsAttr,
Attribute bankingDimensionsAttr )

Definition at line 754 of file MemoryBanking.cpp.

References assert().

◆ verifyBankingConfigurations()

void verifyBankingConfigurations ( unsigned bankingFactor,
unsigned bankingDimension,
MemRefType originalType )