[PATCH] D54393: [llvm-exegesis] Move InstructionBenchmarkClustering::() into header
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 11 10:13:19 PST 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn.
Herald added a subscriber: tschuett.
lebedev.ri added a dependency: D54390: [llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): write into llvm::SmallVectorImpl& output parameter.
Old: (https://reviews.llvm.org/D54390)
Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):
7432.421721 task-clock (msec) # 1.000 CPUs utilized ( +- 0.15% )
...
7.4336 +- 0.0115 seconds time elapsed ( +- 0.15% )
New:
Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):
6569.936144 task-clock (msec) # 1.000 CPUs utilized ( +- 0.22% )
...
6.5711 +- 0.0143 seconds time elapsed ( +- 0.22% )
And another -12%. You'd think it would be `inlined` anyway, but no! :)
Repository:
rL LLVM
https://reviews.llvm.org/D54393
Files:
tools/llvm-exegesis/lib/Clustering.cpp
tools/llvm-exegesis/lib/Clustering.h
Index: tools/llvm-exegesis/lib/Clustering.h
===================================================================
--- tools/llvm-exegesis/lib/Clustering.h
+++ tools/llvm-exegesis/lib/Clustering.h
@@ -89,8 +89,15 @@
const std::vector<Cluster> &getValidClusters() const { return Clusters_; }
// Returns true if the given point is within a distance Epsilon of each other.
- bool isNeighbour(const std::vector<BenchmarkMeasure> &P,
- const std::vector<BenchmarkMeasure> &Q) const;
+ inline bool isNeighbour(const std::vector<BenchmarkMeasure> &P,
+ const std::vector<BenchmarkMeasure> &Q) const {
+ double DistanceSquared = 0.0;
+ for (size_t I = 0, E = P.size(); I < E; ++I) {
+ const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue;
+ DistanceSquared += Diff * Diff;
+ }
+ return DistanceSquared <= EpsilonSquared_;
+ }
private:
InstructionBenchmarkClustering(
Index: tools/llvm-exegesis/lib/Clustering.cpp
===================================================================
--- tools/llvm-exegesis/lib/Clustering.cpp
+++ tools/llvm-exegesis/lib/Clustering.cpp
@@ -49,17 +49,6 @@
}
}
-bool InstructionBenchmarkClustering::isNeighbour(
- const std::vector<BenchmarkMeasure> &P,
- const std::vector<BenchmarkMeasure> &Q) const {
- double DistanceSquared = 0.0;
- for (size_t I = 0, E = P.size(); I < E; ++I) {
- const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue;
- DistanceSquared += Diff * Diff;
- }
- return DistanceSquared <= EpsilonSquared_;
-}
-
InstructionBenchmarkClustering::InstructionBenchmarkClustering(
const std::vector<InstructionBenchmark> &Points,
const double EpsilonSquared)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54393.173562.patch
Type: text/x-patch
Size: 1738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181111/12d221f4/attachment.bin>
More information about the llvm-commits
mailing list