2 Commits

4 changed files with 49 additions and 7 deletions

View File

@@ -10,8 +10,10 @@ using std::wstring;
using std::inserter;
using std::copy;
using std::to_string;
bool IsSetsIntersect(const set<DIST::Array*>& lhs, const set<DIST::Array*>& rhs) {
bool IsSetsIntersect(const set<DIST::Array*>& lhs, const set<DIST::Array*>& rhs)
{
if (lhs.empty() || rhs.empty())
return false;
@@ -53,7 +55,8 @@ bool IsSetsIntersect(const set<DIST::Array*>& lhs, const set<DIST::Array*>& rhs)
return false;
}
static void findUsedArraysInParallelLoops(LoopGraph* loop, set<DIST::Array*>& res) {
static void findUsedArraysInParallelLoops(LoopGraph* loop, set<DIST::Array*>& res)
{
if(loop->directive)
copy(loop->usedArraysAll.begin(), loop->usedArraysAll.end(), inserter(res, res.end()));
else
@@ -62,7 +65,8 @@ static void findUsedArraysInParallelLoops(LoopGraph* loop, set<DIST::Array*>& re
}
static void preventLoopsFromParallelizations(LoopGraph* loop, const set<DIST::Array*>& prevent,
vector<Directive*>& createdDirectives) {
vector<Directive*>& createdDirectives,vector<Messages>& messagesForFile)
{
if (loop->directive)
{
if (IsSetsIntersect(prevent, loop->usedArraysAll))
@@ -83,12 +87,44 @@ static void preventLoopsFromParallelizations(LoopGraph* loop, const set<DIST::Ar
delete loop->directive;
loop->directive = NULL;
vector<DIST::Array*> conflict_arrays; // = prevent \intersection loop->usedArraysAll
set_intersection(prevent.begin(), prevent.end(),
loop->usedArraysAll.begin(), loop->usedArraysAll.end(),
back_inserter(conflict_arrays));
for(DIST::Array* conflict_array: conflict_arrays)
{
// constructing string with array and it's sizes
string array_bounds;
const auto& array_sizes = conflict_array->GetSizes();
for(int i = 0; i < array_sizes.size(); i++)
{
if(i != 0)
array_bounds += ",";
const auto& bounds_pair = array_sizes[i];
array_bounds += bounds_pair.first >= 0 ? to_string(bounds_pair.first) : "*";
array_bounds += ":";
array_bounds += bounds_pair.second >= 0 ? to_string(bounds_pair.second) : "*";
}
string array_ref = conflict_array->GetName() + "(" + array_bounds + ")";
// add conflict message
std::wstring bufE, bufR;
__spf_printToLongBuf(bufE, L"Array reference '%s' has a different size from the original array", to_wstring(array_ref).c_str());
__spf_printToLongBuf(bufR, R202, to_wstring(array_ref).c_str());
messagesForFile.push_back(Messages(WARR, loop->lineNum, bufR, bufE, 3023));
}
}
}
else
{
for (LoopGraph* child : loop->children)
preventLoopsFromParallelizations(child, prevent, createdDirectives);
preventLoopsFromParallelizations(child, prevent, createdDirectives, messagesForFile);
}
}
@@ -230,6 +266,7 @@ void SelectArrayConfForParallelization(SgProject* proj, map<string, vector<FuncI
for (const auto& byFile : loopGraph)
{
vector<Messages>& fileM = getObjectForFileFromMap(byFile.first.c_str(), allMessages);
auto dirs_it = createdDirectives.find(byFile.first);
if (dirs_it != createdDirectives.end())
{
@@ -261,7 +298,7 @@ void SelectArrayConfForParallelization(SgProject* proj, map<string, vector<FuncI
{
auto prevent_it = preventFromParallelization.find(byFunc);
if (prevent_it != preventFromParallelization.end())
preventLoopsFromParallelizations(loop, prevent_it->second, dirs_it->second);
preventLoopsFromParallelizations(loop, prevent_it->second, dirs_it->second, fileM);
loop_analyzed = true;
break;

View File

@@ -321,7 +321,7 @@ void removalsFromPassesDependencies(map<passes, vector<passes>>& passDepsIn, con
{
passDeps = &passDepsIn;
Pass(INSERT_PARALLEL_DIRS_NODIST) -= list({ FIND_FUNC_TO_INCLUDE, CHECK_FUNC_TO_INCLUDE });
list({ INSERT_PARALLEL_DIRS_NODIST, LOOP_ANALYZER_NODIST }) -= list({ FIND_FUNC_TO_INCLUDE, CHECK_FUNC_TO_INCLUDE });
Pass(passes(curr_regime)).applyRemovals();
}

View File

@@ -125,6 +125,7 @@ enum typeMessage { WARR, ERROR, NOTE };
// 20 "detected distributed and non distributed array links by function's calls for array %s\n"
// 21 "empty parallel regions is forbidden"
// 22 "Can not find align rules"
// 23 "Array reference '%s' has a different size from the original array"
// 40xx LOW LEVEL WARNINGS
// 01
@@ -273,7 +274,7 @@ static void printStackTrace() { };
} \
} while (0)
// Свободный - R202
// Свободный - R203
// Гайд по русификации сообщений: При добавлении нового сообщения, меняется последний сводобный идентификатор.
// В этом файле остаются только спецификаторы, для которых будет заполнен текст. Полный текст пишется в файле
// russian_errors_text.txt. Спецификаторы там тоже сохраняются, по ним в визуализаторе будет восстановлен
@@ -597,6 +598,8 @@ static const wchar_t *R142 = L"R142:%s";
static const wchar_t* R151 = L"R151:";
//3022
static const wchar_t* R171 = L"R171:%s";
//3023
static const wchar_t* R202 = L"R202:%s";
//4001
//---TODO ошибки из SAGE

View File

@@ -310,6 +310,8 @@ R142 = "Для массива '%s' не удается найти единого
R151 = "Пустые области распараллеливания недопускаются."
//3022
R171 = "Невозможно определить правила выравнивания для массива '%s'."
//3023
R202 = "Ссылка '%s' имеет размер отличный от оригинального массива размер"
//4001
//---TODO ошибки из SAGE