[llvm] 389bf5d - [llvm-exegesis] Refactor InstructionBenchmark to Benchmark
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 01:15:02 PDT 2023
Author: Aiden Grossman
Date: 2023-03-27T08:14:36Z
New Revision: 389bf5d870b3bc014b004a750c539786eba8c543
URL: https://github.com/llvm/llvm-project/commit/389bf5d870b3bc014b004a750c539786eba8c543
DIFF: https://github.com/llvm/llvm-project/commit/389bf5d870b3bc014b004a750c539786eba8c543.diff
LOG: [llvm-exegesis] Refactor InstructionBenchmark to Benchmark
When llvm-exegesis was first introduced, it only supported benchmarking
individual instructions, hence the name for the data structure storing
the data corresponding to a benchmark being called InstructionBenchmark
made sense. However, now that benchmarking arbitrary snippets is
supported, InstructionBenchmark doesn't correspond to a single
instruction. This patch refactors InstructionBenchmark to be called
Benchmark to clean up this little bit of technical debt.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D146884
Added:
Modified:
llvm/tools/llvm-exegesis/lib/Analysis.cpp
llvm/tools/llvm-exegesis/lib/Analysis.h
llvm/tools/llvm-exegesis/lib/BenchmarkCode.h
llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
llvm/tools/llvm-exegesis/lib/Clustering.cpp
llvm/tools/llvm-exegesis/lib/Clustering.h
llvm/tools/llvm-exegesis/lib/CodeTemplate.h
llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h
llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
llvm/tools/llvm-exegesis/lib/SchedClassResolution.h
llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
llvm/tools/llvm-exegesis/lib/SnippetRepetitor.h
llvm/tools/llvm-exegesis/lib/Target.cpp
llvm/tools/llvm-exegesis/lib/Target.h
llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h
llvm/tools/llvm-exegesis/llvm-exegesis.cpp
llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp
llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp
index 2d7e17fc7399f..f6ee8f6a26a20 100644
--- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp
@@ -71,7 +71,7 @@ void writeEscaped<kEscapeHtmlString>(raw_ostream &OS, const StringRef S) {
template <EscapeTag Tag>
static void
writeClusterId(raw_ostream &OS,
- const InstructionBenchmarkClustering::ClusterId &CID) {
+ const BenchmarkClustering::ClusterId &CID) {
if (CID.isNoise())
writeEscaped<Tag>(OS, "[noise]");
else if (CID.isError())
@@ -126,7 +126,7 @@ void Analysis::writeSnippet(raw_ostream &OS, ArrayRef<uint8_t> Bytes,
// point coordinates (measurements).
void Analysis::printInstructionRowCsv(const size_t PointId,
raw_ostream &OS) const {
- const InstructionBenchmark &Point = Clustering_.getPoints()[PointId];
+ const Benchmark &Point = Clustering_.getPoints()[PointId];
writeClusterId<kEscapeCsv>(OS, Clustering_.getClusterIdForPoint(PointId));
OS << kCsvSep;
writeSnippet<EscapeTag, kEscapeCsv>(OS, Point.AssembledSnippet, "; ");
@@ -153,7 +153,7 @@ void Analysis::printInstructionRowCsv(const size_t PointId,
}
Analysis::Analysis(const LLVMState &State,
- const InstructionBenchmarkClustering &Clustering,
+ const BenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
bool AnalysisDisplayUnstableOpcodes)
: Clustering_(Clustering), State_(State),
@@ -215,7 +215,7 @@ Analysis::makePointsPerSchedClass() const {
std::unordered_map<unsigned, size_t> SchedClassIdToIndex;
const auto &Points = Clustering_.getPoints();
for (size_t PointId = 0, E = Points.size(); PointId < E; ++PointId) {
- const InstructionBenchmark &Point = Points[PointId];
+ const Benchmark &Point = Points[PointId];
if (!Point.Error.empty())
continue;
assert(!Point.Key.Instructions.empty());
@@ -270,17 +270,17 @@ static void writeLatencySnippetHtml(raw_ostream &OS,
}
}
-void Analysis::printPointHtml(const InstructionBenchmark &Point,
+void Analysis::printPointHtml(const Benchmark &Point,
llvm::raw_ostream &OS) const {
OS << "<li><span class=\"mono\" title=\"";
writeSnippet<EscapeTag, kEscapeHtmlString>(OS, Point.AssembledSnippet, "\n");
OS << "\">";
switch (Point.Mode) {
- case InstructionBenchmark::Latency:
+ case Benchmark::Latency:
writeLatencySnippetHtml(OS, Point.Key.Instructions, State_.getInstrInfo());
break;
- case InstructionBenchmark::Uops:
- case InstructionBenchmark::InverseThroughput:
+ case Benchmark::Uops:
+ case Benchmark::InverseThroughput:
writeParallelSnippetHtml(OS, Point.Key.Instructions, State_.getInstrInfo());
break;
default:
@@ -334,7 +334,7 @@ void Analysis::printSchedClassClustersHtml(
}
void Analysis::SchedClassCluster::addPoint(
- size_t PointId, const InstructionBenchmarkClustering &Clustering) {
+ size_t PointId, const BenchmarkClustering &Clustering) {
PointIds.push_back(PointId);
const auto &Point = Clustering.getPoints()[PointId];
if (ClusterId.isUndef())
@@ -346,10 +346,10 @@ void Analysis::SchedClassCluster::addPoint(
bool Analysis::SchedClassCluster::measurementsMatch(
const MCSubtargetInfo &STI, const ResolvedSchedClass &RSC,
- const InstructionBenchmarkClustering &Clustering,
+ const BenchmarkClustering &Clustering,
const double AnalysisInconsistencyEpsilonSquared_) const {
assert(!Clustering.getPoints().empty());
- const InstructionBenchmark::ModeE Mode = Clustering.getPoints()[0].Mode;
+ const Benchmark::ModeE Mode = Clustering.getPoints()[0].Mode;
if (!Centroid.validate(Mode))
return false;
@@ -427,7 +427,7 @@ void Analysis::printSchedClassDescHtml(const ResolvedSchedClass &RSC,
}
void Analysis::printClusterRawHtml(
- const InstructionBenchmarkClustering::ClusterId &Id, StringRef display_name,
+ const BenchmarkClustering::ClusterId &Id, StringRef display_name,
llvm::raw_ostream &OS) const {
const auto &Points = Clustering_.getPoints();
const auto &Cluster = Clustering_.getCluster(Id);
@@ -589,7 +589,7 @@ Error Analysis::run<Analysis::PrintSchedClassInconsistencies>(
OS << "</div>";
}
- printClusterRawHtml(InstructionBenchmarkClustering::ClusterId::noise(),
+ printClusterRawHtml(BenchmarkClustering::ClusterId::noise(),
"[noise]", OS);
OS << "</body></html>";
diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.h b/llvm/tools/llvm-exegesis/lib/Analysis.h
index a903fd2fcdf41..32719251be7be 100644
--- a/llvm/tools/llvm-exegesis/lib/Analysis.h
+++ b/llvm/tools/llvm-exegesis/lib/Analysis.h
@@ -37,7 +37,7 @@ namespace exegesis {
class Analysis {
public:
Analysis(const LLVMState &State,
- const InstructionBenchmarkClustering &Clustering,
+ const BenchmarkClustering &Clustering,
double AnalysisInconsistencyEpsilon,
bool AnalysisDisplayUnstableOpcodes);
@@ -49,19 +49,19 @@ class Analysis {
template <typename Pass> Error run(raw_ostream &OS) const;
private:
- using ClusterId = InstructionBenchmarkClustering::ClusterId;
+ using ClusterId = BenchmarkClustering::ClusterId;
// Represents the intersection of a sched class and a cluster.
class SchedClassCluster {
public:
- const InstructionBenchmarkClustering::ClusterId &id() const {
+ const BenchmarkClustering::ClusterId &id() const {
return ClusterId;
}
const std::vector<size_t> &getPointIds() const { return PointIds; }
void addPoint(size_t PointId,
- const InstructionBenchmarkClustering &Clustering);
+ const BenchmarkClustering &Clustering);
// Return the cluster centroid.
const SchedClassClusterCentroid &getCentroid() const { return Centroid; }
@@ -69,11 +69,11 @@ class Analysis {
// Returns true if the cluster representative measurements match that of SC.
bool
measurementsMatch(const MCSubtargetInfo &STI, const ResolvedSchedClass &SC,
- const InstructionBenchmarkClustering &Clustering,
+ const BenchmarkClustering &Clustering,
const double AnalysisInconsistencyEpsilonSquared_) const;
private:
- InstructionBenchmarkClustering::ClusterId ClusterId;
+ BenchmarkClustering::ClusterId ClusterId;
std::vector<size_t> PointIds;
// Measurement stats for the points in the SchedClassCluster.
SchedClassClusterCentroid Centroid;
@@ -81,10 +81,10 @@ class Analysis {
void printInstructionRowCsv(size_t PointId, raw_ostream &OS) const;
- void printClusterRawHtml(const InstructionBenchmarkClustering::ClusterId &Id,
+ void printClusterRawHtml(const BenchmarkClustering::ClusterId &Id,
StringRef display_name, llvm::raw_ostream &OS) const;
- void printPointHtml(const InstructionBenchmark &Point,
+ void printPointHtml(const Benchmark &Point,
llvm::raw_ostream &OS) const;
void
@@ -110,7 +110,7 @@ class Analysis {
void writeSnippet(raw_ostream &OS, ArrayRef<uint8_t> Bytes,
const char *Separator) const;
- const InstructionBenchmarkClustering &Clustering_;
+ const BenchmarkClustering &Clustering_;
const LLVMState &State_;
std::unique_ptr<MCContext> Context_;
std::unique_ptr<MCAsmInfo> AsmInfo_;
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h b/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h
index 7dceb25b50762..1db8472e99f7c 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h
@@ -19,7 +19,7 @@ namespace exegesis {
// A collection of instructions that are to be assembled, executed and measured.
struct BenchmarkCode {
- InstructionBenchmarkKey Key;
+ BenchmarkKey Key;
// We also need to provide the registers that are live on entry for the
// assembler to generate proper prologue/epilogue.
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
index 673221e5d5a0f..b8e53de57bff2 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp
@@ -209,14 +209,14 @@ template <> struct MappingTraits<exegesis::BenchmarkMeasure> {
};
template <>
-struct ScalarEnumerationTraits<exegesis::InstructionBenchmark::ModeE> {
+struct ScalarEnumerationTraits<exegesis::Benchmark::ModeE> {
static void enumeration(IO &Io,
- exegesis::InstructionBenchmark::ModeE &Value) {
- Io.enumCase(Value, "", exegesis::InstructionBenchmark::Unknown);
- Io.enumCase(Value, "latency", exegesis::InstructionBenchmark::Latency);
- Io.enumCase(Value, "uops", exegesis::InstructionBenchmark::Uops);
+ exegesis::Benchmark::ModeE &Value) {
+ Io.enumCase(Value, "", exegesis::Benchmark::Unknown);
+ Io.enumCase(Value, "latency", exegesis::Benchmark::Latency);
+ Io.enumCase(Value, "uops", exegesis::Benchmark::Uops);
Io.enumCase(Value, "inverse_throughput",
- exegesis::InstructionBenchmark::InverseThroughput);
+ exegesis::Benchmark::InverseThroughput);
}
};
@@ -260,8 +260,8 @@ template <> struct ScalarTraits<exegesis::RegisterValue> {
};
template <>
-struct MappingContextTraits<exegesis::InstructionBenchmarkKey, YamlContext> {
- static void mapping(IO &Io, exegesis::InstructionBenchmarkKey &Obj,
+struct MappingContextTraits<exegesis::BenchmarkKey, YamlContext> {
+ static void mapping(IO &Io, exegesis::BenchmarkKey &Obj,
YamlContext &Context) {
Io.setContext(&Context);
Io.mapRequired("instructions", Obj.Instructions);
@@ -271,7 +271,7 @@ struct MappingContextTraits<exegesis::InstructionBenchmarkKey, YamlContext> {
};
template <>
-struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> {
+struct MappingContextTraits<exegesis::Benchmark, YamlContext> {
struct NormalizedBinary {
NormalizedBinary(IO &io) {}
NormalizedBinary(IO &, std::vector<uint8_t> &Data) : Binary(Data) {}
@@ -288,7 +288,7 @@ struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> {
BinaryRef Binary;
};
- static void mapping(IO &Io, exegesis::InstructionBenchmark &Obj,
+ static void mapping(IO &Io, exegesis::Benchmark &Obj,
YamlContext &Context) {
Io.mapRequired("mode", Obj.Mode);
Io.mapRequired("key", Obj.Key, Context);
@@ -305,9 +305,9 @@ struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> {
}
};
-template <> struct MappingTraits<exegesis::InstructionBenchmark::TripleAndCpu> {
+template <> struct MappingTraits<exegesis::Benchmark::TripleAndCpu> {
static void mapping(IO &Io,
- exegesis::InstructionBenchmark::TripleAndCpu &Obj) {
+ exegesis::Benchmark::TripleAndCpu &Obj) {
assert(!Io.outputting() && "can only read TripleAndCpu");
// Read triple.
Io.mapRequired("llvm_triple", Obj.LLVMTriple);
@@ -320,8 +320,8 @@ template <> struct MappingTraits<exegesis::InstructionBenchmark::TripleAndCpu> {
namespace exegesis {
-Expected<std::set<InstructionBenchmark::TripleAndCpu>>
-InstructionBenchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {
+Expected<std::set<Benchmark::TripleAndCpu>>
+Benchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {
// We're only mapping a field, drop other fields and silence the corresponding
// warnings.
yaml::Input Yin(
@@ -340,11 +340,11 @@ InstructionBenchmark::readTriplesAndCpusFromYamls(MemoryBufferRef Buffer) {
return Result;
}
-Expected<InstructionBenchmark>
-InstructionBenchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {
+Expected<Benchmark>
+Benchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {
yaml::Input Yin(Buffer);
YamlContext Context(State);
- InstructionBenchmark Benchmark;
+ Benchmark Benchmark;
if (Yin.setCurrentDocument())
yaml::yamlize(Yin, Benchmark, /*unused*/ true, Context);
if (!Context.getLastError().empty())
@@ -352,12 +352,12 @@ InstructionBenchmark::readYaml(const LLVMState &State, MemoryBufferRef Buffer) {
return std::move(Benchmark);
}
-Expected<std::vector<InstructionBenchmark>>
-InstructionBenchmark::readYamls(const LLVMState &State,
+Expected<std::vector<Benchmark>>
+Benchmark::readYamls(const LLVMState &State,
MemoryBufferRef Buffer) {
yaml::Input Yin(Buffer);
YamlContext Context(State);
- std::vector<InstructionBenchmark> Benchmarks;
+ std::vector<Benchmark> Benchmarks;
while (Yin.setCurrentDocument()) {
Benchmarks.emplace_back();
yamlize(Yin, Benchmarks.back(), /*unused*/ true, Context);
@@ -370,7 +370,7 @@ InstructionBenchmark::readYamls(const LLVMState &State,
return std::move(Benchmarks);
}
-Error InstructionBenchmark::writeYamlTo(const LLVMState &State,
+Error Benchmark::writeYamlTo(const LLVMState &State,
raw_ostream &OS) {
auto Cleanup = make_scope_exit([&] { OS.flush(); });
yaml::Output Yout(OS, nullptr /*Ctx*/, 200 /*WrapColumn*/);
@@ -383,7 +383,7 @@ Error InstructionBenchmark::writeYamlTo(const LLVMState &State,
return Error::success();
}
-Error InstructionBenchmark::readYamlFrom(const LLVMState &State,
+Error Benchmark::readYamlFrom(const LLVMState &State,
StringRef InputContent) {
yaml::Input Yin(InputContent);
YamlContext Context(State);
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
index a2a8095f429f9..0ad18cee0e725 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
@@ -41,9 +41,9 @@ enum class BenchmarkPhaseSelectorE {
Measure,
};
-enum class InstructionBenchmarkFilter { All, RegOnly, WithMem };
+enum class BenchmarkFilter { All, RegOnly, WithMem };
-struct InstructionBenchmarkKey {
+struct BenchmarkKey {
// The LLVM opcode name.
std::vector<MCInst> Instructions;
// The initial values of the registers.
@@ -68,8 +68,8 @@ struct BenchmarkMeasure {
};
// The result of an instruction benchmark.
-struct InstructionBenchmark {
- InstructionBenchmarkKey Key;
+struct Benchmark {
+ BenchmarkKey Key;
enum ModeE { Unknown, Latency, Uops, InverseThroughput };
ModeE Mode;
std::string CpuName;
@@ -88,18 +88,18 @@ struct InstructionBenchmark {
// How to aggregate measurements.
enum ResultAggregationModeE { Min, Max, Mean, MinVariance };
- InstructionBenchmark() = default;
- InstructionBenchmark(InstructionBenchmark &&) = default;
+ Benchmark() = default;
+ Benchmark(Benchmark &&) = default;
- InstructionBenchmark(const InstructionBenchmark &) = delete;
- InstructionBenchmark &operator=(const InstructionBenchmark &) = delete;
- InstructionBenchmark &operator=(InstructionBenchmark &&) = delete;
+ Benchmark(const Benchmark &) = delete;
+ Benchmark &operator=(const Benchmark &) = delete;
+ Benchmark &operator=(Benchmark &&) = delete;
// Read functions.
- static Expected<InstructionBenchmark> readYaml(const LLVMState &State,
+ static Expected<Benchmark> readYaml(const LLVMState &State,
MemoryBufferRef Buffer);
- static Expected<std::vector<InstructionBenchmark>>
+ static Expected<std::vector<Benchmark>>
readYamls(const LLVMState &State, MemoryBufferRef Buffer);
// Given a set of serialized instruction benchmarks, returns the set of
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index cc53b00ca631f..e268ba7ca757f 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -30,7 +30,7 @@ namespace llvm {
namespace exegesis {
BenchmarkRunner::BenchmarkRunner(const LLVMState &State,
- InstructionBenchmark::ModeE Mode,
+ Benchmark::ModeE Mode,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector)
: State(State), Mode(Mode), BenchmarkPhaseSelector(BenchmarkPhaseSelector),
Scratch(std::make_unique<ScratchSpace>()) {}
@@ -155,7 +155,7 @@ BenchmarkRunner::getRunnableConfiguration(
const SnippetRepetitor &Repetitor) const {
RunnableConfiguration RC;
- InstructionBenchmark &InstrBenchmark = RC.InstrBenchmark;
+ Benchmark &InstrBenchmark = RC.InstrBenchmark;
InstrBenchmark.Mode = Mode;
InstrBenchmark.CpuName = std::string(State.getTargetMachine().getTargetCPU());
InstrBenchmark.LLVMTriple =
@@ -196,10 +196,10 @@ BenchmarkRunner::getRunnableConfiguration(
return std::move(RC);
}
-Expected<InstructionBenchmark>
+Expected<Benchmark>
BenchmarkRunner::runConfiguration(RunnableConfiguration &&RC,
bool DumpObjectToDisk) const {
- InstructionBenchmark &InstrBenchmark = RC.InstrBenchmark;
+ Benchmark &InstrBenchmark = RC.InstrBenchmark;
object::OwningBinary<object::ObjectFile> &ObjectFile = RC.ObjectFile;
if (DumpObjectToDisk &&
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
index ea60eee92339a..a74f347b3a1ef 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
@@ -35,7 +35,7 @@ namespace exegesis {
class BenchmarkRunner {
public:
explicit BenchmarkRunner(const LLVMState &State,
- InstructionBenchmark::ModeE Mode,
+ Benchmark::ModeE Mode,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector);
virtual ~BenchmarkRunner();
@@ -54,7 +54,7 @@ class BenchmarkRunner {
private:
RunnableConfiguration() = default;
- InstructionBenchmark InstrBenchmark;
+ Benchmark InstrBenchmark;
object::OwningBinary<object::ObjectFile> ObjectFile;
};
@@ -63,7 +63,7 @@ class BenchmarkRunner {
unsigned NumRepetitions, unsigned LoopUnrollFactor,
const SnippetRepetitor &Repetitor) const;
- Expected<InstructionBenchmark> runConfiguration(RunnableConfiguration &&RC,
+ Expected<Benchmark> runConfiguration(RunnableConfiguration &&RC,
bool DumpObjectToDisk) const;
// Scratch space to run instructions that touch memory.
@@ -97,7 +97,7 @@ class BenchmarkRunner {
protected:
const LLVMState &State;
- const InstructionBenchmark::ModeE Mode;
+ const Benchmark::ModeE Mode;
const BenchmarkPhaseSelectorE BenchmarkPhaseSelector;
private:
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
index f91d6fc82efc4..c7024629426cc 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
@@ -39,7 +39,7 @@ namespace exegesis {
// Finds the points at distance less than sqrt(EpsilonSquared) of Q (not
// including Q).
-void InstructionBenchmarkClustering::rangeQuery(
+void BenchmarkClustering::rangeQuery(
const size_t Q, std::vector<size_t> &Neighbors) const {
Neighbors.clear();
Neighbors.reserve(Points_.size() - 1); // The Q itself isn't a neighbor.
@@ -59,7 +59,7 @@ void InstructionBenchmarkClustering::rangeQuery(
// Given a set of points, checks that all the points are neighbours
// up to AnalysisClusteringEpsilon. This is O(2*N).
-bool InstructionBenchmarkClustering::areAllNeighbours(
+bool BenchmarkClustering::areAllNeighbours(
ArrayRef<size_t> Pts) const {
// First, get the centroid of this group of points. This is O(N).
SchedClassClusterCentroid G;
@@ -88,14 +88,14 @@ bool InstructionBenchmarkClustering::areAllNeighbours(
});
}
-InstructionBenchmarkClustering::InstructionBenchmarkClustering(
- const std::vector<InstructionBenchmark> &Points,
+BenchmarkClustering::BenchmarkClustering(
+ const std::vector<Benchmark> &Points,
const double AnalysisClusteringEpsilonSquared)
: Points_(Points),
AnalysisClusteringEpsilonSquared_(AnalysisClusteringEpsilonSquared),
NoiseCluster_(ClusterId::noise()), ErrorCluster_(ClusterId::error()) {}
-Error InstructionBenchmarkClustering::validateAndSetup() {
+Error BenchmarkClustering::validateAndSetup() {
ClusterIdForPoint_.resize(Points_.size());
// Mark erroneous measurements out.
// All points must have the same number of dimensions, in the same order.
@@ -128,7 +128,7 @@ Error InstructionBenchmarkClustering::validateAndSetup() {
return Error::success();
}
-void InstructionBenchmarkClustering::clusterizeDbScan(const size_t MinPts) {
+void BenchmarkClustering::clusterizeDbScan(const size_t MinPts) {
std::vector<size_t> Neighbors; // Persistent buffer to avoid allocs.
for (size_t P = 0, NumPoints = Points_.size(); P < NumPoints; ++P) {
if (!ClusterIdForPoint_[P].isUndef())
@@ -185,7 +185,7 @@ void InstructionBenchmarkClustering::clusterizeDbScan(const size_t MinPts) {
}
}
-void InstructionBenchmarkClustering::clusterizeNaive(
+void BenchmarkClustering::clusterizeNaive(
const MCSubtargetInfo &SubtargetInfo, const MCInstrInfo &InstrInfo) {
// Given an instruction Opcode, which sched class id's are represented,
// and which are the benchmarks for each sched class?
@@ -195,7 +195,7 @@ void InstructionBenchmarkClustering::clusterizeNaive(
OpcodeToSchedClassesToPoints.resize(NumOpcodes);
size_t NumClusters = 0;
for (size_t P = 0, NumPoints = Points_.size(); P < NumPoints; ++P) {
- const InstructionBenchmark &Point = Points_[P];
+ const Benchmark &Point = Points_[P];
const MCInst &MCI = Point.keyInstruction();
unsigned SchedClassId;
std::tie(SchedClassId, std::ignore) =
@@ -249,11 +249,11 @@ void InstructionBenchmarkClustering::clusterizeNaive(
// clustered into *
diff erent* clusters. This is not great for further analysis.
// We shall find every opcode with benchmarks not in just one cluster, and move
// *all* the benchmarks of said Opcode into one new unstable cluster per Opcode.
-void InstructionBenchmarkClustering::stabilize(unsigned NumOpcodes) {
+void BenchmarkClustering::stabilize(unsigned NumOpcodes) {
// Given an instruction Opcode and Config, in which clusters do benchmarks of
// this instruction lie? Normally, they all should be in the same cluster.
struct OpcodeAndConfig {
- explicit OpcodeAndConfig(const InstructionBenchmark &IB)
+ explicit OpcodeAndConfig(const Benchmark &IB)
: Opcode(IB.keyInstruction().getOpcode()), Config(&IB.Key.Config) {}
unsigned Opcode;
const std::string *Config;
@@ -327,11 +327,11 @@ void InstructionBenchmarkClustering::stabilize(unsigned NumOpcodes) {
}
}
-Expected<InstructionBenchmarkClustering> InstructionBenchmarkClustering::create(
- const std::vector<InstructionBenchmark> &Points, const ModeE Mode,
+Expected<BenchmarkClustering> BenchmarkClustering::create(
+ const std::vector<Benchmark> &Points, const ModeE Mode,
const size_t DbscanMinPts, const double AnalysisClusteringEpsilon,
const MCSubtargetInfo *SubtargetInfo, const MCInstrInfo *InstrInfo) {
- InstructionBenchmarkClustering Clustering(
+ BenchmarkClustering Clustering(
Points, AnalysisClusteringEpsilon * AnalysisClusteringEpsilon);
if (auto Error = Clustering.validateAndSetup()) {
return std::move(Error);
@@ -373,10 +373,10 @@ std::vector<BenchmarkMeasure> SchedClassClusterCentroid::getAsPoint() const {
}
bool SchedClassClusterCentroid::validate(
- InstructionBenchmark::ModeE Mode) const {
+ Benchmark::ModeE Mode) const {
size_t NumMeasurements = Representative.size();
switch (Mode) {
- case InstructionBenchmark::Latency:
+ case Benchmark::Latency:
if (NumMeasurements != 1) {
errs()
<< "invalid number of measurements in latency mode: expected 1, got "
@@ -384,10 +384,10 @@ bool SchedClassClusterCentroid::validate(
return false;
}
break;
- case InstructionBenchmark::Uops:
+ case Benchmark::Uops:
// Can have many measurements.
break;
- case InstructionBenchmark::InverseThroughput:
+ case Benchmark::InverseThroughput:
if (NumMeasurements != 1) {
errs() << "invalid number of measurements in inverse throughput "
"mode: expected 1, got "
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.h b/llvm/tools/llvm-exegesis/lib/Clustering.h
index 8d8570b0c89ce..9d6c110e2e854 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.h
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.h
@@ -22,14 +22,14 @@
namespace llvm {
namespace exegesis {
-class InstructionBenchmarkClustering {
+class BenchmarkClustering {
public:
enum ModeE { Dbscan, Naive };
// Clusters `Points` using DBSCAN with the given parameters. See the cc file
// for more explanations on the algorithm.
- static Expected<InstructionBenchmarkClustering>
- create(const std::vector<InstructionBenchmark> &Points, ModeE Mode,
+ static Expected<BenchmarkClustering>
+ create(const std::vector<Benchmark> &Points, ModeE Mode,
size_t DbscanMinPts, double AnalysisClusteringEpsilon,
const MCSubtargetInfo *SubtargetInfo = nullptr,
const MCInstrInfo *InstrInfo = nullptr);
@@ -91,7 +91,7 @@ class InstructionBenchmarkClustering {
return ClusterIdForPoint_[P];
}
- const std::vector<InstructionBenchmark> &getPoints() const { return Points_; }
+ const std::vector<Benchmark> &getPoints() const { return Points_; }
const Cluster &getCluster(ClusterId Id) const {
assert(!Id.isUndef() && "unlabeled cluster");
@@ -119,8 +119,8 @@ class InstructionBenchmarkClustering {
}
private:
- InstructionBenchmarkClustering(
- const std::vector<InstructionBenchmark> &Points,
+ BenchmarkClustering(
+ const std::vector<Benchmark> &Points,
double AnalysisClusteringEpsilonSquared);
Error validateAndSetup();
@@ -136,7 +136,7 @@ class InstructionBenchmarkClustering {
bool areAllNeighbours(ArrayRef<size_t> Pts) const;
- const std::vector<InstructionBenchmark> &Points_;
+ const std::vector<Benchmark> &Points_;
const double AnalysisClusteringEpsilonSquared_;
int NumDimensions_ = 0;
@@ -157,7 +157,7 @@ class SchedClassClusterCentroid {
void addPoint(ArrayRef<BenchmarkMeasure> Point);
- bool validate(InstructionBenchmark::ModeE Mode) const;
+ bool validate(Benchmark::ModeE Mode) const;
private:
// Measurement stats for the points in the SchedClassCluster.
diff --git a/llvm/tools/llvm-exegesis/lib/CodeTemplate.h b/llvm/tools/llvm-exegesis/lib/CodeTemplate.h
index 16982f9253da6..7aca224302a1f 100644
--- a/llvm/tools/llvm-exegesis/lib/CodeTemplate.h
+++ b/llvm/tools/llvm-exegesis/lib/CodeTemplate.h
@@ -123,7 +123,7 @@ struct CodeTemplate {
CodeTemplate clone() const;
ExecutionMode Execution = ExecutionMode::UNKNOWN;
- // See InstructionBenchmarkKey.::Config.
+ // See BenchmarkKey.::Config.
std::string Config;
// Some information about how this template has been created.
std::string Info;
diff --git a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
index d57ee146d2a0b..18c0671c0f2e9 100644
--- a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
@@ -19,12 +19,12 @@ namespace llvm {
namespace exegesis {
LatencyBenchmarkRunner::LatencyBenchmarkRunner(
- const LLVMState &State, InstructionBenchmark::ModeE Mode,
+ const LLVMState &State, Benchmark::ModeE Mode,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAgg)
+ Benchmark::ResultAggregationModeE ResultAgg)
: BenchmarkRunner(State, Mode, BenchmarkPhaseSelector) {
- assert((Mode == InstructionBenchmark::Latency ||
- Mode == InstructionBenchmark::InverseThroughput) &&
+ assert((Mode == Benchmark::Latency ||
+ Mode == Benchmark::InverseThroughput) &&
"invalid mode");
ResultAggMode = ResultAgg;
}
@@ -94,10 +94,10 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
std::string ModeName;
switch (Mode) {
- case InstructionBenchmark::Latency:
+ case Benchmark::Latency:
ModeName = "latency";
break;
- case InstructionBenchmark::InverseThroughput:
+ case Benchmark::InverseThroughput:
ModeName = "inverse_throughput";
break;
default:
@@ -105,7 +105,7 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
}
switch (ResultAggMode) {
- case InstructionBenchmark::MinVariance: {
+ case Benchmark::MinVariance: {
if (ValuesCount == 1)
llvm::errs() << "Each sample only has one value. result-aggregation-mode "
"of min-variance is probably non-sensical\n";
@@ -115,19 +115,19 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
Result.push_back(BenchmarkMeasure::Create(ModeName, Value));
return std::move(Result);
}
- case InstructionBenchmark::Min: {
+ case Benchmark::Min: {
std::vector<BenchmarkMeasure> Result;
Result.push_back(
BenchmarkMeasure::Create(ModeName, findMin(AccumulatedValues)));
return std::move(Result);
}
- case InstructionBenchmark::Max: {
+ case Benchmark::Max: {
std::vector<BenchmarkMeasure> Result;
Result.push_back(
BenchmarkMeasure::Create(ModeName, findMax(AccumulatedValues)));
return std::move(Result);
}
- case InstructionBenchmark::Mean: {
+ case Benchmark::Mean: {
std::vector<BenchmarkMeasure> Result;
Result.push_back(
BenchmarkMeasure::Create(ModeName, findMean(AccumulatedValues)));
diff --git a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h
index d7d1fa96d20ec..cd06d00fd74cc 100644
--- a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h
+++ b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h
@@ -22,16 +22,16 @@ namespace exegesis {
class LatencyBenchmarkRunner : public BenchmarkRunner {
public:
LatencyBenchmarkRunner(
- const LLVMState &State, InstructionBenchmark::ModeE Mode,
+ const LLVMState &State, Benchmark::ModeE Mode,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAggMode);
+ Benchmark::ResultAggregationModeE ResultAggMode);
~LatencyBenchmarkRunner() override;
private:
Expected<std::vector<BenchmarkMeasure>>
runMeasurements(const FunctionExecutor &Executor) const override;
- InstructionBenchmark::ResultAggregationModeE ResultAggMode;
+ Benchmark::ResultAggregationModeE ResultAggMode;
};
} // namespace exegesis
} // namespace llvm
diff --git a/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp b/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
index 6ed327fc0c8f0..bd4e54290ea97 100644
--- a/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
@@ -280,13 +280,13 @@ static unsigned findProcResIdx(const MCSubtargetInfo &STI,
}
std::vector<BenchmarkMeasure> ResolvedSchedClass::getAsPoint(
- InstructionBenchmark::ModeE Mode, const MCSubtargetInfo &STI,
+ Benchmark::ModeE Mode, const MCSubtargetInfo &STI,
ArrayRef<PerInstructionStats> Representative) const {
const size_t NumMeasurements = Representative.size();
std::vector<BenchmarkMeasure> SchedClassPoint(NumMeasurements);
- if (Mode == InstructionBenchmark::Latency) {
+ if (Mode == Benchmark::Latency) {
assert(NumMeasurements == 1 && "Latency is a single measure.");
BenchmarkMeasure &LatencyMeasure = SchedClassPoint[0];
@@ -299,7 +299,7 @@ std::vector<BenchmarkMeasure> ResolvedSchedClass::getAsPoint(
LatencyMeasure.PerInstructionValue =
std::max<double>(LatencyMeasure.PerInstructionValue, WLE->Cycles);
}
- } else if (Mode == InstructionBenchmark::Uops) {
+ } else if (Mode == Benchmark::Uops) {
for (auto I : zip(SchedClassPoint, Representative)) {
BenchmarkMeasure &Measure = std::get<0>(I);
const PerInstructionStats &Stats = std::get<1>(I);
@@ -326,7 +326,7 @@ std::vector<BenchmarkMeasure> ResolvedSchedClass::getAsPoint(
return {};
}
}
- } else if (Mode == InstructionBenchmark::InverseThroughput) {
+ } else if (Mode == Benchmark::InverseThroughput) {
assert(NumMeasurements == 1 && "Inverse Throughput is a single measure.");
BenchmarkMeasure &RThroughputMeasure = SchedClassPoint[0];
diff --git a/llvm/tools/llvm-exegesis/lib/SchedClassResolution.h b/llvm/tools/llvm-exegesis/lib/SchedClassResolution.h
index 3c7d8b3190b29..2347449b8f23d 100644
--- a/llvm/tools/llvm-exegesis/lib/SchedClassResolution.h
+++ b/llvm/tools/llvm-exegesis/lib/SchedClassResolution.h
@@ -45,7 +45,7 @@ struct ResolvedSchedClass {
const MCInstrInfo &InstrInfo, const MCInst &MCI);
std::vector<BenchmarkMeasure>
- getAsPoint(InstructionBenchmark::ModeE Mode, const MCSubtargetInfo &STI,
+ getAsPoint(Benchmark::ModeE Mode, const MCSubtargetInfo &STI,
ArrayRef<PerInstructionStats> Representative) const;
const unsigned SchedClassId;
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
index bf05131e762d9..7112d3290f2de 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp
@@ -131,14 +131,14 @@ class LoopSnippetRepetitor : public SnippetRepetitor {
SnippetRepetitor::~SnippetRepetitor() {}
std::unique_ptr<const SnippetRepetitor>
-SnippetRepetitor::Create(InstructionBenchmark::RepetitionModeE Mode,
+SnippetRepetitor::Create(Benchmark::RepetitionModeE Mode,
const LLVMState &State) {
switch (Mode) {
- case InstructionBenchmark::Duplicate:
+ case Benchmark::Duplicate:
return std::make_unique<DuplicateSnippetRepetitor>(State);
- case InstructionBenchmark::Loop:
+ case Benchmark::Loop:
return std::make_unique<LoopSnippetRepetitor>(State);
- case InstructionBenchmark::AggregateMin:
+ case Benchmark::AggregateMin:
break;
}
llvm_unreachable("Unknown RepetitionModeE enum");
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.h b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.h
index 239fa25408d22..6f70633c77f82 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.h
+++ b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.h
@@ -29,7 +29,7 @@ namespace exegesis {
class SnippetRepetitor {
public:
static std::unique_ptr<const SnippetRepetitor>
- Create(InstructionBenchmark::RepetitionModeE Mode, const LLVMState &State);
+ Create(Benchmark::RepetitionModeE Mode, const LLVMState &State);
virtual ~SnippetRepetitor();
diff --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp
index f12444af68b55..4717f9f7fa8d3 100644
--- a/llvm/tools/llvm-exegesis/lib/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Target.cpp
@@ -57,15 +57,15 @@ void ExegesisTarget::registerTarget(ExegesisTarget *Target) {
}
std::unique_ptr<SnippetGenerator> ExegesisTarget::createSnippetGenerator(
- InstructionBenchmark::ModeE Mode, const LLVMState &State,
+ Benchmark::ModeE Mode, const LLVMState &State,
const SnippetGenerator::Options &Opts) const {
switch (Mode) {
- case InstructionBenchmark::Unknown:
+ case Benchmark::Unknown:
return nullptr;
- case InstructionBenchmark::Latency:
+ case Benchmark::Latency:
return createSerialSnippetGenerator(State, Opts);
- case InstructionBenchmark::Uops:
- case InstructionBenchmark::InverseThroughput:
+ case Benchmark::Uops:
+ case Benchmark::InverseThroughput:
return createParallelSnippetGenerator(State, Opts);
}
return nullptr;
@@ -73,18 +73,18 @@ std::unique_ptr<SnippetGenerator> ExegesisTarget::createSnippetGenerator(
Expected<std::unique_ptr<BenchmarkRunner>>
ExegesisTarget::createBenchmarkRunner(
- InstructionBenchmark::ModeE Mode, const LLVMState &State,
+ Benchmark::ModeE Mode, const LLVMState &State,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAggMode) const {
+ Benchmark::ResultAggregationModeE ResultAggMode) const {
PfmCountersInfo PfmCounters = State.getPfmCounters();
switch (Mode) {
- case InstructionBenchmark::Unknown:
+ case Benchmark::Unknown:
return nullptr;
- case InstructionBenchmark::Latency:
- case InstructionBenchmark::InverseThroughput:
+ case Benchmark::Latency:
+ case Benchmark::InverseThroughput:
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure &&
!PfmCounters.CycleCounter) {
- const char *ModeName = Mode == InstructionBenchmark::Latency
+ const char *ModeName = Mode == Benchmark::Latency
? "latency"
: "inverse_throughput";
return make_error<Failure>(
@@ -97,7 +97,7 @@ ExegesisTarget::createBenchmarkRunner(
}
return createLatencyBenchmarkRunner(State, Mode, BenchmarkPhaseSelector,
ResultAggMode);
- case InstructionBenchmark::Uops:
+ case Benchmark::Uops:
if (BenchmarkPhaseSelector == BenchmarkPhaseSelectorE::Measure &&
!PfmCounters.UopsCounter && !PfmCounters.IssueCounters)
return make_error<Failure>(
@@ -121,16 +121,16 @@ std::unique_ptr<SnippetGenerator> ExegesisTarget::createParallelSnippetGenerator
}
std::unique_ptr<BenchmarkRunner> ExegesisTarget::createLatencyBenchmarkRunner(
- const LLVMState &State, InstructionBenchmark::ModeE Mode,
+ const LLVMState &State, Benchmark::ModeE Mode,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAggMode) const {
+ Benchmark::ResultAggregationModeE ResultAggMode) const {
return std::make_unique<LatencyBenchmarkRunner>(
State, Mode, BenchmarkPhaseSelector, ResultAggMode);
}
std::unique_ptr<BenchmarkRunner> ExegesisTarget::createUopsBenchmarkRunner(
const LLVMState &State, BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE /*unused*/) const {
+ Benchmark::ResultAggregationModeE /*unused*/) const {
return std::make_unique<UopsBenchmarkRunner>(State, BenchmarkPhaseSelector);
}
diff --git a/llvm/tools/llvm-exegesis/lib/Target.h b/llvm/tools/llvm-exegesis/lib/Target.h
index 7669b6c8e3a2d..9f21122a03b03 100644
--- a/llvm/tools/llvm-exegesis/lib/Target.h
+++ b/llvm/tools/llvm-exegesis/lib/Target.h
@@ -154,15 +154,15 @@ class ExegesisTarget {
// Creates a snippet generator for the given mode.
std::unique_ptr<SnippetGenerator>
- createSnippetGenerator(InstructionBenchmark::ModeE Mode,
+ createSnippetGenerator(Benchmark::ModeE Mode,
const LLVMState &State,
const SnippetGenerator::Options &Opts) const;
// Creates a benchmark runner for the given mode.
Expected<std::unique_ptr<BenchmarkRunner>> createBenchmarkRunner(
- InstructionBenchmark::ModeE Mode, const LLVMState &State,
+ Benchmark::ModeE Mode, const LLVMState &State,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAggMode =
- InstructionBenchmark::Min) const;
+ Benchmark::ResultAggregationModeE ResultAggMode =
+ Benchmark::Min) const;
// Returns the ExegesisTarget for the given triple or nullptr if the target
// does not exist.
@@ -198,12 +198,12 @@ class ExegesisTarget {
std::unique_ptr<SnippetGenerator> virtual createParallelSnippetGenerator(
const LLVMState &State, const SnippetGenerator::Options &Opts) const;
std::unique_ptr<BenchmarkRunner> virtual createLatencyBenchmarkRunner(
- const LLVMState &State, InstructionBenchmark::ModeE Mode,
+ const LLVMState &State, Benchmark::ModeE Mode,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAggMode) const;
+ Benchmark::ResultAggregationModeE ResultAggMode) const;
std::unique_ptr<BenchmarkRunner> virtual createUopsBenchmarkRunner(
const LLVMState &State, BenchmarkPhaseSelectorE BenchmarkPhaseSelector,
- InstructionBenchmark::ResultAggregationModeE ResultAggMode) const;
+ Benchmark::ResultAggregationModeE ResultAggMode) const;
const ExegesisTarget *Next = nullptr;
const ArrayRef<CpuAndPfmCounters> CpuPfmCounters;
diff --git a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h
index c726944f4f5a7..e08eaa7706dd2 100644
--- a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h
+++ b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h
@@ -23,7 +23,7 @@ class UopsBenchmarkRunner : public BenchmarkRunner {
public:
UopsBenchmarkRunner(const LLVMState &State,
BenchmarkPhaseSelectorE BenchmarkPhaseSelector)
- : BenchmarkRunner(State, InstructionBenchmark::Uops,
+ : BenchmarkRunner(State, Benchmark::Uops,
BenchmarkPhaseSelector) {}
~UopsBenchmarkRunner() override;
diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 4e260e0cca165..06ae924bb9b26 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -69,47 +69,47 @@ static cl::opt<std::string>
"results. “-” uses stdin/stdout."),
cl::cat(Options), cl::init(""));
-static cl::opt<exegesis::InstructionBenchmark::ModeE> BenchmarkMode(
+static cl::opt<exegesis::Benchmark::ModeE> BenchmarkMode(
"mode", cl::desc("the mode to run"), cl::cat(Options),
- cl::values(clEnumValN(exegesis::InstructionBenchmark::Latency, "latency",
+ cl::values(clEnumValN(exegesis::Benchmark::Latency, "latency",
"Instruction Latency"),
- clEnumValN(exegesis::InstructionBenchmark::InverseThroughput,
+ clEnumValN(exegesis::Benchmark::InverseThroughput,
"inverse_throughput",
"Instruction Inverse Throughput"),
- clEnumValN(exegesis::InstructionBenchmark::Uops, "uops",
+ clEnumValN(exegesis::Benchmark::Uops, "uops",
"Uop Decomposition"),
// When not asking for a specific benchmark mode,
// we'll analyse the results.
- clEnumValN(exegesis::InstructionBenchmark::Unknown, "analysis",
+ clEnumValN(exegesis::Benchmark::Unknown, "analysis",
"Analysis")));
-static cl::opt<exegesis::InstructionBenchmark::ResultAggregationModeE>
+static cl::opt<exegesis::Benchmark::ResultAggregationModeE>
ResultAggMode(
"result-aggregation-mode",
cl::desc("How to aggregate multi-values result"),
cl::cat(BenchmarkOptions),
- cl::values(clEnumValN(exegesis::InstructionBenchmark::Min, "min",
+ cl::values(clEnumValN(exegesis::Benchmark::Min, "min",
"Keep min reading"),
- clEnumValN(exegesis::InstructionBenchmark::Max, "max",
+ clEnumValN(exegesis::Benchmark::Max, "max",
"Keep max reading"),
- clEnumValN(exegesis::InstructionBenchmark::Mean, "mean",
+ clEnumValN(exegesis::Benchmark::Mean, "mean",
"Compute mean of all readings"),
- clEnumValN(exegesis::InstructionBenchmark::MinVariance,
+ clEnumValN(exegesis::Benchmark::MinVariance,
"min-variance",
"Keep readings set with min-variance")),
- cl::init(exegesis::InstructionBenchmark::Min));
+ cl::init(exegesis::Benchmark::Min));
-static cl::opt<exegesis::InstructionBenchmark::RepetitionModeE> RepetitionMode(
+static cl::opt<exegesis::Benchmark::RepetitionModeE> RepetitionMode(
"repetition-mode", cl::desc("how to repeat the instruction snippet"),
cl::cat(BenchmarkOptions),
cl::values(
- clEnumValN(exegesis::InstructionBenchmark::Duplicate, "duplicate",
+ clEnumValN(exegesis::Benchmark::Duplicate, "duplicate",
"Duplicate the snippet"),
- clEnumValN(exegesis::InstructionBenchmark::Loop, "loop",
+ clEnumValN(exegesis::Benchmark::Loop, "loop",
"Loop over the snippet"),
- clEnumValN(exegesis::InstructionBenchmark::AggregateMin, "min",
+ clEnumValN(exegesis::Benchmark::AggregateMin, "min",
"All of the above and take the minimum of measurements")),
- cl::init(exegesis::InstructionBenchmark::Duplicate));
+ cl::init(exegesis::Benchmark::Duplicate));
static cl::opt<bool> BenchmarkMeasurementsPrintProgress(
"measurements-print-progress",
@@ -163,27 +163,27 @@ static cl::opt<bool> IgnoreInvalidSchedClass(
cl::desc("ignore instructions that do not define a sched class"),
cl::cat(BenchmarkOptions), cl::init(false));
-static cl::opt<exegesis::InstructionBenchmarkFilter> AnalysisSnippetFilter(
+static cl::opt<exegesis::BenchmarkFilter> AnalysisSnippetFilter(
"analysis-filter", cl::desc("Filter the benchmarks before analysing them"),
cl::cat(BenchmarkOptions),
cl::values(
- clEnumValN(exegesis::InstructionBenchmarkFilter::All, "all",
+ clEnumValN(exegesis::BenchmarkFilter::All, "all",
"Keep all benchmarks (default)"),
- clEnumValN(exegesis::InstructionBenchmarkFilter::RegOnly, "reg-only",
+ clEnumValN(exegesis::BenchmarkFilter::RegOnly, "reg-only",
"Keep only those benchmarks that do *NOT* involve memory"),
- clEnumValN(exegesis::InstructionBenchmarkFilter::WithMem, "mem-only",
+ clEnumValN(exegesis::BenchmarkFilter::WithMem, "mem-only",
"Keep only the benchmarks that *DO* involve memory")),
- cl::init(exegesis::InstructionBenchmarkFilter::All));
+ cl::init(exegesis::BenchmarkFilter::All));
-static cl::opt<exegesis::InstructionBenchmarkClustering::ModeE>
+static cl::opt<exegesis::BenchmarkClustering::ModeE>
AnalysisClusteringAlgorithm(
"analysis-clustering", cl::desc("the clustering algorithm to use"),
cl::cat(AnalysisOptions),
- cl::values(clEnumValN(exegesis::InstructionBenchmarkClustering::Dbscan,
+ cl::values(clEnumValN(exegesis::BenchmarkClustering::Dbscan,
"dbscan", "use DBSCAN/OPTICS algorithm"),
- clEnumValN(exegesis::InstructionBenchmarkClustering::Naive,
+ clEnumValN(exegesis::BenchmarkClustering::Naive,
"naive", "one cluster per opcode")),
- cl::init(exegesis::InstructionBenchmarkClustering::Dbscan));
+ cl::init(exegesis::BenchmarkClustering::Dbscan));
static cl::opt<unsigned> AnalysisDbscanNumPoints(
"analysis-numpoints",
@@ -369,7 +369,7 @@ static void runBenchmarkConfigurations(
Meter.emplace(Configurations.size());
for (const BenchmarkCode &Conf : Configurations) {
ProgressMeter<>::ProgressMeterStep MeterStep(Meter ? &*Meter : nullptr);
- SmallVector<InstructionBenchmark, 2> AllResults;
+ SmallVector<Benchmark, 2> AllResults;
for (const std::unique_ptr<const SnippetRepetitor> &Repetitor :
Repetitors) {
@@ -378,18 +378,18 @@ static void runBenchmarkConfigurations(
AllResults.emplace_back(
ExitOnErr(Runner.runConfiguration(std::move(RC), DumpObjectToDisk)));
}
- InstructionBenchmark &Result = AllResults.front();
+ Benchmark &Result = AllResults.front();
// If any of our measurements failed, pretend they all have failed.
if (AllResults.size() > 1 &&
- any_of(AllResults, [](const InstructionBenchmark &R) {
+ any_of(AllResults, [](const Benchmark &R) {
return R.Measurements.empty();
}))
Result.Measurements.clear();
- if (RepetitionMode == InstructionBenchmark::RepetitionModeE::AggregateMin) {
- for (const InstructionBenchmark &OtherResult :
- ArrayRef<InstructionBenchmark>(AllResults).drop_front()) {
+ if (RepetitionMode == Benchmark::RepetitionModeE::AggregateMin) {
+ for (const Benchmark &OtherResult :
+ ArrayRef<Benchmark>(AllResults).drop_front()) {
llvm::append_range(Result.AssembledSnippet,
OtherResult.AssembledSnippet);
// Aggregate measurements, but only iff all measurements succeeded.
@@ -449,12 +449,12 @@ void benchmarkMain() {
const auto Opcodes = getOpcodesOrDie(State);
SmallVector<std::unique_ptr<const SnippetRepetitor>, 2> Repetitors;
- if (RepetitionMode != InstructionBenchmark::RepetitionModeE::AggregateMin)
+ if (RepetitionMode != Benchmark::RepetitionModeE::AggregateMin)
Repetitors.emplace_back(SnippetRepetitor::Create(RepetitionMode, State));
else {
- for (InstructionBenchmark::RepetitionModeE RepMode :
- {InstructionBenchmark::RepetitionModeE::Duplicate,
- InstructionBenchmark::RepetitionModeE::Loop})
+ for (Benchmark::RepetitionModeE RepMode :
+ {Benchmark::RepetitionModeE::Duplicate,
+ Benchmark::RepetitionModeE::Loop})
Repetitors.emplace_back(SnippetRepetitor::Create(RepMode, State));
}
@@ -526,14 +526,14 @@ static void maybeRunAnalysis(const Analysis &Analyzer, const std::string &Name,
ExitOnFileError(OutputFilename, std::move(Err));
}
-static void filterPoints(MutableArrayRef<InstructionBenchmark> Points,
+static void filterPoints(MutableArrayRef<Benchmark> Points,
const MCInstrInfo &MCII) {
- if (AnalysisSnippetFilter == exegesis::InstructionBenchmarkFilter::All)
+ if (AnalysisSnippetFilter == exegesis::BenchmarkFilter::All)
return;
bool WantPointsWithMemOps =
- AnalysisSnippetFilter == exegesis::InstructionBenchmarkFilter::WithMem;
- for (InstructionBenchmark &Point : Points) {
+ AnalysisSnippetFilter == exegesis::BenchmarkFilter::WithMem;
+ for (Benchmark &Point : Points) {
if (!Point.Error.empty())
continue;
if (WantPointsWithMemOps ==
@@ -568,7 +568,7 @@ static void analysisMain() {
const auto TriplesAndCpus = ExitOnFileError(
BenchmarkFile,
- InstructionBenchmark::readTriplesAndCpusFromYamls(*MemoryBuffer));
+ Benchmark::readTriplesAndCpusFromYamls(*MemoryBuffer));
if (TriplesAndCpus.empty()) {
errs() << "no benchmarks to analyze\n";
return;
@@ -591,8 +591,8 @@ static void analysisMain() {
// Read benchmarks.
const LLVMState State = ExitOnErr(
LLVMState::Create(TripleAndCpu.LLVMTriple, TripleAndCpu.CpuName));
- std::vector<InstructionBenchmark> Points = ExitOnFileError(
- BenchmarkFile, InstructionBenchmark::readYamls(State, *MemoryBuffer));
+ std::vector<Benchmark> Points = ExitOnFileError(
+ BenchmarkFile, Benchmark::readYamls(State, *MemoryBuffer));
outs() << "Parsed " << Points.size() << " benchmark points\n";
if (Points.empty()) {
@@ -603,7 +603,7 @@ static void analysisMain() {
filterPoints(Points, State.getInstrInfo());
- const auto Clustering = ExitOnErr(InstructionBenchmarkClustering::create(
+ const auto Clustering = ExitOnErr(BenchmarkClustering::create(
Points, AnalysisClusteringAlgorithm, AnalysisDbscanNumPoints,
AnalysisClusteringEpsilon, &State.getSubtargetInfo(),
&State.getInstrInfo()));
@@ -651,7 +651,7 @@ int main(int Argc, char **Argv) {
return EXIT_FAILURE;
});
- if (exegesis::BenchmarkMode == exegesis::InstructionBenchmark::Unknown) {
+ if (exegesis::BenchmarkMode == exegesis::Benchmark::Unknown) {
exegesis::analysisMain();
} else {
exegesis::benchmarkMain();
diff --git a/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp b/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp
index b23938a62029a..25fe813502e54 100644
--- a/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp
@@ -23,12 +23,12 @@ using testing::UnorderedElementsAre;
using testing::UnorderedElementsAreArray;
static const auto HasPoints = [](const std::vector<int> &Indices) {
- return Field(&InstructionBenchmarkClustering::Cluster::PointIndices,
+ return Field(&BenchmarkClustering::Cluster::PointIndices,
UnorderedElementsAreArray(Indices));
};
TEST(ClusteringTest, Clusters3D) {
- std::vector<InstructionBenchmark> Points(6);
+ std::vector<Benchmark> Points(6);
// Cluster around (x=0, y=1, z=2): points {0, 3}.
Points[0].Measurements = {
@@ -46,22 +46,22 @@ TEST(ClusteringTest, Clusters3D) {
// Error cluster: points {2}
Points[2].Error = "oops";
- auto Clustering = InstructionBenchmarkClustering::create(
- Points, InstructionBenchmarkClustering::ModeE::Dbscan, 2, 0.25);
+ auto Clustering = BenchmarkClustering::create(
+ Points, BenchmarkClustering::ModeE::Dbscan, 2, 0.25);
ASSERT_TRUE((bool)Clustering);
EXPECT_THAT(Clustering.get().getValidClusters(),
UnorderedElementsAre(HasPoints({0, 3}), HasPoints({1, 4})));
EXPECT_THAT(Clustering.get().getCluster(
- InstructionBenchmarkClustering::ClusterId::noise()),
+ BenchmarkClustering::ClusterId::noise()),
HasPoints({5}));
EXPECT_THAT(Clustering.get().getCluster(
- InstructionBenchmarkClustering::ClusterId::error()),
+ BenchmarkClustering::ClusterId::error()),
HasPoints({2}));
EXPECT_EQ(Clustering.get().getClusterIdForPoint(2),
- InstructionBenchmarkClustering::ClusterId::error());
+ BenchmarkClustering::ClusterId::error());
EXPECT_EQ(Clustering.get().getClusterIdForPoint(5),
- InstructionBenchmarkClustering::ClusterId::noise());
+ BenchmarkClustering::ClusterId::noise());
EXPECT_EQ(Clustering.get().getClusterIdForPoint(0),
Clustering.get().getClusterIdForPoint(3));
EXPECT_EQ(Clustering.get().getClusterIdForPoint(1),
@@ -69,46 +69,46 @@ TEST(ClusteringTest, Clusters3D) {
}
TEST(ClusteringTest, Clusters3D_InvalidSize) {
- std::vector<InstructionBenchmark> Points(6);
+ std::vector<Benchmark> Points(6);
Points[0].Measurements = {
{"x", 0.01, 0.0}, {"y", 1.02, 0.0}, {"z", 1.98, 0.0}};
Points[1].Measurements = {{"y", 1.02, 0.0}, {"z", 1.98, 0.0}};
auto Error =
- InstructionBenchmarkClustering::create(
- Points, InstructionBenchmarkClustering::ModeE::Dbscan, 2, 0.25)
+ BenchmarkClustering::create(
+ Points, BenchmarkClustering::ModeE::Dbscan, 2, 0.25)
.takeError();
ASSERT_TRUE((bool)Error);
consumeError(std::move(Error));
}
TEST(ClusteringTest, Clusters3D_InvalidOrder) {
- std::vector<InstructionBenchmark> Points(6);
+ std::vector<Benchmark> Points(6);
Points[0].Measurements = {{"x", 0.01, 0.0}, {"y", 1.02, 0.0}};
Points[1].Measurements = {{"y", 1.02, 0.0}, {"x", 1.98, 0.0}};
auto Error =
- InstructionBenchmarkClustering::create(
- Points, InstructionBenchmarkClustering::ModeE::Dbscan, 2, 0.25)
+ BenchmarkClustering::create(
+ Points, BenchmarkClustering::ModeE::Dbscan, 2, 0.25)
.takeError();
ASSERT_TRUE((bool)Error);
consumeError(std::move(Error));
}
TEST(ClusteringTest, Ordering) {
- ASSERT_LT(InstructionBenchmarkClustering::ClusterId::makeValid(1),
- InstructionBenchmarkClustering::ClusterId::makeValid(2));
+ ASSERT_LT(BenchmarkClustering::ClusterId::makeValid(1),
+ BenchmarkClustering::ClusterId::makeValid(2));
- ASSERT_LT(InstructionBenchmarkClustering::ClusterId::makeValid(2),
- InstructionBenchmarkClustering::ClusterId::noise());
+ ASSERT_LT(BenchmarkClustering::ClusterId::makeValid(2),
+ BenchmarkClustering::ClusterId::noise());
- ASSERT_LT(InstructionBenchmarkClustering::ClusterId::makeValid(2),
- InstructionBenchmarkClustering::ClusterId::error());
+ ASSERT_LT(BenchmarkClustering::ClusterId::makeValid(2),
+ BenchmarkClustering::ClusterId::error());
- ASSERT_LT(InstructionBenchmarkClustering::ClusterId::noise(),
- InstructionBenchmarkClustering::ClusterId::error());
+ ASSERT_LT(BenchmarkClustering::ClusterId::noise(),
+ BenchmarkClustering::ClusterId::error());
}
TEST(ClusteringTest, Ordering1) {
- std::vector<InstructionBenchmark> Points(3);
+ std::vector<Benchmark> Points(3);
Points[0].Measurements = {
{"x", 0.0, 0.0}};
@@ -117,15 +117,15 @@ TEST(ClusteringTest, Ordering1) {
Points[2].Measurements = {
{"x", 2.0, 0.0}};
- auto Clustering = InstructionBenchmarkClustering::create(
- Points, InstructionBenchmarkClustering::ModeE::Dbscan, 2, 1.1);
+ auto Clustering = BenchmarkClustering::create(
+ Points, BenchmarkClustering::ModeE::Dbscan, 2, 1.1);
ASSERT_TRUE((bool)Clustering);
EXPECT_THAT(Clustering.get().getValidClusters(),
UnorderedElementsAre(HasPoints({0, 1, 2})));
}
TEST(ClusteringTest, Ordering2) {
- std::vector<InstructionBenchmark> Points(3);
+ std::vector<Benchmark> Points(3);
Points[0].Measurements = {
{"x", 0.0, 0.0}};
@@ -134,8 +134,8 @@ TEST(ClusteringTest, Ordering2) {
Points[2].Measurements = {
{"x", 1.0, 0.0}};
- auto Clustering = InstructionBenchmarkClustering::create(
- Points, InstructionBenchmarkClustering::ModeE::Dbscan, 2, 1.1);
+ auto Clustering = BenchmarkClustering::create(
+ Points, BenchmarkClustering::ModeE::Dbscan, 2, 1.1);
ASSERT_TRUE((bool)Clustering);
EXPECT_THAT(Clustering.get().getValidClusters(),
UnorderedElementsAre(HasPoints({0, 1, 2})));
diff --git a/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
index 575e53d75310f..2b7245306b5d8 100644
--- a/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/Mips/BenchmarkResultTest.cpp
@@ -55,7 +55,7 @@ class MipsBenchmarkResultTest : public MipsTestBase {};
TEST_F(MipsBenchmarkResultTest, WriteToAndReadFromDisk) {
ExitOnError ExitOnErr;
- InstructionBenchmark ToDisk;
+ Benchmark ToDisk;
ToDisk.Key.Instructions.push_back(MCInstBuilder(Mips::XOR)
.addReg(Mips::T0)
@@ -65,7 +65,7 @@ TEST_F(MipsBenchmarkResultTest, WriteToAndReadFromDisk) {
ToDisk.Key.RegisterInitialValues = {
RegisterValue{Mips::T1, APInt(8, "123", 10)},
RegisterValue{Mips::T2, APInt(8, "456", 10)}};
- ToDisk.Mode = InstructionBenchmark::Latency;
+ ToDisk.Mode = Benchmark::Latency;
ToDisk.CpuName = "cpu_name";
ToDisk.LLVMTriple = "llvm_triple";
ToDisk.NumRepetitions = 1;
@@ -94,7 +94,7 @@ TEST_F(MipsBenchmarkResultTest, WriteToAndReadFromDisk) {
{
// One-element version.
const auto FromDisk =
- ExitOnErr(InstructionBenchmark::readYaml(State, *Buffer));
+ ExitOnErr(Benchmark::readYaml(State, *Buffer));
EXPECT_THAT(FromDisk.Key.Instructions,
Pointwise(EqMCInst(), ToDisk.Key.Instructions));
@@ -110,7 +110,7 @@ TEST_F(MipsBenchmarkResultTest, WriteToAndReadFromDisk) {
{
// Vector version.
const auto FromDiskVector =
- ExitOnErr(InstructionBenchmark::readYamls(State, *Buffer));
+ ExitOnErr(Benchmark::readYamls(State, *Buffer));
ASSERT_EQ(FromDiskVector.size(), size_t{1});
const auto &FromDisk = FromDiskVector[0];
EXPECT_THAT(FromDisk.Key.Instructions,
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
index bfee792d158af..5423bfc6fc3f6 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
@@ -63,7 +63,7 @@ TEST(BenchmarkResultTest, WriteToAndReadFromDisk) {
ExitOnError ExitOnErr;
- InstructionBenchmark ToDisk;
+ Benchmark ToDisk;
ToDisk.Key.Instructions.push_back(MCInstBuilder(X86::XOR32rr)
.addReg(X86::AL)
@@ -74,7 +74,7 @@ TEST(BenchmarkResultTest, WriteToAndReadFromDisk) {
ToDisk.Key.RegisterInitialValues = {
RegisterValue{X86::AL, APInt(8, "-1", 10)},
RegisterValue{X86::AH, APInt(8, "123", 10)}};
- ToDisk.Mode = InstructionBenchmark::Latency;
+ ToDisk.Mode = Benchmark::Latency;
ToDisk.CpuName = "cpu_name";
ToDisk.LLVMTriple = "llvm_triple";
ToDisk.NumRepetitions = 1;
@@ -106,19 +106,19 @@ TEST(BenchmarkResultTest, WriteToAndReadFromDisk) {
{
// Read Triples/Cpu only.
const auto TriplesAndCpus =
- ExitOnErr(InstructionBenchmark::readTriplesAndCpusFromYamls(*Buffer));
+ ExitOnErr(Benchmark::readTriplesAndCpusFromYamls(*Buffer));
ASSERT_THAT(TriplesAndCpus,
testing::ElementsAre(
- AllOf(Field(&InstructionBenchmark::TripleAndCpu::LLVMTriple,
+ AllOf(Field(&Benchmark::TripleAndCpu::LLVMTriple,
Eq("llvm_triple")),
- Field(&InstructionBenchmark::TripleAndCpu::CpuName,
+ Field(&Benchmark::TripleAndCpu::CpuName,
Eq("cpu_name")))));
}
{
// One-element version.
const auto FromDisk =
- ExitOnErr(InstructionBenchmark::readYaml(State, *Buffer));
+ ExitOnErr(Benchmark::readYaml(State, *Buffer));
EXPECT_THAT(FromDisk.Key.Instructions,
Pointwise(EqMCInst(), ToDisk.Key.Instructions));
@@ -134,7 +134,7 @@ TEST(BenchmarkResultTest, WriteToAndReadFromDisk) {
{
// Vector version.
const auto FromDiskVector =
- ExitOnErr(InstructionBenchmark::readYamls(State, *Buffer));
+ ExitOnErr(Benchmark::readYamls(State, *Buffer));
ASSERT_EQ(FromDiskVector.size(), size_t{1});
const auto &FromDisk = FromDiskVector[0];
EXPECT_THAT(FromDisk.Key.Instructions,
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
index 91a271c5c1ad5..5173526b68226 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetRepetitorTest.cpp
@@ -38,7 +38,7 @@ class X86SnippetRepetitorTest : public X86TestBase {
MF = &createVoidVoidPtrMachineFunction("TestFn", Mod.get(), MMI.get());
}
- void TestCommon(InstructionBenchmark::RepetitionModeE RepetitionMode) {
+ void TestCommon(Benchmark::RepetitionModeE RepetitionMode) {
const auto Repetitor = SnippetRepetitor::Create(RepetitionMode, State);
const std::vector<MCInst> Instructions = {MCInstBuilder(X86::NOOP)};
FunctionFiller Sink(*MF, {X86::EAX});
@@ -66,7 +66,7 @@ static auto LiveReg = [](unsigned Reg) {
};
TEST_F(X86SnippetRepetitorTest, Duplicate) {
- TestCommon(InstructionBenchmark::Duplicate);
+ TestCommon(Benchmark::Duplicate);
// Duplicating creates a single basic block that repeats the instructions.
ASSERT_EQ(MF->getNumBlockIDs(), 1u);
EXPECT_THAT(MF->getBlockNumbered(0)->instrs(),
@@ -75,7 +75,7 @@ TEST_F(X86SnippetRepetitorTest, Duplicate) {
}
TEST_F(X86SnippetRepetitorTest, Loop) {
- TestCommon(InstructionBenchmark::Loop);
+ TestCommon(Benchmark::Loop);
// Duplicating creates an entry block, a loop body and a ret block.
ASSERT_EQ(MF->getNumBlockIDs(), 3u);
const auto &LoopBlock = *MF->getBlockNumbered(1);
More information about the llvm-commits
mailing list