added IPA to complete the formation of names of parallelization regions
This commit is contained in:
@@ -24,6 +24,7 @@ using std::make_pair;
|
|||||||
using std::map;
|
using std::map;
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::wstring;
|
using std::wstring;
|
||||||
|
using std::tuple;
|
||||||
|
|
||||||
extern void createMapLoopGraph(map<int, LoopGraph*> &sortedLoopGraph, const vector<LoopGraph*> *loopGraph);
|
extern void createMapLoopGraph(map<int, LoopGraph*> &sortedLoopGraph, const vector<LoopGraph*> *loopGraph);
|
||||||
|
|
||||||
@@ -954,4 +955,65 @@ void calculateLinesOfCode(vector<ParallelRegion*> &allRegions)
|
|||||||
|
|
||||||
__spf_print(1, " Count of lines in region '%s' = %d\n", elem->GetName().c_str(), lineCounter);
|
__spf_print(1, " Count of lines in region '%s' = %d\n", elem->GetName().c_str(), lineCounter);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void propagateRegionInfo(map<tuple<int, string, string>, pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays,
|
||||||
|
const map<DIST::Array*, set<DIST::Array*>>& arrayLinksByFuncCalls,
|
||||||
|
const vector<ParallelRegion*> ¶llelRegions)
|
||||||
|
{
|
||||||
|
bool modified = true;
|
||||||
|
while (modified)
|
||||||
|
{
|
||||||
|
modified = false;
|
||||||
|
|
||||||
|
for (auto &array_pair: declaredArrays)
|
||||||
|
{
|
||||||
|
auto array = array_pair.second.first;
|
||||||
|
if (array->GetLocation().first == DIST::l_PARAMETER)
|
||||||
|
{
|
||||||
|
set<DIST::Array*> realArrayRef;
|
||||||
|
getAllArrayRefs(array, array, realArrayRef, arrayLinksByFuncCalls);
|
||||||
|
|
||||||
|
auto regs = array->GetRegionsName();
|
||||||
|
for (auto& ref : realArrayRef)
|
||||||
|
{
|
||||||
|
auto regsRef = ref->GetRegionsName();
|
||||||
|
for (auto& reg : regsRef)
|
||||||
|
{
|
||||||
|
if (regs.count(reg) == 0)
|
||||||
|
{
|
||||||
|
array->SetRegionPlace(reg);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasNonDefaultReg = false;
|
||||||
|
for (auto& elem : parallelRegions)
|
||||||
|
{
|
||||||
|
string regName = elem->GetName();
|
||||||
|
convertToLower(regName);
|
||||||
|
if (regName != "default")
|
||||||
|
hasNonDefaultReg = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasNonDefaultReg)
|
||||||
|
{
|
||||||
|
for (auto array : declaredArrays)
|
||||||
|
{
|
||||||
|
if (array.second.first->GetRegionsName().size() == 0)
|
||||||
|
array.second.first->SetDistributeFlag(DIST::NO_DISTR);
|
||||||
|
else if (array.second.first->GetRegionsName().size() == 1)
|
||||||
|
{
|
||||||
|
string regName = *array.second.first->GetRegionsName().begin();
|
||||||
|
convertToLower(regName);
|
||||||
|
if (regName == "default")
|
||||||
|
array.second.first->SetDistributeFlag(DIST::NO_DISTR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,3 +10,7 @@ int printParalleRegions(const char *fileName, std::vector<ParallelRegion*> ®i
|
|||||||
bool buildGraphFromUserDirectives(const std::vector<Statement*> &userDvmAlignDirs, DIST::GraphCSR<int, double, attrType> &G, DIST::Arrays<int> &allArrays, const std::map<DIST::Array*, std::set<DIST::Array*>> &arrayLinksByFuncCalls, const std::set<DIST::Array*>& alignedArrays, std::set<DIST::Array*>& addedArrays, const std::map<std::string, std::vector<FuncInfo*>>& funcsByFile);
|
bool buildGraphFromUserDirectives(const std::vector<Statement*> &userDvmAlignDirs, DIST::GraphCSR<int, double, attrType> &G, DIST::Arrays<int> &allArrays, const std::map<DIST::Array*, std::set<DIST::Array*>> &arrayLinksByFuncCalls, const std::set<DIST::Array*>& alignedArrays, std::set<DIST::Array*>& addedArrays, const std::map<std::string, std::vector<FuncInfo*>>& funcsByFile);
|
||||||
void clearRegionStaticData();
|
void clearRegionStaticData();
|
||||||
void calculateLinesOfCode(std::vector<ParallelRegion*> &allRegions);
|
void calculateLinesOfCode(std::vector<ParallelRegion*> &allRegions);
|
||||||
|
|
||||||
|
void propagateRegionInfo(std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays,
|
||||||
|
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCall,
|
||||||
|
const std::vector<ParallelRegion*>& parallelRegions);
|
||||||
|
|||||||
@@ -1264,6 +1264,8 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
|
|
||||||
moveAllocatesInterproc(arrayLinksByFuncCalls);
|
moveAllocatesInterproc(arrayLinksByFuncCalls);
|
||||||
|
|
||||||
|
propagateRegionInfo(declaredArrays, arrayLinksByFuncCalls, subs_parallelRegions);
|
||||||
|
|
||||||
removeDistrStateFromDeadFunctions(allFuncInfo, declaredArrays);
|
removeDistrStateFromDeadFunctions(allFuncInfo, declaredArrays);
|
||||||
propagateArrayFlags(arrayLinksByFuncCalls, declaredArrays, SPF_messages);
|
propagateArrayFlags(arrayLinksByFuncCalls, declaredArrays, SPF_messages);
|
||||||
}
|
}
|
||||||
@@ -1681,30 +1683,11 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
|||||||
findDeadFunctionsAndFillCalls(allFuncInfo_IR, SPF_messages, true);
|
findDeadFunctionsAndFillCalls(allFuncInfo_IR, SPF_messages, true);
|
||||||
else if (curr_regime == GET_ALL_ARRAY_DECL)
|
else if (curr_regime == GET_ALL_ARRAY_DECL)
|
||||||
{
|
{
|
||||||
bool hasNonDefaultReg = false;
|
if (ignoreArrayDistributeState)
|
||||||
for (auto &elem : subs_parallelRegions)
|
|
||||||
if (elem->GetName() != "DEFAULT")
|
|
||||||
hasNonDefaultReg = true;
|
|
||||||
|
|
||||||
if (hasNonDefaultReg)
|
|
||||||
{
|
{
|
||||||
for (auto array : declaredArrays)
|
|
||||||
{
|
|
||||||
if (array.second.first->GetRegionsName().size() == 0)
|
|
||||||
array.second.first->SetDistributeFlag(DIST::NO_DISTR);
|
|
||||||
else if (array.second.first->GetRegionsName().size() == 1)
|
|
||||||
{
|
|
||||||
string regName = *array.second.first->GetRegionsName().begin();
|
|
||||||
convertToLower(regName);
|
|
||||||
if (regName == "default")
|
|
||||||
array.second.first->SetDistributeFlag(DIST::NO_DISTR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ignoreArrayDistributeState)
|
|
||||||
for (auto array : declaredArrays)
|
for (auto array : declaredArrays)
|
||||||
array.second.first->SetDistributeFlag(DIST::NO_DISTR);
|
array.second.first->SetDistributeFlag(DIST::NO_DISTR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (curr_regime == GCOV_PARSER)
|
else if (curr_regime == GCOV_PARSER)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2478"
|
#define VERSION_SPF "2479"
|
||||||
|
|||||||
Reference in New Issue
Block a user