fixed dowhile
This commit is contained in:
@@ -1095,9 +1095,16 @@ static bool tryToResolveUnmatchedDims(const map<DIST::Array*, vector<bool>> &dim
|
|||||||
tmpL = loop->parent;
|
tmpL = loop->parent;
|
||||||
while (tmpL)
|
while (tmpL)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!tmpL->isFor) // TODO: need to add all inductive variables!
|
if (!tmpL->isFor) // TODO: need to add all inductive variables!
|
||||||
;// return false;
|
{
|
||||||
|
SgWhileStmt* dow = isSgWhileStmt(tmpL->loop->GetOriginal());
|
||||||
|
if (dow->conditional())
|
||||||
|
{
|
||||||
|
SgExpression* cond = dow->conditional();
|
||||||
|
if (cond->lhs() && cond->lhs()->variant() == VAR_REF)
|
||||||
|
deprecateToMatch.insert(cond->lhs()->symbol()->identifier());
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
deprecateToMatch.insert(tmpL->loopSymbol);
|
deprecateToMatch.insert(tmpL->loopSymbol);
|
||||||
tmpL = tmpL->parent;
|
tmpL = tmpL->parent;
|
||||||
@@ -1802,14 +1809,6 @@ static bool addRedistributionDirs(File* file, const vector<pair<DIST::Array*, co
|
|||||||
return needToSkip;
|
return needToSkip;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getTrueRegId(const uint64_t regId, const uint64_t loopRegId)
|
|
||||||
{
|
|
||||||
if (mpiProgram)
|
|
||||||
return loopRegId;
|
|
||||||
else
|
|
||||||
return regId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg,
|
void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg,
|
||||||
DIST::GraphCSR<int, double, attrType>& reducedG,
|
DIST::GraphCSR<int, double, attrType>& reducedG,
|
||||||
DIST::Arrays<int>& allArrays,
|
DIST::Arrays<int>& allArrays,
|
||||||
@@ -1826,13 +1825,12 @@ void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg,
|
|||||||
for (int i = 0; i < loopGraph.size(); ++i)
|
for (int i = 0; i < loopGraph.size(); ++i)
|
||||||
{
|
{
|
||||||
LoopGraph* loop = loopGraph[i];
|
LoopGraph* loop = loopGraph[i];
|
||||||
const uint64_t loopRegId = (uint64_t)loop;
|
|
||||||
const bool hasDirective = loop->directive;
|
const bool hasDirective = loop->directive;
|
||||||
const bool noLimits = loop->hasLimitsToParallel() == false;
|
const bool noLimits = loop->hasLimitsToParallel() == false;
|
||||||
const bool isMyRegion = loop->region == currParReg;
|
const bool isMyRegion = loop->region == currParReg;
|
||||||
const bool noUserDir = loop->userDvmDirective == NULL;
|
const bool noUserDir = loop->userDvmDirective == NULL;
|
||||||
DIST::Array* sameAlignTemplate = NULL;
|
DIST::Array* sameAlignTemplate = NULL;
|
||||||
const bool sameAligns = loop->isArrayTemplatesTheSame(sameAlignTemplate, getTrueRegId(regionId, loopRegId), arrayLinksByFuncCalls);
|
const bool sameAligns = loop->isArrayTemplatesTheSame(sameAlignTemplate, regionId, arrayLinksByFuncCalls);
|
||||||
|
|
||||||
bool freeLoopDistr = true;
|
bool freeLoopDistr = true;
|
||||||
if (hasDirective && loop->directive->arrayRef2->IsLoopArray())
|
if (hasDirective && loop->directive->arrayRef2->IsLoopArray())
|
||||||
@@ -1871,18 +1869,18 @@ void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg,
|
|||||||
bool topCheck = isOnlyTopPerfect(loop, distribution);
|
bool topCheck = isOnlyTopPerfect(loop, distribution);
|
||||||
|
|
||||||
bool needToContinue = false;
|
bool needToContinue = false;
|
||||||
if (topCheck && mpiProgram == 0)
|
if (topCheck)
|
||||||
{
|
{
|
||||||
//<Array, linksWithTempl> -> dims not mached
|
//<Array, linksWithTempl> -> dims not mached
|
||||||
map<DIST::Array*, vector<bool>> dimsNotMatch;
|
map<DIST::Array*, vector<bool>> dimsNotMatch;
|
||||||
if (!checkCorrectness(*parDirective, distribution, reducedG, allArrays, arrayLinksByFuncCalls, loop->getAllArraysInLoop(), messages, loop->lineNum, dimsNotMatch, getTrueRegId(regionId, loopRegId)))
|
if (!checkCorrectness(*parDirective, distribution, reducedG, allArrays, arrayLinksByFuncCalls, loop->getAllArraysInLoop(), messages, loop->lineNum, dimsNotMatch, regionId))
|
||||||
{
|
{
|
||||||
if (!tryToResolveUnmatchedDims(dimsNotMatch, loop, getTrueRegId(regionId, loopRegId), parDirective, reducedG, allArrays, arrayLinksByFuncCalls, distribution, mapFuncInfo))
|
if (!tryToResolveUnmatchedDims(dimsNotMatch, loop, regionId, parDirective, reducedG, allArrays, arrayLinksByFuncCalls, distribution, mapFuncInfo))
|
||||||
needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, getTrueRegId(regionId, loopRegId), messages, arrayLinksByFuncCalls, sameAlignTemplate);
|
needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, regionId, messages, arrayLinksByFuncCalls, sameAlignTemplate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mpiProgram == 0)
|
else
|
||||||
needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, getTrueRegId(regionId, loopRegId), messages, arrayLinksByFuncCalls, sameAlignTemplate);
|
needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, regionId, messages, arrayLinksByFuncCalls, sameAlignTemplate);
|
||||||
|
|
||||||
if (needToContinue)
|
if (needToContinue)
|
||||||
continue;
|
continue;
|
||||||
@@ -1890,7 +1888,7 @@ void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg,
|
|||||||
vector<pair<DIST::Array*, const DistrVariant*>> newRules;
|
vector<pair<DIST::Array*, const DistrVariant*>> newRules;
|
||||||
constructRules(newRules, distribution, loop);
|
constructRules(newRules, distribution, loop);
|
||||||
|
|
||||||
Directive* dirImpl = parDirective->genDirective(file, newRules, loop, reducedG, allArrays, getTrueRegId(regionId, loopRegId), arrayLinksByFuncCalls);
|
Directive* dirImpl = parDirective->genDirective(file, newRules, loop, reducedG, allArrays, regionId, arrayLinksByFuncCalls);
|
||||||
|
|
||||||
#if __SPF
|
#if __SPF
|
||||||
//move label before loop
|
//move label before loop
|
||||||
|
|||||||
@@ -102,20 +102,18 @@ void createParallelDirectivesNoDist(const map<LoopGraph*, map<DIST::Array*, Arra
|
|||||||
|
|
||||||
|
|
||||||
void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currParReg,
|
void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currParReg,
|
||||||
DIST::Arrays<int>& allArrays,
|
DIST::Arrays<int>& allArrays,
|
||||||
const vector<LoopGraph*>& loopGraph,
|
const vector<LoopGraph*>& loopGraph,
|
||||||
const map<int, LoopGraph*>& mapLoopsInFile,
|
const map<int, LoopGraph*>& mapLoopsInFile,
|
||||||
const map<string, FuncInfo*>& mapFuncInfo,
|
const map<string, FuncInfo*>& mapFuncInfo,
|
||||||
vector<Directive*>& toInsert,
|
vector<Directive*>& toInsert,
|
||||||
const uint64_t regionId,
|
const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls,
|
||||||
const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls,
|
const map<LoopGraph*, void*>& depInfoForLoopGraph,
|
||||||
const map<LoopGraph*, void*>& depInfoForLoopGraph,
|
vector<Messages>& messages)
|
||||||
vector<Messages>& messages)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < loopGraph.size(); ++i)
|
for (int i = 0; i < loopGraph.size(); ++i)
|
||||||
{
|
{
|
||||||
LoopGraph* loop = loopGraph[i];
|
LoopGraph* loop = loopGraph[i];
|
||||||
const uint64_t loopRegId = (uint64_t)loop;
|
|
||||||
const bool hasDirective = loop->directive;
|
const bool hasDirective = loop->directive;
|
||||||
const bool noLimits = loop->hasLimitsToParallel() == false;
|
const bool noLimits = loop->hasLimitsToParallel() == false;
|
||||||
const bool isMyRegion = loop->region == currParReg;
|
const bool isMyRegion = loop->region == currParReg;
|
||||||
@@ -133,7 +131,7 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar
|
|||||||
parDirective = loop->recalculateParallelDirective();
|
parDirective = loop->recalculateParallelDirective();
|
||||||
// rewrite bool topCheck = isOnlyTopPerfect(loop, distribution);
|
// rewrite bool topCheck = isOnlyTopPerfect(loop, distribution);
|
||||||
|
|
||||||
Directive* dirImpl = parDirective->genDirectiveNoDist(file, loop, allArrays, getTrueRegId(regionId, loopRegId), arrayLinksByFuncCalls);
|
Directive* dirImpl = parDirective->genDirectiveNoDist(file, loop, allArrays, arrayLinksByFuncCalls);
|
||||||
|
|
||||||
#if __SPF
|
#if __SPF
|
||||||
//move label before loop
|
//move label before loop
|
||||||
@@ -167,7 +165,7 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar
|
|||||||
{
|
{
|
||||||
if (loopGraph[i]->children.size() != 0)
|
if (loopGraph[i]->children.size() != 0)
|
||||||
selectParallelDirectiveForVariantNoDist(file, currParReg, allArrays, loopGraph[i]->children, mapLoopsInFile, mapFuncInfo,
|
selectParallelDirectiveForVariantNoDist(file, currParReg, allArrays, loopGraph[i]->children, mapLoopsInFile, mapFuncInfo,
|
||||||
toInsert, regionId, arrayLinksByFuncCalls,depInfoForLoopGraph, messages);
|
toInsert, arrayLinksByFuncCalls,depInfoForLoopGraph, messages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,8 @@
|
|||||||
|
|
||||||
void addShadowFromAnalysis(ParallelDirective* dir, const std::map<DIST::Array*, ArrayInfo*>& currAccesses);
|
void addShadowFromAnalysis(ParallelDirective* dir, const std::map<DIST::Array*, ArrayInfo*>& currAccesses);
|
||||||
|
|
||||||
bool checkForConflict(const std::map<DIST::Array*, ArrayInfo*>& currAccesses,
|
bool checkForConflict(const std::map<DIST::Array*, ArrayInfo*>& currAccesses,
|
||||||
const LoopGraph* currentLoop,
|
const LoopGraph* currentLoop,
|
||||||
std::map<DIST::Array*, std::pair<int, std::pair<int, int>>, DIST::ArrayComparator>& arrayWriteAcc,
|
std::map<DIST::Array*, std::pair<int, std::pair<int, int>>, DIST::ArrayComparator>& arrayWriteAcc,
|
||||||
const std::vector<std::pair<std::pair<std::string, std::string>, std::vector<std::pair<int, int>>>>& acrossInfo,
|
const std::vector<std::pair<std::pair<std::string, std::string>, std::vector<std::pair<int, int>>>>& acrossInfo,
|
||||||
std::set<DIST::Array*>& acrossOutArrays);
|
std::set<DIST::Array*>& acrossOutArrays);
|
||||||
|
|
||||||
uint64_t getTrueRegId(const uint64_t regId, const uint64_t loopRegId);
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar
|
|||||||
const std::map<int, LoopGraph*>& mapLoopsInFile,
|
const std::map<int, LoopGraph*>& mapLoopsInFile,
|
||||||
const std::map<std::string, FuncInfo*>& mapFuncInfo,
|
const std::map<std::string, FuncInfo*>& mapFuncInfo,
|
||||||
std::vector<Directive*>& toInsert,
|
std::vector<Directive*>& toInsert,
|
||||||
const uint64_t regionId,
|
|
||||||
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls,
|
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls,
|
||||||
const std::map<LoopGraph*, void*>& depInfoForLoopGraph,
|
const std::map<LoopGraph*, void*>& depInfoForLoopGraph,
|
||||||
std::vector<Messages>& messages);
|
std::vector<Messages>& messages);
|
||||||
@@ -144,9 +144,8 @@ public:
|
|||||||
const std::map<DIST::Array*, std::set<DIST::Array*>> &arrayLinksByFuncCalls);
|
const std::map<DIST::Array*, std::set<DIST::Array*>> &arrayLinksByFuncCalls);
|
||||||
|
|
||||||
Directive*
|
Directive*
|
||||||
genDirectiveNoDist(File* file, LoopGraph* currLoop,
|
genDirectiveNoDist(File* file, LoopGraph* currLoop, DIST::Arrays<int>& allArrays,
|
||||||
DIST::Arrays<int>& allArrays, const uint64_t regionId,
|
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls);
|
||||||
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls);
|
|
||||||
|
|
||||||
friend ParallelDirective* operator+(const ParallelDirective &first, const ParallelDirective &second);
|
friend ParallelDirective* operator+(const ParallelDirective &first, const ParallelDirective &second);
|
||||||
|
|
||||||
|
|||||||
@@ -91,9 +91,8 @@ compliteTieListNoDist(const LoopGraph* currLoop, const vector<LoopGraph*>& loops
|
|||||||
}
|
}
|
||||||
|
|
||||||
Directive*
|
Directive*
|
||||||
ParallelDirective::genDirectiveNoDist(File* file, LoopGraph* currLoop,
|
ParallelDirective::genDirectiveNoDist(File* file, LoopGraph* currLoop, DIST::Arrays<int>& allArrays,
|
||||||
DIST::Arrays<int>& allArrays, const uint64_t regionId,
|
const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls)
|
||||||
const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls)
|
|
||||||
{
|
{
|
||||||
const set<DIST::Array*>& acrossOutAttribute = currLoop->acrossOutAttribute;
|
const set<DIST::Array*>& acrossOutAttribute = currLoop->acrossOutAttribute;
|
||||||
const map<DIST::Array*, pair<vector<ArrayOp>, vector<bool>>>& readOps = currLoop->readOps;
|
const map<DIST::Array*, pair<vector<ArrayOp>, vector<bool>>>& readOps = currLoop->readOps;
|
||||||
|
|||||||
@@ -729,8 +729,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
depInfoForLoopGraphV[elem.first] = elem.second;
|
depInfoForLoopGraphV[elem.first] = elem.second;
|
||||||
|
|
||||||
selectParallelDirectiveForVariantNoDist(new File(file), parallelRegions[z], allArrays, loopsInFile, mapLoopsInFile, mapFuncInfo,
|
selectParallelDirectiveForVariantNoDist(new File(file), parallelRegions[z], allArrays, loopsInFile, mapLoopsInFile, mapFuncInfo,
|
||||||
toInsert, parallelRegions[z]->GetId(), arrayLinksByFuncCalls,
|
toInsert, arrayLinksByFuncCalls, depInfoForLoopGraphV, getObjectForFileFromMap(file_name, SPF_messages));
|
||||||
depInfoForLoopGraphV, getObjectForFileFromMap(file_name, SPF_messages));
|
|
||||||
|
|
||||||
if (toInsert.size() > 0)
|
if (toInsert.size() > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2273"
|
#define VERSION_SPF "2274"
|
||||||
|
|||||||
Reference in New Issue
Block a user