[llvm] r374533 - [llvm-exegesis] Show noise cluster in analysis output.

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 04:33:18 PDT 2019


Author: courbet
Date: Fri Oct 11 04:33:18 2019
New Revision: 374533

URL: http://llvm.org/viewvc/llvm-project?rev=374533&view=rev
Log:
[llvm-exegesis] Show noise cluster in analysis output.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68780

Added:
    llvm/trunk/test/tools/llvm-exegesis/X86/analysis-noise.test
Modified:
    llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
    llvm/trunk/tools/llvm-exegesis/lib/Analysis.h

Added: llvm/trunk/test/tools/llvm-exegesis/X86/analysis-noise.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-exegesis/X86/analysis-noise.test?rev=374533&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-exegesis/X86/analysis-noise.test (added)
+++ llvm/trunk/test/tools/llvm-exegesis/X86/analysis-noise.test Fri Oct 11 04:33:18 2019
@@ -0,0 +1,23 @@
+# RUN: llvm-exegesis -mode=analysis -benchmarks-file=%s -analysis-inconsistencies-output-file=- -analysis-clusters-output-file="" -analysis-numpoints=3 | FileCheck %s
+
+# CHECK: DOCTYPE
+# CHECK: [noise] Cluster (1 points)
+
+---
+mode:            latency
+key:
+  instructions:
+    - 'ADD64rr RAX RAX RDI'
+  config:          ''
+  register_initial_values:
+    - 'RAX=0x0'
+    - 'RDI=0x0'
+cpu_name:        haswell
+llvm_triple:     x86_64-unknown-linux-gnu
+num_repetitions: 10000
+measurements:
+  - { key: latency, value: 1.0049, per_snippet_value: 1.0049 }
+error:           ''
+info:            Repeating a single implicitly serial instruction
+assembled_snippet: 48B8000000000000000048BF00000000000000004801F84801F84801F84801F84801F84801F84801F84801F84801F84801F84801F84801F84801F84801F84801F84801F8C3
+...

Modified: llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp?rev=374533&r1=374532&r2=374533&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp Fri Oct 11 04:33:18 2019
@@ -268,6 +268,27 @@ static void writeLatencySnippetHtml(raw_
   }
 }
 
+void Analysis::printPointHtml(const InstructionBenchmark &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:
+    writeLatencySnippetHtml(OS, Point.Key.Instructions, *InstrInfo_);
+    break;
+  case InstructionBenchmark::Uops:
+  case InstructionBenchmark::InverseThroughput:
+    writeUopsSnippetHtml(OS, Point.Key.Instructions, *InstrInfo_);
+    break;
+  default:
+    llvm_unreachable("invalid mode");
+  }
+  OS << "</span> <span class=\"mono\">";
+  writeEscaped<kEscapeHtml>(OS, Point.Key.Config);
+  OS << "</span></li>";
+}
+
 void Analysis::printSchedClassClustersHtml(
     const std::vector<SchedClassCluster> &Clusters,
     const ResolvedSchedClass &RSC, raw_ostream &OS) const {
@@ -292,25 +313,7 @@ void Analysis::printSchedClassClustersHt
     writeClusterId<kEscapeHtml>(OS, Cluster.id());
     OS << "</td><td><ul>";
     for (const size_t PointId : Cluster.getPointIds()) {
-      const auto &Point = Points[PointId];
-      OS << "<li><span class=\"mono\" title=\"";
-      writeSnippet<EscapeTag, kEscapeHtmlString>(OS, Point.AssembledSnippet,
-                                                 "\n");
-      OS << "\">";
-      switch (Point.Mode) {
-      case InstructionBenchmark::Latency:
-        writeLatencySnippetHtml(OS, Point.Key.Instructions, *InstrInfo_);
-        break;
-      case InstructionBenchmark::Uops:
-      case InstructionBenchmark::InverseThroughput:
-        writeUopsSnippetHtml(OS, Point.Key.Instructions, *InstrInfo_);
-        break;
-      default:
-        llvm_unreachable("invalid mode");
-      }
-      OS << "</span> <span class=\"mono\">";
-      writeEscaped<kEscapeHtml>(OS, Point.Key.Config);
-      OS << "</span></li>";
+      printPointHtml(Points[PointId], OS);
     }
     OS << "</ul></td>";
     for (const auto &Stats : Cluster.getCentroid().getStats()) {
@@ -422,6 +425,43 @@ void Analysis::printSchedClassDescHtml(c
   OS << "</table>";
 }
 
+void Analysis::printClusterRawHtml(
+    const InstructionBenchmarkClustering::ClusterId &Id, StringRef display_name,
+    llvm::raw_ostream &OS) const {
+  const auto &Points = Clustering_.getPoints();
+  const auto &Cluster = Clustering_.getCluster(Id);
+  if (Cluster.PointIndices.empty())
+    return;
+
+  OS << "<div class=\"inconsistency\"><p>" << display_name << " Cluster ("
+     << Cluster.PointIndices.size() << " points)</p>";
+  OS << "<table class=\"sched-class-clusters\">";
+  // Table Header.
+  OS << "<tr><th>ClusterId</th><th>Opcode/Config</th>";
+  for (const auto &Measurement : Points[Cluster.PointIndices[0]].Measurements) {
+    OS << "<th>";
+    writeEscaped<kEscapeHtml>(OS, Measurement.Key);
+    OS << "</th>";
+  }
+  OS << "</tr>";
+
+  // Point data.
+  for (const auto &PointId : Cluster.PointIndices) {
+    OS << "<tr class=\"bad-cluster\"><td>" << display_name << "</td><td><ul>";
+    printPointHtml(Points[PointId], OS);
+    OS << "</ul></td>";
+    for (const auto &Measurement : Points[PointId].Measurements) {
+      OS << "<td class=\"measurement\">";
+      writeMeasurementValue<kEscapeHtml>(OS, Measurement.PerInstructionValue);
+    }
+    OS << "</tr>";
+  }
+  OS << "</table>";
+
+  OS << "</div>";
+
+} // namespace exegesis
+
 static constexpr const char kHtmlHead[] = R"(
 <head>
 <title>llvm-exegesis Analysis Results</title>
@@ -549,6 +589,9 @@ Error Analysis::run<Analysis::PrintSched
     OS << "</div>";
   }
 
+  printClusterRawHtml(InstructionBenchmarkClustering::ClusterId::noise(),
+                      "[noise]", OS);
+
   OS << "</body></html>";
   return Error::success();
 }

Modified: llvm/trunk/tools/llvm-exegesis/lib/Analysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/Analysis.h?rev=374533&r1=374532&r2=374533&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Analysis.h (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/Analysis.h Fri Oct 11 04:33:18 2019
@@ -81,6 +81,12 @@ private:
 
   void printInstructionRowCsv(size_t PointId, raw_ostream &OS) const;
 
+  void printClusterRawHtml(const InstructionBenchmarkClustering::ClusterId &Id,
+                           StringRef display_name, llvm::raw_ostream &OS) const;
+
+  void printPointHtml(const InstructionBenchmark &Point,
+                      llvm::raw_ostream &OS) const;
+
   void
   printSchedClassClustersHtml(const std::vector<SchedClassCluster> &Clusters,
                               const ResolvedSchedClass &SC,




More information about the llvm-commits mailing list