[Analysis] fixed a bug in Utils
This commit is contained in:
parent
6fecfda97c
commit
1353100dad
|
@ -83,9 +83,9 @@ 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);
|
||||
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<int64_t, 4> *factors = nullptr);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<int64_t, 4> *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) {
|
||||
|
|
|
@ -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<int64_t, 4> factors;
|
||||
getPartitionFactors(type, &factors);
|
||||
|
|
Loading…
Reference in New Issue