Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure unique use of statistics identifiers #384

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jlm/llvm/opt/alias-analyses/AgnosticMemoryNodeProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AgnosticMemoryNodeProvider::Statistics final : public util::Statistics
util::filepath sourceFile,
const util::StatisticsCollector & statisticsCollector,
const PointsToGraph & pointsToGraph)
: util::Statistics(Statistics::Id::MemoryNodeProvisioning),
: util::Statistics(Statistics::Id::AgnosticMemoryNodeProvisioning),
SourceFile_(std::move(sourceFile)),
NumPointsToGraphMemoryNodes_(0),
StatisticsCollector_(statisticsCollector)
Expand Down
2 changes: 1 addition & 1 deletion jlm/llvm/opt/alias-analyses/MemoryStateEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EncodingStatistics final : public jlm::util::Statistics
~EncodingStatistics() override = default;

explicit EncodingStatistics(jlm::util::filepath sourceFile)
: Statistics(Statistics::Id::BasicEncoderEncoding),
: Statistics(Statistics::Id::MemoryStateEncoder),
NumNodesBefore_(0),
SourceFile_(std::move(sourceFile))
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class RegionAwareMemoryNodeProvider::Statistics final : public jlm::util::Statis
const util::StatisticsCollector & statisticsCollector,
const RvsdgModule & rvsdgModule,
const PointsToGraph & pointsToGraph)
: jlm::util::Statistics(Statistics::Id::MemoryNodeProvisioning),
: jlm::util::Statistics(Statistics::Id::RegionAwareMemoryNodeProvisioning),
NumRvsdgNodes_(0),
NumRvsdgRegions_(0),
NumPointsToGraphMemoryNodes_(0),
Expand Down
70 changes: 46 additions & 24 deletions jlm/tooling/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ JlmOptCommandLineOptions::FromCommandLineArgumentToStatisticsId(
{
static std::unordered_map<std::string, util::Statistics::Id> map(
{ { StatisticsCommandLineArgument::Aggregation_, util::Statistics::Id::Aggregation },
{ StatisticsCommandLineArgument::BasicEncoderEncoding_,
util::Statistics::Id::BasicEncoderEncoding },
{ StatisticsCommandLineArgument::AgnosticMemoryNodeProvisioning_,
util::Statistics::Id::AgnosticMemoryNodeProvisioning },
{ StatisticsCommandLineArgument::Annotation_, util::Statistics::Id::Annotation },
{ StatisticsCommandLineArgument::CommonNodeElimination_,
util::Statistics::Id::CommonNodeElimination },
Expand All @@ -200,11 +200,13 @@ JlmOptCommandLineOptions::FromCommandLineArgumentToStatisticsId(
{ StatisticsCommandLineArgument::JlmToRvsdgConversion_,
util::Statistics::Id::JlmToRvsdgConversion },
{ StatisticsCommandLineArgument::LoopUnrolling_, util::Statistics::Id::LoopUnrolling },
{ StatisticsCommandLineArgument::MemoryNodeProvisioning_,
util::Statistics::Id::MemoryNodeProvisioning },
{ StatisticsCommandLineArgument::MemoryStateEncoder_,
util::Statistics::Id::MemoryStateEncoder },
{ StatisticsCommandLineArgument::PullNodes_, util::Statistics::Id::PullNodes },
{ StatisticsCommandLineArgument::PushNodes_, util::Statistics::Id::PushNodes },
{ StatisticsCommandLineArgument::ReduceNodes_, util::Statistics::Id::ReduceNodes },
{ StatisticsCommandLineArgument::RegionAwareMemoryNodeProvisioning_,
util::Statistics::Id::RegionAwareMemoryNodeProvisioning },
{ StatisticsCommandLineArgument::RvsdgConstruction_,
util::Statistics::Id::RvsdgConstruction },
{ StatisticsCommandLineArgument::RvsdgDestruction_,
Expand All @@ -227,11 +229,11 @@ JlmOptCommandLineOptions::ToCommandLineArgument(jlm::util::Statistics::Id statis
{
static std::unordered_map<util::Statistics::Id, const char *> map(
{ { util::Statistics::Id::Aggregation, StatisticsCommandLineArgument::Aggregation_ },
{ util::Statistics::Id::AgnosticMemoryNodeProvisioning,
StatisticsCommandLineArgument::AgnosticMemoryNodeProvisioning_ },
{ util::Statistics::Id::AndersenAnalysis,
StatisticsCommandLineArgument::AndersenAnalysis_ },
{ util::Statistics::Id::Annotation, StatisticsCommandLineArgument::Annotation_ },
{ util::Statistics::Id::BasicEncoderEncoding,
StatisticsCommandLineArgument::BasicEncoderEncoding_ },
{ util::Statistics::Id::CommonNodeElimination,
StatisticsCommandLineArgument::CommonNodeElimination_ },
{ util::Statistics::Id::ControlFlowRecovery,
Expand All @@ -246,11 +248,13 @@ JlmOptCommandLineOptions::ToCommandLineArgument(jlm::util::Statistics::Id statis
{ util::Statistics::Id::JlmToRvsdgConversion,
StatisticsCommandLineArgument::JlmToRvsdgConversion_ },
{ util::Statistics::Id::LoopUnrolling, StatisticsCommandLineArgument::LoopUnrolling_ },
{ util::Statistics::Id::MemoryNodeProvisioning,
StatisticsCommandLineArgument::MemoryNodeProvisioning_ },
{ util::Statistics::Id::MemoryStateEncoder,
StatisticsCommandLineArgument::MemoryStateEncoder_ },
{ util::Statistics::Id::PullNodes, StatisticsCommandLineArgument::PullNodes_ },
{ util::Statistics::Id::PushNodes, StatisticsCommandLineArgument::PushNodes_ },
{ util::Statistics::Id::ReduceNodes, StatisticsCommandLineArgument::ReduceNodes_ },
{ util::Statistics::Id::RegionAwareMemoryNodeProvisioning,
StatisticsCommandLineArgument::RegionAwareMemoryNodeProvisioning_ },
{ util::Statistics::Id::RvsdgConstruction,
StatisticsCommandLineArgument::RvsdgConstruction_ },
{ util::Statistics::Id::RvsdgDestruction,
Expand Down Expand Up @@ -510,9 +514,10 @@ JlcCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
cl::value_desc("value"));

auto aggregationStatisticsId = util::Statistics::Id::Aggregation;
auto agnosticMemoryNodeProvisioningStatisticsId =
util::Statistics::Id::AgnosticMemoryNodeProvisioning;
auto andersenAnalysisStatisticsId = util::Statistics::Id::AndersenAnalysis;
auto annotationStatisticsId = util::Statistics::Id::Annotation;
auto basicEncoderEncodingStatisticsId = util::Statistics::Id::BasicEncoderEncoding;
auto commonNodeEliminationStatisticsId = util::Statistics::Id::CommonNodeElimination;
auto controlFlowRecoveryStatisticsId = util::Statistics::Id::ControlFlowRecovery;
auto dataNodeToDeltaStatisticsId = util::Statistics::Id::DataNodeToDelta;
Expand All @@ -521,10 +526,12 @@ JlcCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
auto invariantValueRedirectionStatisticsId = util::Statistics::Id::InvariantValueRedirection;
auto jlmToRvsdgConversionStatisticsId = util::Statistics::Id::JlmToRvsdgConversion;
auto loopUnrollingStatisticsId = util::Statistics::Id::LoopUnrolling;
auto memoryNodeProvisioningStatisticsId = util::Statistics::Id::MemoryNodeProvisioning;
auto memoryStateEncoderStatisticsId = util::Statistics::Id::MemoryStateEncoder;
auto pullNodesStatisticsId = util::Statistics::Id::PullNodes;
auto pushNodesStatisticsId = util::Statistics::Id::PushNodes;
auto reduceNodesStatisticsId = util::Statistics::Id::ReduceNodes;
auto regionAwareMemoryNodeProvisioningStatisticsId =
util::Statistics::Id::RegionAwareMemoryNodeProvisioning;
auto rvsdgConstructionStatisticsId = util::Statistics::Id::RvsdgConstruction;
auto rvsdgDestructionStatisticsId = util::Statistics::Id::RvsdgDestruction;
auto rvsdgOptimizationStatisticsId = util::Statistics::Id::RvsdgOptimization;
Expand All @@ -538,6 +545,11 @@ JlcCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
aggregationStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(aggregationStatisticsId),
"Collect control flow graph aggregation pass statistics."),
::clEnumValN(
agnosticMemoryNodeProvisioningStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(
agnosticMemoryNodeProvisioningStatisticsId),
"Collect agnostic memory node provisioning pass statistics."),
::clEnumValN(
andersenAnalysisStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(andersenAnalysisStatisticsId),
Expand All @@ -547,8 +559,8 @@ JlcCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
JlmOptCommandLineOptions::ToCommandLineArgument(annotationStatisticsId),
"Collect aggregation tree annotation pass statistics."),
::clEnumValN(
basicEncoderEncodingStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(basicEncoderEncodingStatisticsId),
memoryStateEncoderStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(memoryStateEncoderStatisticsId),
"Collect memory state encoding pass statistics."),
::clEnumValN(
commonNodeEliminationStatisticsId,
Expand Down Expand Up @@ -583,10 +595,6 @@ JlcCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
loopUnrollingStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(loopUnrollingStatisticsId),
"Collect loop unrolling pass statistics."),
::clEnumValN(
memoryNodeProvisioningStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(memoryNodeProvisioningStatisticsId),
"Collect memory node provisioning pass statistics."),
::clEnumValN(
pullNodesStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(pullNodesStatisticsId),
Expand All @@ -599,6 +607,11 @@ JlcCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
reduceNodesStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(reduceNodesStatisticsId),
"Collect node reduction pass statistics."),
::clEnumValN(
regionAwareMemoryNodeProvisioningStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(
regionAwareMemoryNodeProvisioningStatisticsId),
"Collect memory node provisioning pass statistics."),
::clEnumValN(
rvsdgConstructionStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(rvsdgConstructionStatisticsId),
Expand Down Expand Up @@ -769,9 +782,10 @@ JlmOptCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
cl::value_desc("dir"));

auto aggregationStatisticsId = util::Statistics::Id::Aggregation;
auto agnosticMemoryNodeProvisioningStatisticsId =
util::Statistics::Id::AgnosticMemoryNodeProvisioning;
auto andersenAnalysisStatisticsId = util::Statistics::Id::AndersenAnalysis;
auto annotationStatisticsId = util::Statistics::Id::Annotation;
auto basicEncoderEncodingStatisticsId = util::Statistics::Id::BasicEncoderEncoding;
auto commonNodeEliminationStatisticsId = util::Statistics::Id::CommonNodeElimination;
auto controlFlowRecoveryStatisticsId = util::Statistics::Id::ControlFlowRecovery;
auto dataNodeToDeltaStatisticsId = util::Statistics::Id::DataNodeToDelta;
Expand All @@ -780,10 +794,12 @@ JlmOptCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
auto invariantValueRedirectionStatisticsId = util::Statistics::Id::InvariantValueRedirection;
auto jlmToRvsdgConversionStatisticsId = util::Statistics::Id::JlmToRvsdgConversion;
auto loopUnrollingStatisticsId = util::Statistics::Id::LoopUnrolling;
auto memoryNodeProvisioningStatisticsId = util::Statistics::Id::MemoryNodeProvisioning;
auto memoryStateEncoderStatisticsId = util::Statistics::Id::MemoryStateEncoder;
auto pullNodesStatisticsId = util::Statistics::Id::PullNodes;
auto pushNodesStatisticsId = util::Statistics::Id::PushNodes;
auto reduceNodesStatisticsId = util::Statistics::Id::ReduceNodes;
auto regionAwareMemoryNodeProvisioningStatisticsId =
util::Statistics::Id::RegionAwareMemoryNodeProvisioning;
auto rvsdgConstructionStatisticsId = util::Statistics::Id::RvsdgConstruction;
auto rvsdgDestructionStatisticsId = util::Statistics::Id::RvsdgDestruction;
auto rvsdgOptimizationStatisticsId = util::Statistics::Id::RvsdgOptimization;
Expand All @@ -796,6 +812,11 @@ JlmOptCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
aggregationStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(aggregationStatisticsId),
"Write aggregation statistics to file."),
::clEnumValN(
agnosticMemoryNodeProvisioningStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(
agnosticMemoryNodeProvisioningStatisticsId),
"Collect agnostic memory node provisioning pass statistics."),
::clEnumValN(
andersenAnalysisStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(andersenAnalysisStatisticsId),
Expand All @@ -805,8 +826,8 @@ JlmOptCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
JlmOptCommandLineOptions::ToCommandLineArgument(annotationStatisticsId),
"Write annotation statistics to file."),
::clEnumValN(
basicEncoderEncodingStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(basicEncoderEncodingStatisticsId),
memoryStateEncoderStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(memoryStateEncoderStatisticsId),
"Write encoding statistics of basic encoder to file."),
::clEnumValN(
commonNodeEliminationStatisticsId,
Expand Down Expand Up @@ -841,10 +862,6 @@ JlmOptCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
loopUnrollingStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(loopUnrollingStatisticsId),
"Write loop unrolling statistics to file."),
::clEnumValN(
memoryNodeProvisioningStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(memoryNodeProvisioningStatisticsId),
"Write memory node provisioning statistics to file."),
::clEnumValN(
pullNodesStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(pullNodesStatisticsId),
Expand All @@ -857,6 +874,11 @@ JlmOptCommandLineParser::ParseCommandLineArguments(int argc, char ** argv)
reduceNodesStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(reduceNodesStatisticsId),
"Write node reduction statistics to file."),
::clEnumValN(
regionAwareMemoryNodeProvisioningStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(
regionAwareMemoryNodeProvisioningStatisticsId),
"Write memory node provisioning statistics to file."),
::clEnumValN(
rvsdgConstructionStatisticsId,
JlmOptCommandLineOptions::ToCommandLineArgument(rvsdgConstructionStatisticsId),
Expand Down
7 changes: 5 additions & 2 deletions jlm/tooling/CommandLine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ class JlmOptCommandLineOptions final : public CommandLineOptions
struct StatisticsCommandLineArgument
{
inline static const char * Aggregation_ = "print-aggregation-time";
inline static const char * AgnosticMemoryNodeProvisioning_ =
"print-agnostic-memory-node-provisioning";
inline static const char * AndersenAnalysis_ = "print-andersen-analysis";
inline static const char * Annotation_ = "print-annotation-time";
inline static const char * BasicEncoderEncoding_ = "print-basicencoder-encoding";
inline static const char * CommonNodeElimination_ = "print-cne-stat";
inline static const char * ControlFlowRecovery_ = "print-cfr-time";
inline static const char * DataNodeToDelta_ = "printDataNodeToDelta";
Expand All @@ -188,10 +189,12 @@ class JlmOptCommandLineOptions final : public CommandLineOptions
inline static const char * InvariantValueRedirection_ = "printInvariantValueRedirection";
inline static const char * JlmToRvsdgConversion_ = "print-jlm-rvsdg-conversion";
inline static const char * LoopUnrolling_ = "print-unroll-stat";
inline static const char * MemoryNodeProvisioning_ = "print-memory-node-provisioning";
inline static const char * MemoryStateEncoder_ = "print-basicencoder-encoding";
inline static const char * PullNodes_ = "print-pull-stat";
inline static const char * PushNodes_ = "print-push-stat";
inline static const char * ReduceNodes_ = "print-reduction-stat";
inline static const char * RegionAwareMemoryNodeProvisioning_ =
"print-memory-node-provisioning";
inline static const char * RvsdgConstruction_ = "print-rvsdg-construction";
inline static const char * RvsdgDestruction_ = "print-rvsdg-destruction";
inline static const char * RvsdgOptimization_ = "print-rvsdg-optimization";
Expand Down
5 changes: 3 additions & 2 deletions jlm/util/Statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Statistics
FirstEnumValue, // must always be the first enum value, used for iteration

Aggregation,
AgnosticMemoryNodeProvisioning,
Annotation,
BasicEncoderEncoding,
CommonNodeElimination,
ControlFlowRecovery,
DataNodeToDelta,
Expand All @@ -35,10 +35,11 @@ class Statistics
InvariantValueRedirection,
JlmToRvsdgConversion,
LoopUnrolling,
MemoryNodeProvisioning,
MemoryStateEncoder,
PullNodes,
PushNodes,
ReduceNodes,
RegionAwareMemoryNodeProvisioning,
RvsdgConstruction,
RvsdgDestruction,
RvsdgOptimization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ TestStatistics()

jlm::util::StatisticsCollectorSettings statisticsCollectorSettings(
filePath,
{ jlm::util::Statistics::Id::MemoryNodeProvisioning });
{ jlm::util::Statistics::Id::AgnosticMemoryNodeProvisioning });
jlm::util::StatisticsCollector statisticsCollector(statisticsCollectorSettings);

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ TestStatistics()

jlm::util::StatisticsCollectorSettings statisticsCollectorSettings(
filePath,
{ jlm::util::Statistics::Id::MemoryNodeProvisioning });
{ jlm::util::Statistics::Id::RegionAwareMemoryNodeProvisioning });
jlm::util::StatisticsCollector statisticsCollector(statisticsCollectorSettings);

/*
Expand Down
Loading