diff --git a/include/Analysis/Utils.h b/include/Analysis/Utils.h index 1101dba..438c1ff 100644 --- a/include/Analysis/Utils.h +++ b/include/Analysis/Utils.h @@ -83,9 +83,9 @@ Optional> checkSameLevel(Operation *lhsOp, // level with dstOp's any parent loop. Operation *getSameLevelDstOp(Operation *srcOp, Operation *dstOp); -AffineMap getLayoutMap(MemRefType memrefType); +AffineMap getLayoutMap(MemRefType memrefType, MLIRContext *context); -// Collect partition factors and overall partition number through analysis the +// Collect partition factors and overall partition number through analyzing the // layout map of a MemRefType. int64_t getPartitionFactors(MemRefType memrefType, SmallVector *factors = nullptr); diff --git a/lib/Analysis/QoREstimation.cpp b/lib/Analysis/QoREstimation.cpp index ac920c4..6718faa 100644 --- a/lib/Analysis/QoREstimation.cpp +++ b/lib/Analysis/QoREstimation.cpp @@ -227,7 +227,7 @@ int64_t HLSCppEstimator::getPartitionIndex(Operation *op) { accessMap.getNumSymbols()); // Compose the access map with the layout map. - auto layoutMap = getLayoutMap(memrefType); + auto layoutMap = getLayoutMap(memrefType, memrefType.getContext()); if (layoutMap.isEmpty()) return 0; auto composeMap = layoutMap.compose(newMap); diff --git a/lib/Analysis/Utils.cpp b/lib/Analysis/Utils.cpp index de99e58..2568773 100644 --- a/lib/Analysis/Utils.cpp +++ b/lib/Analysis/Utils.cpp @@ -160,21 +160,21 @@ Operation *scalehls::getSameLevelDstOp(Operation *srcOp, Operation *dstOp) { return nullptr; } -AffineMap scalehls::getLayoutMap(MemRefType memrefType) { +AffineMap scalehls::getLayoutMap(MemRefType memrefType, MLIRContext *context) { // Check whether the memref has layout map. auto memrefMaps = memrefType.getAffineMaps(); if (memrefMaps.empty()) - return AffineMap(); + return AffineMap::get(context); return memrefMaps.back(); } -// Collect partition factors and overall partition number through analysis the +// Collect partition factors and overall partition number through analyzing the // layout map of a MemRefType. int64_t scalehls::getPartitionFactors(MemRefType memrefType, SmallVector *factors) { auto shape = memrefType.getShape(); - auto layoutMap = getLayoutMap(memrefType); + auto layoutMap = getLayoutMap(memrefType, memrefType.getContext()); int64_t accumFactor = 1; for (unsigned dim = 0; dim < memrefType.getRank(); ++dim) { diff --git a/lib/EmitHLSCpp/EmitHLSCpp.cpp b/lib/EmitHLSCpp/EmitHLSCpp.cpp index 97973ad..7afc4ab 100644 --- a/lib/EmitHLSCpp/EmitHLSCpp.cpp +++ b/lib/EmitHLSCpp/EmitHLSCpp.cpp @@ -1392,7 +1392,7 @@ void ModuleEmitter::emitArrayPragmas(Value memref) { os << "\n"; } - if (auto layoutMap = getLayoutMap(type)) { + if (auto layoutMap = getLayoutMap(type, type.getContext())) { // Emit array_partition pragma(s). SmallVector factors; getPartitionFactors(type, &factors);