fix for pass manager and new pass improvements #7
@@ -1,10 +1,12 @@
|
||||
#include "select_array_conf.h"
|
||||
#include "../Utils/utils.h"
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::set;
|
||||
using std::pair;
|
||||
using std::wstring;
|
||||
|
||||
using std::inserter;
|
||||
using std::copy;
|
||||
@@ -229,3 +231,77 @@ void SelectArrayConfForParallelization(SgProject* proj, map<string, vector<FuncI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void removeRegionsWithoutDirs(const map<string, vector<Directive*>>& createdDirectives,
|
||||
vector<ParallelRegion*>& parallelRegions,
|
||||
const map<string, vector<FuncInfo*>>& allFuncInfo,
|
||||
map<string, vector<Messages>>& SPF_messages)
|
||||
{
|
||||
set<ParallelRegion*> empty_regs(parallelRegions.begin(), parallelRegions.end());
|
||||
|
||||
for (const auto& byFile : createdDirectives)
|
||||
for (const auto& dir : byFile.second)
|
||||
empty_regs.erase(getRegionByLine(parallelRegions, byFile.first, dir->line));
|
||||
|
||||
set<int> idxToDel;
|
||||
for (int z = 0; z < parallelRegions.size(); ++z)
|
||||
{
|
||||
if (empty_regs.find(parallelRegions[z]) != empty_regs.end())
|
||||
{
|
||||
__spf_print(1, " no parallel directives for parallel region '%s'\n", parallelRegions[z]->GetName().c_str());
|
||||
|
||||
if (parallelRegions[z]->GetId() == 0) // DEFAULT
|
||||
{
|
||||
wstring bufE, bufR;
|
||||
__spf_printToLongBuf(bufE, L"Can not find arrays or free loops for distribution in this project");
|
||||
__spf_printToLongBuf(bufR, R130);
|
||||
|
||||
for (auto& funcByFile : allFuncInfo)
|
||||
{
|
||||
vector<Messages>& fileM = getObjectForFileFromMap(funcByFile.first.c_str(), SPF_messages);
|
||||
for (auto& func : funcByFile.second)
|
||||
{
|
||||
auto stat = func->funcPointer->GetOriginal();
|
||||
if (stat->variant() == PROG_HEDR)
|
||||
fileM.push_back(Messages(ERROR, stat->lineNumber(), bufR, bufE, 3010));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wstring bufE, bufR;
|
||||
__spf_printToLongBuf(bufE, L"Can not find arrays or free loops for distribution in this region");
|
||||
__spf_printToLongBuf(bufR, R131);
|
||||
|
||||
for (auto& linesByFile : parallelRegions[z]->GetAllLines())
|
||||
{
|
||||
vector<Messages>& fileM = getObjectForFileFromMap(linesByFile.first.c_str(), SPF_messages);
|
||||
for (auto& lines : linesByFile.second)
|
||||
if (!lines.isImplicit())
|
||||
fileM.push_back(Messages(ERROR, lines.lines.first, bufR, bufE, 3010));
|
||||
}
|
||||
}
|
||||
idxToDel.insert(z);
|
||||
}
|
||||
}
|
||||
|
||||
vector<ParallelRegion*> newParReg;
|
||||
for (int z = 0; z < parallelRegions.size(); ++z)
|
||||
{
|
||||
if (idxToDel.find(z) != idxToDel.end())
|
||||
{
|
||||
ParallelRegion* regToDel = parallelRegions[z];
|
||||
#ifdef _WIN32
|
||||
removeFromCollection(parallelRegions[z]);
|
||||
#endif
|
||||
delete parallelRegions[z];
|
||||
}
|
||||
else
|
||||
newParReg.push_back(parallelRegions[z]);
|
||||
}
|
||||
parallelRegions.clear();
|
||||
parallelRegions = newParReg;
|
||||
|
||||
if (parallelRegions.size() == 0)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
}
|
||||
@@ -14,4 +14,9 @@ void SelectArrayConfForParallelization(SgProject* proj, std::map<std::string, st
|
||||
const std::map<std::string, std::vector<LoopGraph*>>& loopGraph,
|
||||
std::map<std::string, std::vector<Directive*>>& createdDirectives,
|
||||
std::map<std::string, std::vector<Messages>>& allMessages,
|
||||
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls, const std::vector<ParallelRegion*>& regions);
|
||||
const std::map<DIST::Array*, std::set<DIST::Array*>>& arrayLinksByFuncCalls, const std::vector<ParallelRegion*>& regions);
|
||||
|
||||
void removeRegionsWithoutDirs(const std::map<std::string, std::vector<Directive*>>& createdDirectives,
|
||||
std::vector<ParallelRegion*>& parallelRegions,
|
||||
const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo,
|
||||
std::map<std::string, std::vector<Messages>>& SPF_messages);
|
||||
@@ -2179,6 +2179,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
map<string, vector<Messages>> localMessages;
|
||||
|
||||
SelectArrayConfForParallelization(&project, allFuncInfo, loopGraph, createdDirectives, localMessages, arrayLinksByFuncCalls, parallelRegions);
|
||||
removeRegionsWithoutDirs(createdDirectives, parallelRegions, allFuncInfo, SPF_messages);
|
||||
}
|
||||
|
||||
const float elapsed = duration_cast<milliseconds>(high_resolution_clock::now() - timeForPass).count() / 1000.;
|
||||
|
||||
Reference in New Issue
Block a user