refactor (wip)
This commit is contained in:
@@ -598,7 +598,7 @@ static void findArrayRef(const vector<SgForStmt*> &parentLoops, SgExpression *cu
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (currRegime == DATA_DISTR && side == LEFT)
|
if ((currRegime == DATA_DISTR || currRegime == SHARED_MEMORY_PAR) && side == LEFT)
|
||||||
{
|
{
|
||||||
auto symb = OriginalSymbol(currExp->symbol());
|
auto symb = OriginalSymbol(currExp->symbol());
|
||||||
SgStatement *decl = declaratedInStmt(symb);
|
SgStatement *decl = declaratedInStmt(symb);
|
||||||
@@ -1609,8 +1609,9 @@ void loopAnalyzer(SgFile *file, vector<ParallelRegion*> ®ions, map<tuple<int,
|
|||||||
modulesByName[modules[i]->symbol()->identifier()] = modules[i];
|
modulesByName[modules[i]->symbol()->identifier()] = modules[i];
|
||||||
|
|
||||||
map<string, set<string>> privatesByModule;
|
map<string, set<string>> privatesByModule;
|
||||||
for (int i = 0; i < modules.size(); ++i)
|
if(!sharedMemoryParallelization)
|
||||||
privatesByModule[modules[i]->symbol()->identifier()] = getPrivatesFromModule(modules[i], declaredArrays, declaratedArraysSt, modulesByName);
|
for (int i = 0; i < modules.size(); ++i)
|
||||||
|
privatesByModule[modules[i]->symbol()->identifier()] = getPrivatesFromModule(modules[i], declaredArrays, declaratedArraysSt, modulesByName);
|
||||||
|
|
||||||
map<string, FuncInfo*> funcByName;
|
map<string, FuncInfo*> funcByName;
|
||||||
createMapOfFunc(AllfuncInfo, funcByName);
|
createMapOfFunc(AllfuncInfo, funcByName);
|
||||||
@@ -1674,13 +1675,17 @@ void loopAnalyzer(SgFile *file, vector<ParallelRegion*> ®ions, map<tuple<int,
|
|||||||
loopsForFunction.push_back(loop);
|
loopsForFunction.push_back(loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
SgStatement* tmpModFind = st;
|
if(!sharedMemoryParallelization)
|
||||||
while (tmpModFind->variant() != GLOBAL)
|
|
||||||
{
|
{
|
||||||
tmpModFind = tmpModFind->controlParent();
|
SgStatement* tmpModFind = st;
|
||||||
if (tmpModFind->variant() == MODULE_STMT)
|
while (tmpModFind->variant() != GLOBAL)
|
||||||
fillFromModule(tmpModFind->symbol(), privatesByModule, privatesVars);
|
{
|
||||||
|
tmpModFind = tmpModFind->controlParent();
|
||||||
|
if (tmpModFind->variant() == MODULE_STMT)
|
||||||
|
fillFromModule(tmpModFind->symbol(), privatesByModule, privatesVars);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commonBlocks.clear();
|
commonBlocks.clear();
|
||||||
getCommonBlocksRef(commonBlocks, st, st->lastNodeOfStmt());
|
getCommonBlocksRef(commonBlocks, st, st->lastNodeOfStmt());
|
||||||
__spf_print(PRINT_PROF_INFO, " number of common blocks %d\n", (int)commonBlocks.size());
|
__spf_print(PRINT_PROF_INFO, " number of common blocks %d\n", (int)commonBlocks.size());
|
||||||
@@ -1727,7 +1732,8 @@ void loopAnalyzer(SgFile *file, vector<ParallelRegion*> ®ions, map<tuple<int,
|
|||||||
|
|
||||||
if (isSgExecutableStatement(st) == NULL)
|
if (isSgExecutableStatement(st) == NULL)
|
||||||
delcsStatViewed.insert(st);
|
delcsStatViewed.insert(st);
|
||||||
else if (!isDVM_stat(st) && !isSPF_stat(st))
|
else if (!sharedMemoryParallelization &&
|
||||||
|
!isDVM_stat(st) && !isSPF_stat(st))
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
fillPrivatesFromDecl(st->expr(i), delcsSymbViewed, delcsStatViewed, declaredArrays, declaratedArraysSt, privatesVars);
|
fillPrivatesFromDecl(st->expr(i), delcsSymbViewed, delcsStatViewed, declaredArrays, declaratedArraysSt, privatesVars);
|
||||||
|
|
||||||
@@ -1735,9 +1741,12 @@ void loopAnalyzer(SgFile *file, vector<ParallelRegion*> ®ions, map<tuple<int,
|
|||||||
const int currV = st->variant();
|
const int currV = st->variant();
|
||||||
if (currV == FOR_NODE)
|
if (currV == FOR_NODE)
|
||||||
{
|
{
|
||||||
tryToFindPrivateInAttributes(st, privatesVars);
|
if(!sharedMemoryParallelization)
|
||||||
fillNonDistrArraysAsPrivate(st, declaredArrays, declaratedArraysSt, privatesVars);
|
{
|
||||||
|
tryToFindPrivateInAttributes(st, privatesVars);
|
||||||
|
fillNonDistrArraysAsPrivate(st, declaredArrays, declaratedArraysSt, privatesVars);
|
||||||
|
}
|
||||||
|
|
||||||
set<string> toAdd;
|
set<string> toAdd;
|
||||||
tryToFindPrivateInAttributes(st, toAdd);
|
tryToFindPrivateInAttributes(st, toAdd);
|
||||||
|
|
||||||
@@ -1783,9 +1792,10 @@ void loopAnalyzer(SgFile *file, vector<ParallelRegion*> ®ions, map<tuple<int,
|
|||||||
unitedPrivates.insert(privVar);
|
unitedPrivates.insert(privVar);
|
||||||
|
|
||||||
set<string> setDiff;
|
set<string> setDiff;
|
||||||
for (auto &privVars : privatesVars)
|
if(!sharedMemoryParallelization)
|
||||||
if (unitedPrivates.find(privVars) == unitedPrivates.end())
|
for (auto &privVars : privatesVars)
|
||||||
setDiff.insert(privVars);
|
if (unitedPrivates.find(privVars) == unitedPrivates.end())
|
||||||
|
setDiff.insert(privVars);
|
||||||
|
|
||||||
allLoops[contrlParent->lineNumber()] = make_pair((SgForStmt*)contrlParent, make_pair(unitedPrivates, setDiff));
|
allLoops[contrlParent->lineNumber()] = make_pair((SgForStmt*)contrlParent, make_pair(unitedPrivates, setDiff));
|
||||||
parentLoops.pop_back();
|
parentLoops.pop_back();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
typedef std::pair<std::pair<int, int>, std::pair<int, int>> attrType;
|
typedef std::pair<std::pair<int, int>, std::pair<int, int>> attrType;
|
||||||
namespace DIST = Distribution;
|
namespace DIST = Distribution;
|
||||||
|
|
||||||
enum REGIME { DATA_DISTR, COMP_DISTR, REMOTE_ACC, ARRAY_ACC_CORNER, UNDEF };
|
enum REGIME { DATA_DISTR, COMP_DISTR, REMOTE_ACC, ARRAY_ACC_CORNER, SHARED_MEMORY_PAR, UNDEF };
|
||||||
|
|
||||||
// loop_analyzer.cpp
|
// loop_analyzer.cpp
|
||||||
bool checkExistence(SgExpression *exp, const std::string& doName);
|
bool checkExistence(SgExpression *exp, const std::string& doName);
|
||||||
|
|||||||
Reference in New Issue
Block a user