diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base.cpp b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base.cpp index 8a10268..69bde5b 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base.cpp @@ -1095,9 +1095,16 @@ static bool tryToResolveUnmatchedDims(const map> &dim tmpL = loop->parent; while (tmpL) { - 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 deprecateToMatch.insert(tmpL->loopSymbol); tmpL = tmpL->parent; @@ -1802,14 +1809,6 @@ static bool addRedistributionDirs(File* file, const vector& reducedG, DIST::Arrays& allArrays, @@ -1826,13 +1825,12 @@ void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg, for (int i = 0; i < loopGraph.size(); ++i) { LoopGraph* loop = loopGraph[i]; - const uint64_t loopRegId = (uint64_t)loop; const bool hasDirective = loop->directive; const bool noLimits = loop->hasLimitsToParallel() == false; const bool isMyRegion = loop->region == currParReg; const bool noUserDir = loop->userDvmDirective == 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; if (hasDirective && loop->directive->arrayRef2->IsLoopArray()) @@ -1871,18 +1869,18 @@ void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg, bool topCheck = isOnlyTopPerfect(loop, distribution); bool needToContinue = false; - if (topCheck && mpiProgram == 0) + if (topCheck) { // -> dims not mached map> 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)) - needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, getTrueRegId(regionId, loopRegId), messages, arrayLinksByFuncCalls, sameAlignTemplate); + if (!tryToResolveUnmatchedDims(dimsNotMatch, loop, regionId, parDirective, reducedG, allArrays, arrayLinksByFuncCalls, distribution, mapFuncInfo)) + needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, regionId, messages, arrayLinksByFuncCalls, sameAlignTemplate); } } - else if (mpiProgram == 0) - needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, getTrueRegId(regionId, loopRegId), messages, arrayLinksByFuncCalls, sameAlignTemplate); + else + needToContinue = addRedistributionDirs(file, distribution, toInsert, loop, mapLoopsInFile, parDirective, regionId, messages, arrayLinksByFuncCalls, sameAlignTemplate); if (needToContinue) continue; @@ -1890,7 +1888,7 @@ void selectParallelDirectiveForVariant(File* file, ParallelRegion* currParReg, vector> newRules; 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 //move label before loop diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base_nodist.cpp b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base_nodist.cpp index e0a20ee..0387428 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base_nodist.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_base_nodist.cpp @@ -102,20 +102,18 @@ void createParallelDirectivesNoDist(const map& allArrays, - const vector& loopGraph, - const map& mapLoopsInFile, - const map& mapFuncInfo, - vector& toInsert, - const uint64_t regionId, - const map>& arrayLinksByFuncCalls, - const map& depInfoForLoopGraph, - vector& messages) + DIST::Arrays& allArrays, + const vector& loopGraph, + const map& mapLoopsInFile, + const map& mapFuncInfo, + vector& toInsert, + const map>& arrayLinksByFuncCalls, + const map& depInfoForLoopGraph, + vector& messages) { for (int i = 0; i < loopGraph.size(); ++i) { LoopGraph* loop = loopGraph[i]; - const uint64_t loopRegId = (uint64_t)loop; const bool hasDirective = loop->directive; const bool noLimits = loop->hasLimitsToParallel() == false; const bool isMyRegion = loop->region == currParReg; @@ -133,7 +131,7 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar parDirective = loop->recalculateParallelDirective(); // 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 //move label before loop @@ -167,7 +165,7 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar { if (loopGraph[i]->children.size() != 0) selectParallelDirectiveForVariantNoDist(file, currParReg, allArrays, loopGraph[i]->children, mapLoopsInFile, mapFuncInfo, - toInsert, regionId, arrayLinksByFuncCalls,depInfoForLoopGraph, messages); + toInsert, arrayLinksByFuncCalls,depInfoForLoopGraph, messages); } } } diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_internal.h b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_internal.h index 0e26729..0061885 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_internal.h +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_internal.h @@ -16,11 +16,8 @@ void addShadowFromAnalysis(ParallelDirective* dir, const std::map& currAccesses); -bool checkForConflict(const std::map& currAccesses, - const LoopGraph* currentLoop, - std::map>, DIST::ArrayComparator>& arrayWriteAcc, - const std::vector, std::vector>>>& acrossInfo, - std::set& acrossOutArrays); - -uint64_t getTrueRegId(const uint64_t regId, const uint64_t loopRegId); - +bool checkForConflict(const std::map& currAccesses, + const LoopGraph* currentLoop, + std::map>, DIST::ArrayComparator>& arrayWriteAcc, + const std::vector, std::vector>>>& acrossInfo, + std::set& acrossOutArrays); diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_nodist.h b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_nodist.h index 8a340a4..22e04ec 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_nodist.h +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/directive_creator_nodist.h @@ -21,7 +21,6 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar const std::map& mapLoopsInFile, const std::map& mapFuncInfo, std::vector& toInsert, - const uint64_t regionId, const std::map>& arrayLinksByFuncCalls, const std::map& depInfoForLoopGraph, std::vector& messages); \ No newline at end of file diff --git a/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective.h b/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective.h index 32b5618..24a4e88 100644 --- a/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective.h +++ b/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective.h @@ -144,9 +144,8 @@ public: const std::map> &arrayLinksByFuncCalls); Directive* - genDirectiveNoDist(File* file, LoopGraph* currLoop, - DIST::Arrays& allArrays, const uint64_t regionId, - const std::map>& arrayLinksByFuncCalls); + genDirectiveNoDist(File* file, LoopGraph* currLoop, DIST::Arrays& allArrays, + const std::map>& arrayLinksByFuncCalls); friend ParallelDirective* operator+(const ParallelDirective &first, const ParallelDirective &second); diff --git a/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp b/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp index e31b61b..3860916 100644 --- a/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp @@ -91,9 +91,8 @@ compliteTieListNoDist(const LoopGraph* currLoop, const vector& loops } Directive* -ParallelDirective::genDirectiveNoDist(File* file, LoopGraph* currLoop, - DIST::Arrays& allArrays, const uint64_t regionId, - const map>& arrayLinksByFuncCalls) +ParallelDirective::genDirectiveNoDist(File* file, LoopGraph* currLoop, DIST::Arrays& allArrays, + const map>& arrayLinksByFuncCalls) { const set& acrossOutAttribute = currLoop->acrossOutAttribute; const map, vector>>& readOps = currLoop->readOps; diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp index a989408..2dd6f25 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp @@ -729,8 +729,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne depInfoForLoopGraphV[elem.first] = elem.second; selectParallelDirectiveForVariantNoDist(new File(file), parallelRegions[z], allArrays, loopsInFile, mapLoopsInFile, mapFuncInfo, - toInsert, parallelRegions[z]->GetId(), arrayLinksByFuncCalls, - depInfoForLoopGraphV, getObjectForFileFromMap(file_name, SPF_messages)); + toInsert, arrayLinksByFuncCalls, depInfoForLoopGraphV, getObjectForFileFromMap(file_name, SPF_messages)); if (toInsert.size() > 0) { diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 0bc7431..6b1b8c9 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2273" +#define VERSION_SPF "2274"