CIRCT 20.0.0git
|
#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"
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 | |
DenseSet< Value > | collectMemRefs (mlir::affine::AffineParallelOp parOp) |
void | verifyBankingConfigurations (unsigned bankingDimension, unsigned bankingFactor, 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) |
unsigned | getSpecifiedOrDefaultBankingDim (std::optional< int > bankingDimensionOpt, int64_t rank, ArrayRef< int64_t > shape) |
void | resolveBankingAttributes (Value originalMem, unsigned &bankingFactor, unsigned &bankingDimension) |
void | updateFuncOpArgumentTypes (func::FuncOp funcOp, unsigned argIndex, MemRefType newMemRefType, unsigned numInsertedArgs) |
void | updateFuncOpArgAttrs (func::FuncOp funcOp, unsigned argIndex, unsigned numInsertedArgs) |
SmallVector< Value, 4 > | createBanks (Value originalMem, unsigned bankingFactor, std::optional< int > bankingDimensionOpt) |
LogicalResult | cleanUpOldMemRefs (DenseSet< Value > &oldMemRefVals, DenseSet< Operation * > &opsToErase) |
std::unique_ptr< mlir::Pass > | circt::createMemoryBankingPass (std::optional< unsigned > bankingFactor=std::nullopt, std::optional< int > bankingDimension=std::nullopt) |
#define GEN_PASS_DEF_MEMORYBANKING |
Definition at line 31 of file MemoryBanking.cpp.
LogicalResult cleanUpOldMemRefs | ( | DenseSet< Value > & | oldMemRefVals, |
DenseSet< Operation * > & | opsToErase | ||
) |
Definition at line 626 of file MemoryBanking.cpp.
References assert().
DenseSet< Value > collectMemRefs | ( | mlir::affine::AffineParallelOp | parOp | ) |
Definition at line 62 of file MemoryBanking.cpp.
MemRefType computeBankedMemRefType | ( | MemRefType | originalType, |
uint64_t | bankingFactor, | ||
unsigned | bankingDimension | ||
) |
Definition at line 86 of file MemoryBanking.cpp.
Referenced by createBanks().
SmallVector< Value, 4 > createBanks | ( | Value | originalMem, |
unsigned | bankingFactor, | ||
std::optional< int > | bankingDimensionOpt | ||
) |
Definition at line 331 of file MemoryBanking.cpp.
References assert(), computeBankedMemRefType(), getSpecifiedOrDefaultBankingDim(), handleGetGlobalOp(), resolveBankingAttributes(), updateFuncOpArgAttrs(), updateFuncOpArgumentTypes(), and verifyBankingConfigurations().
SmallVector< int64_t > decodeIndex | ( | int64_t | linIndex, |
ArrayRef< int64_t > | shape | ||
) |
Definition at line 102 of file MemoryBanking.cpp.
Referenced by sliceSubBlock().
unsigned getSpecifiedOrDefaultBankingDim | ( | std::optional< int > | bankingDimensionOpt, |
int64_t | rank, | ||
ArrayRef< int64_t > | shape | ||
) |
Definition at line 209 of file MemoryBanking.cpp.
References assert().
Referenced by createBanks(), BankAffineLoadPattern::matchAndRewrite(), and BankAffineStorePattern::matchAndRewrite().
SmallVector< Value, 4 > handleGetGlobalOp | ( | memref::GetGlobalOp | getGlobalOp, |
uint64_t | bankingFactor, | ||
unsigned | bankingDimension, | ||
MemRefType | newMemRefType, | ||
OpBuilder & | builder | ||
) |
Definition at line 142 of file MemoryBanking.cpp.
References assert(), and sliceSubBlock().
Referenced by createBanks().
void resolveBankingAttributes | ( | Value | originalMem, |
unsigned & | bankingFactor, | ||
unsigned & | bankingDimension | ||
) |
Definition at line 238 of file MemoryBanking.cpp.
References assert().
Referenced by createBanks(), BankAffineLoadPattern::matchAndRewrite(), and BankAffineStorePattern::matchAndRewrite().
SmallVector< SmallVector< Attribute > > sliceSubBlock | ( | ArrayRef< Attribute > | allAttrs, |
ArrayRef< int64_t > | memShape, | ||
unsigned | bankingDimension, | ||
unsigned | bankingFactor | ||
) |
Definition at line 119 of file MemoryBanking.cpp.
References decodeIndex(), and numElements.
Referenced by handleGetGlobalOp().
void updateFuncOpArgAttrs | ( | func::FuncOp | funcOp, |
unsigned | argIndex, | ||
unsigned | numInsertedArgs | ||
) |
Definition at line 303 of file MemoryBanking.cpp.
Referenced by createBanks().
void updateFuncOpArgumentTypes | ( | func::FuncOp | funcOp, |
unsigned | argIndex, | ||
MemRefType | newMemRefType, | ||
unsigned | numInsertedArgs | ||
) |
Definition at line 275 of file MemoryBanking.cpp.
Referenced by createBanks().
void verifyBankingConfigurations | ( | unsigned | bankingDimension, |
unsigned | bankingFactor, | ||
MemRefType | originalType | ||
) |
Definition at line 75 of file MemoryBanking.cpp.
References assert().
Referenced by createBanks(), BankAffineLoadPattern::matchAndRewrite(), and BankAffineStorePattern::matchAndRewrite().