2023-09-14 19:43:13 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "dvm.h"
|
2025-06-02 19:08:09 +03:00
|
|
|
#include "graph_calls.h"
|
2025-06-04 13:08:38 +03:00
|
|
|
#include "json.hpp"
|
2023-09-14 19:43:13 +03:00
|
|
|
|
|
|
|
|
class ParallelStats
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ParallelStats()
|
|
|
|
|
{
|
|
|
|
|
RemoteCount = ShadowCount = ReductionCount = AcrossCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-20 16:20:27 +03:00
|
|
|
int RemoteCount = 0;
|
|
|
|
|
int ShadowCount = 0;
|
|
|
|
|
int ReductionCount = 0;
|
|
|
|
|
int AcrossCount = 0;
|
2023-09-14 19:43:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PredictorStats
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
PredictorStats()
|
|
|
|
|
{
|
|
|
|
|
ParallelCount = RemoteCount = RedistributeCount = IntervalCount = 0;
|
|
|
|
|
TotalScorePar = TotalScoreComm = TotalScoreDist = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ParallelStats ParallelStat;
|
2025-05-20 16:20:27 +03:00
|
|
|
int ParallelCount = 0;
|
|
|
|
|
int RemoteCount = 0;
|
|
|
|
|
int RedistributeCount = 0;
|
|
|
|
|
int IntervalCount = 0;
|
|
|
|
|
int TotalScoreComm = 0;
|
|
|
|
|
int TotalScorePar = 0;
|
|
|
|
|
int TotalScoreDist = 0;
|
|
|
|
|
|
|
|
|
|
nlohmann::json toJson()
|
2023-09-14 19:43:13 +03:00
|
|
|
{
|
2025-05-20 16:20:27 +03:00
|
|
|
nlohmann::json stat;
|
|
|
|
|
|
|
|
|
|
stat["ParallelCount"] = ParallelCount;
|
|
|
|
|
stat["RemoteCount"] = RemoteCount;
|
|
|
|
|
stat["RedistributeCount"] = RedistributeCount;
|
|
|
|
|
stat["IntervalCount"] = IntervalCount;
|
|
|
|
|
|
|
|
|
|
stat["PS_RemoteCount"] = ParallelStat.RemoteCount;
|
|
|
|
|
stat["PS_ShadowCount"] = ParallelStat.ShadowCount;
|
|
|
|
|
stat["PS_ReductionCount"] = ParallelStat.ReductionCount;
|
|
|
|
|
stat["PS_AcrossCount"] = ParallelStat.AcrossCount;
|
|
|
|
|
|
|
|
|
|
//TODO: need to improve
|
|
|
|
|
// (summed.TotalScoreComm != 0 ? 1.0 / summed.TotalScoreComm : 0.0) + (double)summed.TotalScorePar * 1000 + (countOfDist == 0 ? -5000 : countOfDist);
|
|
|
|
|
stat["TotalScore"] = -1 * (ParallelStat.RemoteCount + ParallelStat.ShadowCount + ParallelStat.ReductionCount + ParallelStat.AcrossCount);
|
|
|
|
|
return stat;
|
2023-09-14 19:43:13 +03:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-30 12:17:35 +03:00
|
|
|
void processFileToPredict(SgFile *file, PredictorStats &predictorCounts);
|
|
|
|
|
|
2024-10-07 14:50:37 +03:00
|
|
|
void calculateStatsForPredictor(const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, const std::map<std::string, std::map<int, Gcov_info>>& gCovInfo);
|
2024-11-14 12:37:38 +03:00
|
|
|
void parseDvmDirForPredictor(const std::map<std::tuple<int, std::string, std::string>, std::pair<DIST::Array*, DIST::ArrayAccessInfo*>>& declaredArrays, const std::map<std::string, CommonBlock*>& commonBlocks, const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo, const std::map<std::string, std::map<int, Gcov_info>>& gCovInfo);
|