diff --git a/dvm/fdvm/trunk/Sage/lib/include/unparseDVM.def b/dvm/fdvm/trunk/Sage/lib/include/unparseDVM.def index 2dc62a0..68d4409 100644 --- a/dvm/fdvm/trunk/Sage/lib/include/unparseDVM.def +++ b/dvm/fdvm/trunk/Sage/lib/include/unparseDVM.def @@ -436,7 +436,7 @@ DEFNODECODE(SPF_MERGE_OP, "MERGE", 'e',0,LLNODE) DEFNODECODE(SPF_COVER_OP, "COVER (%LL1)", 'e',1,LLNODE) -DEFNODECODE(SPF_PROCESS_PRIVATE_OP, "PROCESS_PRIVATE_OP (%LL1)", +DEFNODECODE(SPF_PROCESS_PRIVATE_OP, "PROCESS_PRIVATE (%LL1)", 'e',1,LLNODE) 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 27eb9d6..a663b5b 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 @@ -134,14 +134,7 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar #if __SPF //move label before loop - if (loop->hasRedistribute()) - { - auto prev = loop->loop->lexPrev(); - if (!prev) - printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - moveLabelBefore(prev, loop->loop); - } - else if(loop->lineNum > 0) + if(loop->lineNum > 0) moveLabelBefore(loop->loop, NULL); // check correctness @@ -157,7 +150,7 @@ void selectParallelDirectiveForVariantNoDist(File* file, ParallelRegion* currPar checkNull(local, convertFileName(__FILE__).c_str(), __LINE__); } #endif - toInsert.push_back(dirImpl); + toInsert.push_back(dirImpl); } } else //TODO: add checker for indexing in this loop diff --git a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/spf_directive_preproc.cpp b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/spf_directive_preproc.cpp index fd507d5..ee9bb12 100644 --- a/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/spf_directive_preproc.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DirectiveProcessing/spf_directive_preproc.cpp @@ -106,7 +106,7 @@ static bool isPrivateVar(SgStatement *st, SgSymbol *symbol) return retVal; } -#define BAD_POSITION_FULL(NEED_PRINT, ERR_TYPE, PLACE_E, PLACE_R, BEFORE_VAR_E, BEFORE_VAR_R, BEFORE_DO_E, BEFORE_DO_R, LINE) do { \ +#define BAD_POSITION_FULL(ERR_TYPE, PLACE_E, PLACE_R, BEFORE_VAR_E, BEFORE_VAR_R, BEFORE_DO_E, BEFORE_DO_R, LINE) do { \ __spf_print(1, "bad directive position on line %d, it can be placed only %s %s %s\n", LINE, PLACE_E, BEFORE_VAR_E, BEFORE_DO_E); \ wstring messageE, messageR;\ __spf_printToLongBuf(messageE, L"bad directive position, it can be placed only %s %s %s", to_wstring(PLACE_E).c_str(), to_wstring(BEFORE_VAR_E).c_str(), to_wstring(BEFORE_DO_E).c_str()); \ @@ -212,14 +212,14 @@ static bool checkProcessPrivate(SgStatement* st, if (!defCond) { - BAD_POSITION_FULL(1, ERROR, "before", RR1_1, "variable declaration", RR1_2, "", L"", attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "before", RR1_1, "variable declaration", RR1_2, "", L" ", attributeStatement->lineNumber()); retVal = false; } } } else { - BAD_POSITION_FULL(1, ERROR, "before", RR1_1, "variable declaration", RR1_2, "", L"", attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "before", RR1_1, "variable declaration", RR1_2, "", L" ", attributeStatement->lineNumber()); retVal = false; } @@ -308,7 +308,7 @@ static bool checkPrivate(SgStatement *st, } else { - BAD_POSITION_FULL(1, ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } @@ -372,7 +372,7 @@ static bool checkReduction(SgStatement *st, } else { - BAD_POSITION_FULL(1, ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } @@ -769,7 +769,7 @@ static bool checkShadowAcross(SgStatement *st, } else { - BAD_POSITION_FULL(1, ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } @@ -993,7 +993,7 @@ static bool checkRemote(SgStatement *st, } else { - BAD_POSITION_FULL(1, ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "before", RR1_1, "", L"", "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } @@ -1225,7 +1225,7 @@ static bool checkParallelRegions(SgStatement *st, } else { - BAD_POSITION_FULL(1, ERROR, "after", RR1_4, "", L"", "all declaration statements", RR1_5, st->lineNumber()); + BAD_POSITION_FULL(ERROR, "after", RR1_4, "", L"", "all declaration statements", RR1_5, st->lineNumber()); retVal = false; } @@ -1814,7 +1814,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, attributeStatement->setLocalLineNumber(-1); if (count > 1 || st->variant() != FOR_NODE) { - BAD_POSITION_FULL(1, ERROR, "once", RR1_7, "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "once", RR1_7, "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } else @@ -1858,7 +1858,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, const int prevVar = prev->variant(); if (prevVar != PROC_HEDR && prevVar != FUNC_HEDR) { - BAD_POSITION_FULL(1, ERROR, "after", RR1_4, "", L"", "function statements", RR1_6, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "after", RR1_4, "", L"", "function statements", RR1_6, attributeStatement->lineNumber()); retVal = false; } } @@ -1869,7 +1869,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, attributeStatement->setLocalLineNumber(-1); if (count > 1 || st->variant() != FOR_NODE) { - BAD_POSITION_FULL(1, ERROR, "once", RR1_7, "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "once", RR1_7, "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } else @@ -1885,7 +1885,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, attributeStatement->setLocalLineNumber(-1); if (count > 1 || st->variant() != FOR_NODE) { - BAD_POSITION_FULL(1, ERROR, "once", RR1_7, "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "once", RR1_7, "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } else @@ -1901,7 +1901,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, attributeStatement->setLocalLineNumber(-1); if (st->variant() != FOR_NODE) { - BAD_POSITION_FULL(1, ERROR, "", "", "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "", "", "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } else @@ -1917,7 +1917,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, attributeStatement->setLocalLineNumber(-1); if (st->variant() != FOR_NODE) { - BAD_POSITION_FULL(1, ERROR, "", "", "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "", "", "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } } @@ -1928,7 +1928,7 @@ static inline bool processStat(SgStatement *st, const string &currFile, attributeStatement->setLocalLineNumber(-1); if (st->variant() != FOR_NODE) { - BAD_POSITION_FULL(1, ERROR, "", "", "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); + BAD_POSITION_FULL(ERROR, "", "", "before", RR1_1, "DO statement", RR1_3, attributeStatement->lineNumber()); retVal = false; } } diff --git a/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp b/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp index 3860916..c25ad4d 100644 --- a/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Distribution/DvmhDirective_nodist.cpp @@ -29,11 +29,12 @@ using std::map; using std::make_pair; static vector -compliteTieListNoDist(const LoopGraph* currLoop, const vector& loops, +compliteTieListNoDist(const LoopGraph* currLoop, + const set& privates, + const vector& loops, const map>& arrayLinksByFuncCalls, const map>& byUseInFunc, - File* file, const pair& lineRange, - const set& onlyFor) + File* file, const pair& lineRange) { vector tieList; @@ -44,6 +45,9 @@ compliteTieListNoDist(const LoopGraph* currLoop, const vector& loops for (auto& elem : currLoop->usedArraysAll) { + if (privates.find(elem->GetShortName()) != privates.end()) + continue; + auto type = elem->GetDeclSymbol(currLoop->fileName, lineRange, getAllFilesInProject())->GetOriginal()->type(); SgSymbol* arrayS = getFromModule(byUseInFunc, findSymbolOrCreate(file, elem->GetShortName(), type)); SgArrayRefExp* array = new SgArrayRefExp(*arrayS); @@ -233,11 +237,8 @@ ParallelDirective::genDirectiveNoDist(File* file, LoopGraph* currLoop, DIST::Arr if (parallel[i] != "*") loopsTie.push_back(loops[i]); - set onlyFor; - vector tieList; - - tieList = compliteTieListNoDist(currLoop, loopsTie, arrayLinksByFuncCalls, byUseInFunc, file, lineRange, onlyFor); + tieList = compliteTieListNoDist(currLoop, uniqNamesOfPrivates, loopsTie, arrayLinksByFuncCalls, byUseInFunc, file, lineRange); if (tieList.size()) { diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp index f47ef56..2d19b4f 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp @@ -3543,10 +3543,11 @@ void getMaxMinBlockDistribution(SgFile* file, pair& min_max) } } +//TODO: need to add to includes void addPrivatesToArraysFromGUI(SgFile* file, const map, pair>& declaredArrays, const map& distrStateFromGUI) { - map> added; + map> added; for (auto& arrayPair : declaredArrays) { @@ -3570,12 +3571,19 @@ void addPrivatesToArraysFromGUI(SgFile* file, const mapidentifier()) + "))\n"; - added[declSt].insert(toAdd); + added[declSt].insert(symb); } } for (auto& toInsert : added) + { + vector list; for (auto& elem : toInsert.second) - toInsert.first->addComment(elem.c_str()); + list.push_back(new SgVarRefExp(elem)); + + SgStatement* op = new SgStatement(SPF_ANALYSIS_DIR); + op->setExpression(0, new SgExpression(SPF_PROCESS_PRIVATE_OP, makeExprList(list))); + + toInsert.first->insertStmtBefore(*op, *toInsert.first->controlParent()); + } } \ No newline at end of file diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index c9de073..10df47c 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 "2311" +#define VERSION_SPF "2314"