fixed actuals for shared memory parallelization
This commit is contained in:
@@ -327,10 +327,13 @@ static void analyzeFunctionParameters(SgExpression* paramList, set<string>& exce
|
|||||||
while (paramList)
|
while (paramList)
|
||||||
{
|
{
|
||||||
SgExpression* ex = paramList->lhs();
|
SgExpression* ex = paramList->lhs();
|
||||||
if (ex->variant() != FUNC_CALL)
|
if (ex->variant() == FUNC_CALL)
|
||||||
analyzeFunctionParameter(ex, except, arrays);
|
{
|
||||||
else
|
if (!isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
analyzeFunctionParameter(ex, except, arrays);
|
||||||
|
|
||||||
paramList = paramList->rhs();
|
paramList = paramList->rhs();
|
||||||
}
|
}
|
||||||
@@ -341,7 +344,10 @@ static void createExceptList(SgExpression* ex, set<string>& except, ArraySet& ar
|
|||||||
if (ex)
|
if (ex)
|
||||||
{
|
{
|
||||||
if (ex->variant() == FUNC_CALL)
|
if (ex->variant() == FUNC_CALL)
|
||||||
|
{
|
||||||
|
if (!isIntrinsicFunctionName(ex->symbol()->identifier()))
|
||||||
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
analyzeFunctionParameters(ex->lhs(), except, arrays);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
createExceptList(ex->lhs(), except, arrays);
|
createExceptList(ex->lhs(), except, arrays);
|
||||||
@@ -419,7 +425,7 @@ ArraySet DvmhRegionInserter::excludeRemotes(const ArraySet& block, SgStatement*
|
|||||||
void DvmhRegionInserter::insertForProcCall(SgStatement* st, bool& skipGetActualIfProcCall, bool& skipActualIfProcCall)
|
void DvmhRegionInserter::insertForProcCall(SgStatement* st, bool& skipGetActualIfProcCall, bool& skipActualIfProcCall)
|
||||||
{
|
{
|
||||||
const char* procName = st->symbol()->identifier();
|
const char* procName = st->symbol()->identifier();
|
||||||
if (isIntrinsicFunctionName(procName) == 0)
|
if (isIntrinsicFunctionName(procName) == 0 || isMpiProgram)
|
||||||
{
|
{
|
||||||
skipGetActualIfProcCall = skipActualIfProcCall = true;
|
skipGetActualIfProcCall = skipActualIfProcCall = true;
|
||||||
|
|
||||||
@@ -592,10 +598,6 @@ void DvmhRegionInserter::insertActualDirectives(const vector<ParallelRegion*>* r
|
|||||||
|
|
||||||
__spf_print(1, "Insert actuals for file %s\n", file->filename());
|
__spf_print(1, "Insert actuals for file %s\n", file->filename());
|
||||||
|
|
||||||
/*int funcNum = file->numberOfFunctions();
|
|
||||||
if (funcsForFile.size() != funcNum)
|
|
||||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__); */
|
|
||||||
|
|
||||||
for (auto& func : funcsForFile)
|
for (auto& func : funcsForFile)
|
||||||
{
|
{
|
||||||
// skip parallel funcs
|
// skip parallel funcs
|
||||||
@@ -774,7 +776,6 @@ void DvmhRegionInserter::insertActualDirective(SgStatement *st, const ArraySet &
|
|||||||
}
|
}
|
||||||
else if (variant == ACC_ACTUAL_DIR)
|
else if (variant == ACC_ACTUAL_DIR)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto prev = st->lexPrev();
|
auto prev = st->lexPrev();
|
||||||
if (prev && prev->variant() == ASSIGN_STAT && !hasFuncCalls(prev->expr(1)) && !hasFuncCalls(prev->expr(0)))
|
if (prev && prev->variant() == ASSIGN_STAT && !hasFuncCalls(prev->expr(1)) && !hasFuncCalls(prev->expr(0)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class DvmhRegionInserter
|
|||||||
const std::vector<LoopGraph*> loopGraph;
|
const std::vector<LoopGraph*> loopGraph;
|
||||||
const std::map<std::string, FuncInfo*> allFunctions;
|
const std::map<std::string, FuncInfo*> allFunctions;
|
||||||
const std::vector<FuncInfo*> funcsForFile;
|
const std::vector<FuncInfo*> funcsForFile;
|
||||||
|
bool isMpiProgram;
|
||||||
|
|
||||||
ReadWriteAnalyzer& rw_analyzer;
|
ReadWriteAnalyzer& rw_analyzer;
|
||||||
std::set<FuncInfo*> parallel_functions;
|
std::set<FuncInfo*> parallel_functions;
|
||||||
@@ -63,8 +64,9 @@ public:
|
|||||||
ReadWriteAnalyzer& rws,
|
ReadWriteAnalyzer& rws,
|
||||||
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls,
|
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls,
|
||||||
const std::map<std::string, FuncInfo*>& allFunctions,
|
const std::map<std::string, FuncInfo*>& allFunctions,
|
||||||
const std::vector<FuncInfo*>& funcsForFile
|
const std::vector<FuncInfo*>& funcsForFile,
|
||||||
) : file(curFile), loopGraph(curLoopGraph), rw_analyzer(rws), arrayLinksByFuncCalls(arrayLinksByFuncCalls), allFunctions(allFunctions), funcsForFile(funcsForFile)
|
bool mpi_program
|
||||||
|
) : file(curFile), loopGraph(curLoopGraph), rw_analyzer(rws), arrayLinksByFuncCalls(arrayLinksByFuncCalls), allFunctions(allFunctions), funcsForFile(funcsForFile), isMpiProgram(mpi_program)
|
||||||
{
|
{
|
||||||
if (loopGraph.size())
|
if (loopGraph.size())
|
||||||
createMapLoopGraph(loopGraph, loopGraphMap);
|
createMapLoopGraph(loopGraph, loopGraphMap);
|
||||||
|
|||||||
@@ -2110,7 +2110,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
for (auto& loop : loopsForFile)
|
for (auto& loop : loopsForFile)
|
||||||
loop->analyzeParallelDirs();
|
loop->analyzeParallelDirs();
|
||||||
|
|
||||||
DvmhRegionInserter* regionInserter = new DvmhRegionInserter(file, loopsForFile, rw_analyzer, arrayLinksByFuncCalls, mapOfFuncs, funcsForFile);
|
DvmhRegionInserter* regionInserter = new DvmhRegionInserter(file, loopsForFile, rw_analyzer, arrayLinksByFuncCalls, mapOfFuncs, funcsForFile, mpiProgram == 1);
|
||||||
inserters.push_back(regionInserter);
|
inserters.push_back(regionInserter);
|
||||||
|
|
||||||
//collect info about <parallel> functions
|
//collect info about <parallel> functions
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2217"
|
#define VERSION_SPF "2218"
|
||||||
|
|||||||
Reference in New Issue
Block a user