diff --git a/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp b/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp index 0eb0896..9393b87 100644 --- a/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp +++ b/sapfor/experts/Sapfor_2017/_src/GraphLoop/graph_loops.cpp @@ -872,6 +872,13 @@ static void printToBuffer(const LoopGraph *currLoop, const int childSize, char b else loopState = 1; } + else if (PASSES_DONE[SELECT_ARRAY_DIM_CONF]) + { + if (currLoop->hasLimitsToParallel()) + loopState = 2; + else + loopState = 1; + } else { if (currLoop->hasLimitsToParallel()) diff --git a/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp b/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp index 3bcfc20..6e97d06 100644 --- a/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Transformations/private_removing.cpp @@ -599,40 +599,6 @@ static bool isVarChangedBetween(string var, SgStatement* first, SgStatement* sec return false; } -// TODO: remove if needless -// removeDeadCodeFromLoop removes assign statements to private scalar vars which are not read in loop -//static void removeDeadCodeFromLoop(LoopGraph* loop) -//{ -// SgForStmt* loopStmt = (SgForStmt*) loop->loop->GetOriginal(); -// set privateVars; -// for (auto data : getAttributes(loopStmt, set{ SPF_ANALYSIS_DIR })) -// fillPrivatesFromComment(new Statement(data), privateVars); -// -// set privates; -// for (Symbol* symbol : privateVars) -// privates.insert(OriginalSymbol((SgSymbol*)symbol)->identifier()); -// -// vector stmtsToDelete; -// for (SgStatement* st = loopStmt->lexNext(); st != loopStmt->lastNodeOfStmt(); st = st->lexNext()) -// { -// if (st->variant() != ASSIGN_STAT) -// continue; -// -// SgSymbol* var = st->expr(0)->symbol(); -// if (var == nullptr || var->variant() != VARIABLE_NAME) -// continue; -// -// if (privates.find(var->identifier()) != privates.end() && !isVarReadInLoop(var, loopStmt)) -// stmtsToDelete.push_back(st); -// } -// -// for (auto stmt : stmtsToDelete) -// stmt->deleteStmt(); -// -// for (auto childLoop : loop->children) -// removeDeadCodeFromLoop(childLoop); -//} - // fillReadShortFixedSumscripts fills all short fixed subscripts vectors of array var, // which are used for reading from array var in exp static void fillReadShortFixedSubscripts(SgExpression* exp, const PrivateToRemove& var, @@ -698,32 +664,6 @@ static void removeExcessiveDefs(const PrivateToRemove& var) st->deleteStmt(); } -// TODO: remove is needless -// removeEmptyLoops removes loops with empty body and create messages -//static void removeEmptyLoops(LoopGraph* loop, vector& messages) -//{ -// vector loopsToDelete; -// vector newChildrenVector; -// for (auto childLoop : loop->children) -// { -// SgStatement* loopStmt = childLoop->loop->GetOriginal(); -// if (loopStmt->lastNodeOfStmt() == loopStmt->lexNext()) -// loopsToDelete.push_back(childLoop); -// else -// newChildrenVector.push_back(childLoop); -// } -// -// for (auto loopToDelete : loopsToDelete) -// { -// addMessageRemoveLoop(messages, loopToDelete->lineNum); -// loopToDelete->loop->extractStmt(); -// } -// -// loop->children.swap(newChildrenVector); -// for (auto childLoop : loop->children) -// removeEmptyLoops(childLoop, messages); -//} - // removeVarFromPrivateAttributes removes var from SPF ANALYSIS PRIVATE attributes of loop static void removeVarFromPrivateAttributes(SgSymbol* var, LoopGraph* loop) { @@ -833,7 +773,7 @@ void removePrivates(string filename, vector& messages, const map>& allFuncInfo, int& countOfTransform) { - set removedDC; + set removeDC; for (auto& varToRemove : privatesToRemoveGlobal) { if (filename != varToRemove.loop->fileName) @@ -842,23 +782,10 @@ void removePrivates(string filename, vector& messages, auto removedDimensions = removeArray(filename, varToRemove); countOfTransform++; - //removeDeadCodeFromLoop(varToRemove.loop); removeExcessiveDefs(varToRemove); - //removeEmptyLoops(varToRemove.loop, messages); + removeDC.insert(varToRemove.loop); - SgForStmt* loopStmt = (SgForStmt*)varToRemove.loop->loop->GetOriginal(); - FuncInfo* currFunc = getCurrectFunc(loopStmt, allFuncInfo); - if (currFunc == nullptr) - printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - - if (removedDC.find(varToRemove.loop) == removedDC.end()) - { - removeDeadCode(currFunc->funcPointer, allFuncInfo, commonBlocks, - varToRemove.loop->loop, varToRemove.loop->loop->lastNodeOfStmt()); - removedDC.insert(varToRemove.loop); - } - - vector varRefs = getDirectArrayRefs(loopStmt, varToRemove.varSymbol); + vector varRefs = getDirectArrayRefs(varToRemove.loop->loop, varToRemove.varSymbol); int loopLineNum = varToRemove.loop->lineNum; string varName = varToRemove.varSymbol->identifier(); auto& fixedDimensions = varToRemove.fixedDimensions; @@ -892,6 +819,18 @@ void removePrivates(string filename, vector& messages, } } } + + for (auto& dcLoopRem : removeDC) + { + auto loopStmt = dcLoopRem->loop->GetOriginal(); + FuncInfo* currFunc = getCurrectFunc(loopStmt, allFuncInfo); + + if (currFunc == nullptr) + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + + removeDeadCode(currFunc->funcPointer, allFuncInfo, commonBlocks, + loopStmt, loopStmt->lastNodeOfStmt()); + } } /* ****************************************** * diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 071b745..6678a59 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 "2298" +#define VERSION_SPF "2301" diff --git a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp index 5acca3b..bc2d60f 100644 --- a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp +++ b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp @@ -1674,10 +1674,11 @@ int SPF_SetDistributionFlagToArrays(void*& context, const char* keys, const char } static int simpleTransformPass(const passes PASS_NAME, short *options, short *projName, short *folderName, - short *&output, int *&outputSize, short *&outputMessage, int *&outputMessageSize) + short *&output, int *&outputSize, short *&outputMessage, int *&outputMessageSize, + bool isBuildParallel = false) { clearGlobalMessagesBuffer(); - setOptions(options); + setOptions(options, isBuildParallel); int retCode = 0; try @@ -1892,7 +1893,7 @@ int SPF_SharedMemoryParallelization(void*& context, int winHandler, short* optio MessageManager::setWinHandler(winHandler); ignoreArrayDistributeState = true; mpiProgram = 1; - return simpleTransformPass(INSERT_PARALLEL_DIRS_NODIST, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize); + return simpleTransformPass(INSERT_PARALLEL_DIRS_NODIST, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize, true); } int SPF_InsertPrivateFromGUI(void*& context, int winHandler, short* options, short* projName, short* folderName, short*& output,