[Analysis] update getLayoutMap() method in utils
This commit is contained in:
parent
145e39b66e
commit
53c9e141e0
|
@ -80,7 +80,7 @@ Optional<std::pair<Operation *, Operation *>> checkSameLevel(Operation *lhsOp,
|
|||
// level with dstOp's any parent loop.
|
||||
Operation *getSameLevelDstOp(Operation *srcOp, Operation *dstOp);
|
||||
|
||||
AffineMap getLayoutMap(MemRefType memrefType, MLIRContext *context);
|
||||
AffineMap getLayoutMap(MemRefType memrefType);
|
||||
|
||||
// Collect partition factors and overall partition number through analyzing the
|
||||
// layout map of a MemRefType.
|
||||
|
|
|
@ -138,8 +138,8 @@ void HLSCppEstimator::getPartitionIndex(Operation *op) {
|
|||
accessMap.getNumSymbols());
|
||||
|
||||
// Compose the access map with the layout map.
|
||||
auto layoutMap = getLayoutMap(memrefType, memrefType.getContext());
|
||||
if (layoutMap.isEmpty()) {
|
||||
auto layoutMap = getLayoutMap(memrefType);
|
||||
if (!layoutMap) {
|
||||
setAttrValue(op, "partition_index", (int64_t)0);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -108,11 +108,11 @@ Operation *scalehls::getSameLevelDstOp(Operation *srcOp, Operation *dstOp) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
AffineMap scalehls::getLayoutMap(MemRefType memrefType, MLIRContext *context) {
|
||||
AffineMap scalehls::getLayoutMap(MemRefType memrefType) {
|
||||
// Check whether the memref has layout map.
|
||||
auto memrefMaps = memrefType.getAffineMaps();
|
||||
if (memrefMaps.empty())
|
||||
return AffineMap::get(context);
|
||||
return (AffineMap) nullptr;
|
||||
|
||||
return memrefMaps.back();
|
||||
}
|
||||
|
@ -122,13 +122,13 @@ AffineMap scalehls::getLayoutMap(MemRefType memrefType, MLIRContext *context) {
|
|||
int64_t scalehls::getPartitionFactors(MemRefType memrefType,
|
||||
SmallVector<int64_t, 4> *factors) {
|
||||
auto shape = memrefType.getShape();
|
||||
auto layoutMap = getLayoutMap(memrefType, memrefType.getContext());
|
||||
auto layoutMap = getLayoutMap(memrefType);
|
||||
int64_t accumFactor = 1;
|
||||
|
||||
for (int64_t dim = 0; dim < memrefType.getRank(); ++dim) {
|
||||
int64_t factor = 1;
|
||||
|
||||
if (!layoutMap.isEmpty()) {
|
||||
if (layoutMap) {
|
||||
auto expr = layoutMap.getResult(dim);
|
||||
|
||||
if (auto binaryExpr = expr.dyn_cast<AffineBinaryOpExpr>())
|
||||
|
|
|
@ -1371,7 +1371,7 @@ void ModuleEmitter::emitArrayPragmas(Value memref) {
|
|||
os << "\n";
|
||||
}
|
||||
|
||||
if (auto layoutMap = getLayoutMap(type, type.getContext())) {
|
||||
if (auto layoutMap = getLayoutMap(type)) {
|
||||
// Emit array_partition pragma(s).
|
||||
SmallVector<int64_t, 4> factors;
|
||||
getPartitionFactors(type, &factors);
|
||||
|
|
Loading…
Reference in New Issue