From a8f8f44ac1fbde43dce454905f390cc0dad4e158 Mon Sep 17 00:00:00 2001 From: ALEXks Date: Wed, 24 Dec 2025 08:58:28 +0300 Subject: [PATCH] corrected style, updated version --- src/Distribution/CreateDistributionDirs.cpp | 10 +-- src/Distribution/DvmhDirective.cpp | 6 +- src/Distribution/DvmhDirectiveBase.cpp | 12 ++-- src/GraphLoop/graph_loops_base.cpp | 4 +- src/LoopAnalyzer/loop_analyzer.cpp | 34 +++++----- src/Predictor/PredictScheme.cpp | 16 ++--- src/PrivateAnalyzer/region.cpp | 6 +- .../LoopCombining/loops_combiner.cpp | 66 +++++++++---------- src/Utils/version.h | 2 +- 9 files changed, 76 insertions(+), 80 deletions(-) diff --git a/src/Distribution/CreateDistributionDirs.cpp b/src/Distribution/CreateDistributionDirs.cpp index 4ec1342..94ecd44 100644 --- a/src/Distribution/CreateDistributionDirs.cpp +++ b/src/Distribution/CreateDistributionDirs.cpp @@ -274,7 +274,7 @@ static void convertTrees(const map &treesIn, map &arrays, DIST::GraphCSR &reducedG, DIST::Arrays &allArrays) { DIST::Array *retVal = NULL; - vector> coefsByDims; + vector> coeffsByDims; for (auto &array : arrays) { vector verts; @@ -285,7 +285,7 @@ static DIST::Array* findBestInEqual(vector &arrays, DIST::GraphCSR { retVal = array; for (auto &V : verts) - coefsByDims.push_back(reducedG.GetAllAttributes(V)); + coeffsByDims.push_back(reducedG.GetAllAttributes(V)); } else { @@ -294,11 +294,11 @@ static DIST::Array* findBestInEqual(vector &arrays, DIST::GraphCSR toCmp.push_back(reducedG.GetAllAttributes(V)); for (int z = 0; z < toCmp.size(); ++z) { - if (toCmp[z].size() && coefsByDims[z].size()) + if (toCmp[z].size() && coeffsByDims[z].size()) { - if (toCmp[z].back().first.first > coefsByDims[z].back().first.first) + if (toCmp[z].back().first.first > coeffsByDims[z].back().first.first) { - coefsByDims = toCmp; + coeffsByDims = toCmp; retVal = array; break; } diff --git a/src/Distribution/DvmhDirective.cpp b/src/Distribution/DvmhDirective.cpp index 421eea8..42ac6b4 100644 --- a/src/Distribution/DvmhDirective.cpp +++ b/src/Distribution/DvmhDirective.cpp @@ -45,10 +45,10 @@ static bool findArrayRefAndCheck(SgExpression *ex, const DIST::Array* currArray, int countOfShadows = 0; for (int i = 0; i < ref->numberOfSubscripts(); ++i) { - const vector &coefs = getAttributes(ref->subscript(i), set{ INT_VAL }); - if (coefs.size() == 1) + const vector &coeffs = getAttributes(ref->subscript(i), set{ INT_VAL }); + if (coeffs.size() == 1) { - const pair coef(coefs[0][0], coefs[0][1]); + const pair coef(coeffs[0][0], coeffs[0][1]); auto it = shiftsByAccess[i].find(coef); if (it != shiftsByAccess[i].end()) if (it->second != 0) diff --git a/src/Distribution/DvmhDirectiveBase.cpp b/src/Distribution/DvmhDirectiveBase.cpp index 88f2491..740cbb5 100644 --- a/src/Distribution/DvmhDirectiveBase.cpp +++ b/src/Distribution/DvmhDirectiveBase.cpp @@ -364,11 +364,11 @@ static inline string calculateShifts(DIST::GraphCSR &redu { if (sharedMemoryParallelization) { - for (auto& coefs : currReadOp->first[k].coefficients) + for (auto& coeffs : currReadOp->first[k].coefficients) { - auto currAccess = coefs.first; + auto currAccess = coeffs.first; - const int currShift = coefs.first.second; + const int currShift = coeffs.first.second; auto itFound = shiftsByAccess[k].find(currAccess); if (itFound == shiftsByAccess[k].end()) @@ -393,9 +393,9 @@ static inline string calculateShifts(DIST::GraphCSR &redu int minShift = 9999999; int maxShift = -9999999; - for (auto &coefs : currReadOp->first[k].coefficients) + for (auto &coeffs : currReadOp->first[k].coefficients) { - auto currAccess = coefs.first; + auto currAccess = coeffs.first; auto result = DIST::Fx(currAccess, currRuleShadow); if (result.first == loopRule.first) @@ -417,7 +417,7 @@ static inline string calculateShifts(DIST::GraphCSR &redu auto it = remoteRegularReads.find(calcForArray); if (it == remoteRegularReads.end()) it = remoteRegularReads.insert(it, make_pair(calcForArray, vector(calcForArray->GetDimSize()))); - it->second[k].coefficients.insert(coefs); + it->second[k].coefficients.insert(coeffs); } } diff --git a/src/GraphLoop/graph_loops_base.cpp b/src/GraphLoop/graph_loops_base.cpp index 38fb3dd..7a871bb 100644 --- a/src/GraphLoop/graph_loops_base.cpp +++ b/src/GraphLoop/graph_loops_base.cpp @@ -1137,9 +1137,9 @@ static bool isMapped(const vector &allOps) bool mapped = false; for (auto &ops : allOps) { - for (auto &coefs : ops.coefficients) + for (auto &coeffs : ops.coefficients) { - if (coefs.first.first != 0) + if (coeffs.first.first != 0) { mapped = true; break; diff --git a/src/LoopAnalyzer/loop_analyzer.cpp b/src/LoopAnalyzer/loop_analyzer.cpp index 3844fed..e2cd4aa 100644 --- a/src/LoopAnalyzer/loop_analyzer.cpp +++ b/src/LoopAnalyzer/loop_analyzer.cpp @@ -247,7 +247,7 @@ static vector matchSubscriptToLoopSymbols(const vector &parentL } } - pair coefs = pair(0, 0); + pair coeffs = pair(0, 0); // more than one loop symbol in subscription if (countOfSymbols > 1) { @@ -326,16 +326,16 @@ static vector matchSubscriptToLoopSymbols(const vector &parentL { if (subscr->symbol()->id() == (parentLoops[position]->doName())->id()) { - coefs.first = 1; + coeffs.first = 1; needToCacl = false; } } if (needToCacl) - getCoefsOfSubscript(coefs, subscr, parentLoops[position]->doName()); - __spf_print(PRINT_ARRAY_ARCS, " <%d %d> ", coefs.first, coefs.second); + getCoefsOfSubscript(coeffs, subscr, parentLoops[position]->doName()); + __spf_print(PRINT_ARRAY_ARCS, " <%d %d> ", coeffs.first, coeffs.second); - if (coefs.first == 0) // && coefs.second == 0) + if (coeffs.first == 0) // && coeffs.second == 0) { if (currRegime == REMOTE_ACC) { @@ -346,7 +346,7 @@ static vector matchSubscriptToLoopSymbols(const vector &parentL { const pair &arrayRefString = constructArrayRefForPrint(arrayRef, dimNum, origSubscr); __spf_print(1, "WARN: can not calculate index expression for array ref '%s' at line %d\n", arrayRefString.second.c_str(), currLine); - addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coefs, UNREC_OP, numOfSubscriptions, currentW); + addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coeffs, UNREC_OP, numOfSubscriptions, currentW); if (side == LEFT) allPositions.clear(); @@ -371,19 +371,19 @@ static vector matchSubscriptToLoopSymbols(const vector &parentL currOp.resize(numOfSubscriptions); //add only uniq - auto itAdd = currOp[dimNum].coefficients.find(coefs); + auto itAdd = currOp[dimNum].coefficients.find(coeffs); if (itAdd == currOp[dimNum].coefficients.end()) - itAdd = currOp[dimNum].coefficients.insert(itAdd, make_pair(coefs, currentW)); + itAdd = currOp[dimNum].coefficients.insert(itAdd, make_pair(coeffs, currentW)); } - if (coefs.first < 0) + if (coeffs.first < 0) addInfoToMap(loopInfo, parentLoops[position], currOrigArrayS, arrayRef, dimNum, REMOTE_TRUE, currLine, numOfSubscriptions); else //if we found regular access to array - set it false addInfoToMap(loopInfo, parentLoops[position], currOrigArrayS, arrayRef, dimNum, REMOTE_FALSE, currLine, numOfSubscriptions); } - if (coefs.first < 0 && sharedMemoryParallelization == 0) + if (coeffs.first < 0 && sharedMemoryParallelization == 0) { if (currRegime == DATA_DISTR) { @@ -402,15 +402,15 @@ static vector matchSubscriptToLoopSymbols(const vector &parentL if (side == LEFT) allPositions.clear(); else - addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coefs, UNREC_OP, numOfSubscriptions, currentW); + addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coeffs, UNREC_OP, numOfSubscriptions, currentW); } } else { if (side == LEFT) - addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coefs, WRITE_OP, numOfSubscriptions, currentW); + addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coeffs, WRITE_OP, numOfSubscriptions, currentW); else - addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coefs, READ_OP, numOfSubscriptions, currentW); + addInfoToVectors(loopInfo, parentLoops[position], currOrigArrayS, dimNum, coeffs, READ_OP, numOfSubscriptions, currentW); } } } @@ -418,13 +418,13 @@ static vector matchSubscriptToLoopSymbols(const vector &parentL if (currRegime == ARRAY_ACC_CORNER) { int *valueSubs = new int[2]; - valueSubs[0] = coefs.first; - valueSubs[1] = coefs.second; + valueSubs[0] = coeffs.first; + valueSubs[1] = coeffs.second; #ifdef __SPF addToCollection(__LINE__, __FILE__, valueSubs, 2); #endif - const vector &coefs = getAttributes(subscr, set{ INT_VAL }); - if (coefs.size() == 0) + const vector &coeffs = getAttributes(subscr, set{ INT_VAL }); + if (coeffs.size() == 0) { subscr->addAttribute(INT_VAL, valueSubs, sizeof(int*)); if (position != -1 && allPositions.size() == 1 && position < parentLoops.size()) diff --git a/src/Predictor/PredictScheme.cpp b/src/Predictor/PredictScheme.cpp index 11fb9a9..764ce1a 100644 --- a/src/Predictor/PredictScheme.cpp +++ b/src/Predictor/PredictScheme.cpp @@ -326,7 +326,7 @@ static json parseAlign(const map& byPos, SgSymbol* srcArr, Sg list = list->rhs(); } - vector> coefs(srcSymbs.size()); + vector> coeffs(srcSymbs.size()); list = listTgt; while (list) { @@ -337,8 +337,8 @@ static json parseAlign(const map& byPos, SgSymbol* srcArr, Sg has = recSymbolFind(exp, srcSymbs[z].first, VAR_REF); if (has) { - getCoefsOfSubscript(coefs[z], exp, srcSymbs[z].second); - if (coefs[z].first == 0) + getCoefsOfSubscript(coeffs[z], exp, srcSymbs[z].second); + if (coeffs[z].first == 0) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); break; } @@ -346,14 +346,14 @@ static json parseAlign(const map& byPos, SgSymbol* srcArr, Sg list = list->rhs(); } - for (int z = 0; z < coefs.size(); ++z) + for (int z = 0; z < coeffs.size(); ++z) { - if (coefs[z].first == 0) + if (coeffs[z].first == 0) continue; - if (coefs[z].second) - align["rules"].push_back({ z, coefs[z].first }); + if (coeffs[z].second) + align["rules"].push_back({ z, coeffs[z].first }); else - align["rules"].push_back({ z, coefs[z].first, coefs[z].second }); + align["rules"].push_back({ z, coeffs[z].first, coeffs[z].second }); } return align; } diff --git a/src/PrivateAnalyzer/region.cpp b/src/PrivateAnalyzer/region.cpp index ea966d9..5cde710 100644 --- a/src/PrivateAnalyzer/region.cpp +++ b/src/PrivateAnalyzer/region.cpp @@ -119,14 +119,11 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces { string strDimLength = arrayType->sizeInDim(i)->unparse(); if (arrayType->sizeInDim(i)->variant() == INT_VAL && strDimLength != "0") - { point.push_back({ 1ULL, 1ULL, (uint64_t)stoi(strDimLength), (SgArrayRefExp*)op->expr(0) }); - } } + if (point.size() == dimCount) - { def[instruction->getInstruction()->getResult()->getValue()] = AccessingSet({point}); - } } } } @@ -149,7 +146,6 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces vector accessPoint(n); auto* ref = isSgArrayRefExp(instruction->getInstruction()->getExpression()); - int fillCount = 0; while (!index_vars.empty() && !refPos.empty()) diff --git a/src/Transformations/LoopCombining/loops_combiner.cpp b/src/Transformations/LoopCombining/loops_combiner.cpp index 9ab3e2b..4e3e7ab 100644 --- a/src/Transformations/LoopCombining/loops_combiner.cpp +++ b/src/Transformations/LoopCombining/loops_combiner.cpp @@ -1123,7 +1123,7 @@ static bool hasDependenciesBetweenArrays(LoopGraph* firstLoop, LoopGraph* loop, for (int d = 0; d < dimensions; ++d) { //по измерениям массива отображение на цикл вложенности d - vector>> coefsRead[2], coefsWrite[2]; + vector>> coeffsRead[2], coeffsWrite[2]; checkNull(currLoop[0], convertFileName(__FILE__).c_str(), __LINE__); checkNull(currLoop[1], convertFileName(__FILE__).c_str(), __LINE__); @@ -1133,31 +1133,31 @@ static bool hasDependenciesBetweenArrays(LoopGraph* firstLoop, LoopGraph* loop, auto it = currLoop[k]->readOpsForLoop.find(array); if (it != currLoop[k]->readOpsForLoop.end()) { - if (coefsRead[k].size() == 0) - coefsRead[k].resize(it->second.size()); + if (coeffsRead[k].size() == 0) + coeffsRead[k].resize(it->second.size()); for (int z = 0; z < it->second.size(); ++z) if (it->second[z].coefficients.size()) for (auto& coef : it->second[z].coefficients) - coefsRead[k][z].insert(coef.first); + coeffsRead[k][z].insert(coef.first); } auto itW = currLoop[k]->writeOpsForLoop.find(array); if (itW != currLoop[k]->writeOpsForLoop.end()) { - if (coefsWrite[k].size() == 0) - coefsWrite[k].resize(itW->second.size()); + if (coeffsWrite[k].size() == 0) + coeffsWrite[k].resize(itW->second.size()); for (int z = 0; z < itW->second.size(); ++z) if (itW->second[z].coefficients.size()) for (auto& coef : itW->second[z].coefficients) - coefsWrite[k][z].insert(coef.first); + coeffsWrite[k][z].insert(coef.first); } } //нет записей, значит нет зависимости bool nulWrite = true; - for (auto& wr : coefsWrite) + for (auto& wr : coeffsWrite) for (auto& elem : wr) if (elem.size() != 0) nulWrite = false; @@ -1168,62 +1168,62 @@ static bool hasDependenciesBetweenArrays(LoopGraph* firstLoop, LoopGraph* loop, // если чтение в одном цикле и запись (и наоборот) в другом идут по разным правилам, то пока что это зависимость. // здесь можно уточнить. - const int len = std::max(coefsWrite[0].size(), coefsRead[0].size()); + const int len = std::max(coeffsWrite[0].size(), coeffsRead[0].size()); int countW[2] = { 0, 0 }; int countR[2] = { 0, 0 }; for (int L = 0; L < 2; ++L) - for (int z = 0; z < coefsWrite[L].size(); ++z) - countW[L] += (coefsWrite[L][z].size() ? 1 : 0); + for (int z = 0; z < coeffsWrite[L].size(); ++z) + countW[L] += (coeffsWrite[L][z].size() ? 1 : 0); for (int L = 0; L < 2; ++L) - for (int z = 0; z < coefsRead[L].size(); ++z) - countR[L] += (coefsRead[L][z].size() ? 1 : 0); + for (int z = 0; z < coeffsRead[L].size(); ++z) + countR[L] += (coeffsRead[L][z].size() ? 1 : 0); for (int p = 0; p < len; ++p) { - if (coefsWrite[1].size() && coefsWrite[0].size()) - if (coefsWrite[0][p].size() != 0 && coefsWrite[1][p].size() != 0) - if (coefsWrite[0][p] != coefsWrite[1][p]) + if (coeffsWrite[1].size() && coeffsWrite[0].size()) + if (coeffsWrite[0][p].size() != 0 && coeffsWrite[1][p].size() != 0) + if (coeffsWrite[0][p] != coeffsWrite[1][p]) return true; - if (coefsRead[1].size() && coefsWrite[0].size()) - if (coefsWrite[0][p].size() != 0 && coefsRead[1][p].size() != 0) - if (coefsWrite[0][p] != coefsRead[1][p]) + if (coeffsRead[1].size() && coeffsWrite[0].size()) + if (coeffsWrite[0][p].size() != 0 && coeffsRead[1][p].size() != 0) + if (coeffsWrite[0][p] != coeffsRead[1][p]) return true; - if (coefsWrite[1].size() && coefsRead[0].size()) - if (coefsWrite[1][p].size() != 0 && coefsRead[0][p].size() != 0) - if (coefsWrite[1][p] != coefsRead[0][p]) + if (coeffsWrite[1].size() && coeffsRead[0].size()) + if (coeffsWrite[1][p].size() != 0 && coeffsRead[0][p].size() != 0) + if (coeffsWrite[1][p] != coeffsRead[0][p]) return true; //отображение на разные измерения - if (coefsWrite[1].size() && coefsWrite[0].size()) + if (coeffsWrite[1].size() && coeffsWrite[0].size()) { - if (coefsWrite[0][p].size() != 0 && coefsWrite[1][p].size() == 0 && countW[1] || - coefsWrite[0][p].size() == 0 && coefsWrite[1][p].size() != 0 && countW[0]) + if (coeffsWrite[0][p].size() != 0 && coeffsWrite[1][p].size() == 0 && countW[1] || + coeffsWrite[0][p].size() == 0 && coeffsWrite[1][p].size() != 0 && countW[0]) return true; } - if (coefsRead[1].size() && coefsWrite[0].size()) + if (coeffsRead[1].size() && coeffsWrite[0].size()) { - if (coefsWrite[0][p].size() != 0 && coefsRead[1][p].size() == 0 && countR[1] || - coefsWrite[0][p].size() == 0 && coefsRead[1][p].size() != 0 && countW[0]) + if (coeffsWrite[0][p].size() != 0 && coeffsRead[1][p].size() == 0 && countR[1] || + coeffsWrite[0][p].size() == 0 && coeffsRead[1][p].size() != 0 && countW[0]) return true; } - if (coefsWrite[1].size() && coefsRead[1].size()) + if (coeffsWrite[1].size() && coeffsRead[1].size()) { - if (coefsWrite[1][p].size() != 0 && coefsRead[0][p].size() == 0 && countR[0] || - coefsWrite[1][p].size() == 0 && coefsRead[0][p].size() != 0 && countW[1]) + if (coeffsWrite[1][p].size() != 0 && coeffsRead[0][p].size() == 0 && countR[0] || + coeffsWrite[1][p].size() == 0 && coeffsRead[0][p].size() != 0 && countW[1]) return true; } //где то нет правил отображения вообще, но есть факт его наличия. - if ( ((coefsWrite[0].size() == 0 && coefsRead[0].size() == 0) && (countW[0] == 0 && countR[0] == 0)) + if ( ((coeffsWrite[0].size() == 0 && coeffsRead[0].size() == 0) && (countW[0] == 0 && countR[0] == 0)) || - ((coefsWrite[1].size() == 0 && coefsRead[1].size() == 0) && (countW[1] == 0 && countR[1] == 0)) ) + ((coeffsWrite[1].size() == 0 && coeffsRead[1].size() == 0) && (countW[1] == 0 && countR[1] == 0)) ) return true; } diff --git a/src/Utils/version.h b/src/Utils/version.h index d0ed740..f6ac53b 100644 --- a/src/Utils/version.h +++ b/src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2449" +#define VERSION_SPF "2450"