fixed replace_dist_array pass: added more file switching

This commit is contained in:
ALEXks
2025-07-27 08:52:28 +03:00
committed by Egor Mayorov
parent c61e18a044
commit da51f8484c
2 changed files with 5 additions and 16 deletions

View File

@@ -74,10 +74,7 @@ static void populateDistributedIoArrays(map<SgSymbol*, set<SgStatement*>>& array
{
SgExpression* fmt = stat->expr(1);
if (!fmt || fmt->variant() != SPEC_PAIR || fmt->lhs()->variant() != KEYWORD_VAL)
{
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
return;
}
if (fmt->rhs()->variant() != KEYWORD_VAL || fmt->rhs()->sunparse() != "*")
need_replace = true;
@@ -104,10 +101,7 @@ static void populateDistributedIoArrays(map<SgSymbol*, set<SgStatement*>>& array
{
auto *kv = spec->lhs();
if (!kv || kv->variant() != SPEC_PAIR || !kv->rhs())
{
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
return;
}
if (kv->rhs()->variant() != KEYWORD_VAL || kv->rhs()->sunparse() != "*")
{
@@ -368,11 +362,8 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
{
const auto& filename = linesByFile.first;
if (SgFile::switchToFile(filename) < 0)
{
if (SgFile::switchToFile(filename) == -1)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
return;
}
for (auto& lines : linesByFile.second)
{
@@ -481,9 +472,7 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
insertPlace->insertStmtAfter(*stat, *st);
}
else
{
copied = copyArray(place, array_p, linesByFile.second, suffix + to_string(region->GetId()), fileName, newDeclsToInclude, copied_syms);
}
SgStatement* decl = SgStatement::getStatementByFileAndLine(place.first, place.second);
@@ -504,6 +493,9 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
decl->addComment(dir_str.c_str());
}
created_copies.insert({ array_to_copy, copied.second });
if (curr_stmt->switchToFile() == -1)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
}
}
@@ -517,10 +509,7 @@ void replaceDistributedArraysInIO(vector<ParallelRegion*>& regions,
if (it != created_copies.end())
replaceArrayInFragment(p.first, p.second, it->second, last_io_bound, curr_stmt, filename);
else
{
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
return;
}
}
}

View File

@@ -1,3 +1,3 @@
#pragma once
#define VERSION_SPF "2439"
#define VERSION_SPF "2440"