CIRCT 21.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 | |
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={}) |
#define GEN_PASS_DEF_MEMORYBANKING |
Definition at line 31 of file MemoryBanking.cpp.
LogicalResult cleanUpOldMemRefs | ( | DenseSet< Value > & | oldMemRefVals, |
DenseSet< Operation * > & | opsToErase | ||
) |
Definition at line 695 of file MemoryBanking.cpp.
References assert().
DenseSet< Value > collectMemRefs | ( | affine::AffineParallelOp | affineParallelOp | ) |
Definition at line 98 of file MemoryBanking.cpp.
MemRefType computeBankedMemRefType | ( | MemRefType | originalType, |
uint64_t | bankingFactor, | ||
unsigned | bankingDimension | ||
) |
Definition at line 126 of file MemoryBanking.cpp.
SmallVector< int64_t > decodeIndex | ( | int64_t | linIndex, |
ArrayRef< int64_t > | shape | ||
) |
Definition at line 142 of file MemoryBanking.cpp.
Referenced by sliceSubBlock().
unsigned getCurrBankingInfo | ( | BankingConfigAttributes | bankingConfigAttrs, |
StringRef | attrName | ||
) |
Definition at line 331 of file MemoryBanking.cpp.
References assert().
Referenced by BankAffineLoadPattern::matchAndRewrite(), and BankAffineStorePattern::matchAndRewrite().
BankingConfigAttributes getMemRefBankingConfig | ( | Value | originalMem | ) |
Definition at line 75 of file MemoryBanking.cpp.
References assert().
Referenced by BankAffineLoadPattern::matchAndRewrite(), and BankAffineStorePattern::matchAndRewrite().
Attribute getRemainingBankingInfo | ( | MLIRContext * | context, |
BankingConfigAttributes | bankingConfigAttrs, | ||
StringRef | attrName | ||
) |
Definition at line 355 of file MemoryBanking.cpp.
References assert().
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().
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().
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().
void updateFuncOpArgAttrs | ( | func::FuncOp | funcOp, |
unsigned | argIndex, | ||
unsigned | numInsertedArgs, | ||
DictionaryAttr | remainingAttrs | ||
) |
Definition at line 303 of file MemoryBanking.cpp.
void updateFuncOpArgumentTypes | ( | func::FuncOp | funcOp, |
unsigned | argIndex, | ||
MemRefType | newMemRefType, | ||
unsigned | numInsertedArgs | ||
) |
Definition at line 275 of file MemoryBanking.cpp.
void verifyBankingAttributesSize | ( | Attribute | bankingFactorsAttr, |
Attribute | bankingDimensionsAttr | ||
) |
Definition at line 754 of file MemoryBanking.cpp.
References assert().
void verifyBankingConfigurations | ( | unsigned | bankingFactor, |
unsigned | bankingDimension, | ||
MemRefType | originalType | ||
) |
Definition at line 115 of file MemoryBanking.cpp.
References assert().
Referenced by BankAffineLoadPattern::matchAndRewrite(), and BankAffineStorePattern::matchAndRewrite().