fixed predictor

This commit is contained in:
ALEXks
2025-04-22 18:08:28 +03:00
parent 06980ee344
commit 7b0cb828a7

View File

@@ -454,7 +454,7 @@ static void parallelDir(const map<DIST::Array*, int>& byPos, SgExpression* spec,
execs[z] /= execs[z - 1]; execs[z] /= execs[z - 1];
auto& info = getInfo(before, gcov); auto& info = getInfo(before, gcov);
if (info.getExecutedCount()) if (info.getExecutedCount() && loopSymbs.size() > 1)
execs[0] /= info.getExecutedCount(); execs[0] /= info.getExecutedCount();
parallel["iterations_count"] = execs; parallel["iterations_count"] = execs;
@@ -604,7 +604,10 @@ void parseDvmDirForPredictor(const map<tuple<int, string, string>, pair<DIST::Ar
switch (st->variant()) switch (st->variant())
{ {
case DVM_PARALLEL_ON_DIR: case DVM_PARALLEL_ON_DIR:
parallelDir(byPos, st->expr(2), st->expr(0)->symbol(), st->expr(0)->lhs(), st, st->expr(1), gcov, directives, commonBlocks, allFuncInfo); parallelDir(byPos, st->expr(2),
st->expr(0) ? st->expr(0)->symbol() : NULL,
st->expr(0) ? st->expr(0)->lhs() : NULL,
st, st->expr(1), gcov, directives, commonBlocks, allFuncInfo);
break; break;
case DVM_VAR_DECL: // TODO case DVM_VAR_DECL: // TODO
{ {
@@ -623,6 +626,7 @@ void parseDvmDirForPredictor(const map<tuple<int, string, string>, pair<DIST::Ar
list = st->expr(0); list = st->expr(0);
while (list) while (list)
{ {
if (type->lhs()) // if ALIGN A(...) with B(...)
directives["align"].push_back(parseAlign(byPos, list->lhs()->symbol(), type->rhs()->symbol(), type->lhs(), type->rhs()->lhs(), st->lineNumber())); directives["align"].push_back(parseAlign(byPos, list->lhs()->symbol(), type->rhs()->symbol(), type->lhs(), type->rhs()->lhs(), st->lineNumber()));
list = list->rhs(); list = list->rhs();
} }
@@ -635,6 +639,9 @@ void parseDvmDirForPredictor(const map<tuple<int, string, string>, pair<DIST::Ar
case DVM_ALIGN_DIR: case DVM_ALIGN_DIR:
directives["align"].push_back(parseAlign(byPos, st->expr(0)->lhs()->symbol(), st->expr(2)->symbol(), st->expr(1), st->expr(2)->lhs(), st->lineNumber())); directives["align"].push_back(parseAlign(byPos, st->expr(0)->lhs()->symbol(), st->expr(2)->symbol(), st->expr(1), st->expr(2)->lhs(), st->lineNumber()));
break; break;
case DVM_REALIGN_DIR:
directives["realign"].push_back(parseAlign(byPos, st->expr(0)->lhs()->symbol(), st->expr(2)->symbol(), st->expr(1), st->expr(2)->lhs(), st->lineNumber()));
break;
case DVM_SHADOW_DIR: case DVM_SHADOW_DIR:
//dirs << "1;" << "SHADOW;" << st->expr(0)->unparse() << "(" << st->expr(1)->unparse() << ");\n"; //dirs << "1;" << "SHADOW;" << st->expr(0)->unparse() << "(" << st->expr(1)->unparse() << ");\n";
break; break;