[llvm] r329794 - [llvm-mca] Renamed BackendStatistics to RetireControlUnitStatistics.
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 11 05:12:53 PDT 2018
Author: adibiagio
Date: Wed Apr 11 05:12:53 2018
New Revision: 329794
URL: http://llvm.org/viewvc/llvm-project?rev=329794&view=rev
Log:
[llvm-mca] Renamed BackendStatistics to RetireControlUnitStatistics.
Also, removed flag -verbose in favor of flag -retire-stats.
Added:
llvm/trunk/test/tools/llvm-mca/X86/BtVer2/rcu-statistics.s
llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.cpp
llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.h
Removed:
llvm/trunk/tools/llvm-mca/BackendStatistics.cpp
llvm/trunk/tools/llvm-mca/BackendStatistics.h
Modified:
llvm/trunk/docs/CommandGuide/llvm-mca.rst
llvm/trunk/tools/llvm-mca/CMakeLists.txt
llvm/trunk/tools/llvm-mca/llvm-mca.cpp
Modified: llvm/trunk/docs/CommandGuide/llvm-mca.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-mca.rst?rev=329794&r1=329793&r2=329794&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-mca.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-mca.rst Wed Apr 11 05:12:53 2018
@@ -52,7 +52,7 @@ assembly text:
__asm volatile("# LLVM-MCA-BEGIN foo");
a += 42;
__asm volatile("# LLVM-MCA-END");
- a *= b;
+ a \*= b;
return a;
}
@@ -136,11 +136,6 @@ option specifies "``-``", then the outpu
queue. A value of zero for this flag is ignored, and the default store queue
size is used instead.
-.. option:: -verbose
-
- Enable verbose output. In particular, this flag enables a number of extra
- statistics and performance counters for the retire control unit.
-
.. option:: -timeline
Enable the timeline view.
@@ -174,6 +169,10 @@ option specifies "``-``", then the outpu
Enable extra scheduler statistics. This view collects and analyzes instruction
issue events. This view is disabled by default.
+.. option:: -retire-stats
+
+ Enable extra retire control unit statistics. This view is disabled by default.
+
.. option:: -instruction-info
Enable the instruction info view. This is enabled by default.
Added: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/rcu-statistics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/rcu-statistics.s?rev=329794&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/rcu-statistics.s (added)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/rcu-statistics.s Wed Apr 11 05:12:53 2018
@@ -0,0 +1,56 @@
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -resource-pressure=false -retire-stats -iterations=1 < %s | FileCheck %s
+
+ vsqrtps %xmm0, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+ vaddps %xmm0, %xmm1, %xmm2
+
+# CHECK: Iterations: 1
+# CHECK-NEXT: Instructions: 16
+# CHECK-NEXT: Total Cycles: 31
+# CHECK-NEXT: Dispatch Width: 2
+# CHECK-NEXT: IPC: 0.52
+
+# CHECK: Instruction Info:
+# CHECK-NEXT: [1]: #uOps
+# CHECK-NEXT: [2]: Latency
+# CHECK-NEXT: [3]: RThroughput
+# CHECK-NEXT: [4]: MayLoad
+# CHECK-NEXT: [5]: MayStore
+# CHECK-NEXT: [6]: HasSideEffects
+
+# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
+# CHECK-NEXT: 1 21 21.00 vsqrtps %xmm0, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+# CHECK-NEXT: 1 3 1.00 vaddps %xmm0, %xmm1, %xmm2
+
+# CHECK: Retire Control Unit - number of cycles where we saw N instructions retired:
+# CHECK-NEXT: [# retired], [# cycles]
+# CHECK-NEXT: 0, 23 (74.2%)
+# CHECK-NEXT: 2, 8 (25.8%)
+
Removed: llvm/trunk/tools/llvm-mca/BackendStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/BackendStatistics.cpp?rev=329793&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-mca/BackendStatistics.cpp (original)
+++ llvm/trunk/tools/llvm-mca/BackendStatistics.cpp (removed)
@@ -1,50 +0,0 @@
-//===--------------------- BackendStatistics.cpp ---------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-/// \file
-///
-/// Functionalities used by the BackendPrinter to print out histograms
-/// related to number of {issue/retire} per number of cycles.
-///
-//===----------------------------------------------------------------------===//
-
-#include "BackendStatistics.h"
-#include "llvm/Support/Format.h"
-
-using namespace llvm;
-
-namespace mca {
-
-void BackendStatistics::onInstructionEvent(const HWInstructionEvent &Event) {
- if (Event.Type == HWInstructionEvent::Retired)
- ++NumRetired;
-}
-
-void BackendStatistics::printView(llvm::raw_ostream &OS) const {
- std::string Buffer;
- raw_string_ostream TempStream(Buffer);
- TempStream << "\n\nRetire Control Unit - "
- << "number of cycles where we saw N instructions retired:\n";
- TempStream << "[# retired], [# cycles]\n";
-
- for (const std::pair<unsigned, unsigned> &Entry : RetiredPerCycle) {
- TempStream << " " << Entry.first;
- if (Entry.first < 10)
- TempStream << ", ";
- else
- TempStream << ", ";
- TempStream << Entry.second << " ("
- << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)
- << "%)\n";
- }
-
- TempStream.flush();
- OS << Buffer;
-}
-
-} // namespace mca
Removed: llvm/trunk/tools/llvm-mca/BackendStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/BackendStatistics.h?rev=329793&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-mca/BackendStatistics.h (original)
+++ llvm/trunk/tools/llvm-mca/BackendStatistics.h (removed)
@@ -1,67 +0,0 @@
-//===--------------------- BackendStatistics.h ------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-/// \file
-///
-/// This file implements a View named BackendStatistics that knows how to
-/// collect and print a few statistics related to the retire unit.
-///
-/// Example:
-/// ========
-///
-/// Retire Control Unit - number of cycles where we saw N instructions retired:
-/// [# retired], [# cycles]
-/// 0, 9 (6.9%)
-/// 1, 6 (4.6%)
-/// 2, 1 (0.8%)
-/// 4, 3 (2.3%)
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVM_MCA_BACKENDSTATISTICS_H
-#define LLVM_TOOLS_LLVM_MCA_BACKENDSTATISTICS_H
-
-#include "View.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/MC/MCSubtargetInfo.h"
-
-namespace mca {
-
-class BackendStatistics : public View {
- const llvm::MCSubtargetInfo &STI;
-
- using Histogram = llvm::DenseMap<unsigned, unsigned>;
- Histogram RetiredPerCycle;
-
- unsigned NumRetired;
- unsigned NumCycles;
-
- void updateHistograms() {
- RetiredPerCycle[NumRetired]++;
- NumRetired = 0;
- }
-
- void printRCUStatistics(llvm::raw_ostream &OS, const Histogram &Histogram,
- unsigned Cycles) const;
-
-public:
- BackendStatistics(const llvm::MCSubtargetInfo &sti)
- : STI(sti), NumRetired(0), NumCycles(0) {}
-
- void onInstructionEvent(const HWInstructionEvent &Event) override;
-
- void onCycleBegin(unsigned Cycle) override { NumCycles++; }
-
- void onCycleEnd(unsigned Cycle) override { updateHistograms(); }
-
- void printView(llvm::raw_ostream &OS) const override;
-};
-} // namespace mca
-
-#endif
Modified: llvm/trunk/tools/llvm-mca/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/CMakeLists.txt?rev=329794&r1=329793&r2=329794&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-mca/CMakeLists.txt Wed Apr 11 05:12:53 2018
@@ -12,7 +12,6 @@ set(LLVM_LINK_COMPONENTS
add_llvm_tool(llvm-mca
Backend.cpp
BackendPrinter.cpp
- BackendStatistics.cpp
CodeRegion.cpp
Dispatch.cpp
DispatchStatistics.cpp
@@ -25,6 +24,7 @@ add_llvm_tool(llvm-mca
llvm-mca.cpp
RegisterFileStatistics.cpp
ResourcePressureView.cpp
+ RetireControlUnitStatistics.cpp
Scheduler.cpp
SchedulerStatistics.cpp
Support.cpp
Added: llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.cpp?rev=329794&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.cpp (added)
+++ llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.cpp Wed Apr 11 05:12:53 2018
@@ -0,0 +1,51 @@
+//===--------------------- RetireControlUnitStatistics.cpp ---------------*- C++
+//-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+///
+/// This file implements the RetireControlUnitStatistics interface.
+///
+//===----------------------------------------------------------------------===//
+
+#include "RetireControlUnitStatistics.h"
+#include "llvm/Support/Format.h"
+
+using namespace llvm;
+
+namespace mca {
+
+void RetireControlUnitStatistics::onInstructionEvent(
+ const HWInstructionEvent &Event) {
+ if (Event.Type == HWInstructionEvent::Retired)
+ ++NumRetired;
+}
+
+void RetireControlUnitStatistics::printView(llvm::raw_ostream &OS) const {
+ std::string Buffer;
+ raw_string_ostream TempStream(Buffer);
+ TempStream << "\n\nRetire Control Unit - "
+ << "number of cycles where we saw N instructions retired:\n";
+ TempStream << "[# retired], [# cycles]\n";
+
+ for (const std::pair<unsigned, unsigned> &Entry : RetiredPerCycle) {
+ TempStream << " " << Entry.first;
+ if (Entry.first < 10)
+ TempStream << ", ";
+ else
+ TempStream << ", ";
+ TempStream << Entry.second << " ("
+ << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)
+ << "%)\n";
+ }
+
+ TempStream.flush();
+ OS << Buffer;
+}
+
+} // namespace mca
Added: llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.h?rev=329794&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.h (added)
+++ llvm/trunk/tools/llvm-mca/RetireControlUnitStatistics.h Wed Apr 11 05:12:53 2018
@@ -0,0 +1,61 @@
+//===--------------------- RetireControlUnitStatistics.h ------------------*-
+//C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+///
+/// This file defines class RetireControlUnitStatistics: a view that knows how
+/// to print general statistics related to the retire control unit.
+///
+/// Example:
+/// ========
+///
+/// Retire Control Unit - number of cycles where we saw N instructions retired:
+/// [# retired], [# cycles]
+/// 0, 9 (6.9%)
+/// 1, 6 (4.6%)
+/// 2, 1 (0.8%)
+/// 4, 3 (2.3%)
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H
+#define LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H
+
+#include "View.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+
+namespace mca {
+
+class RetireControlUnitStatistics : public View {
+ using Histogram = llvm::DenseMap<unsigned, unsigned>;
+ Histogram RetiredPerCycle;
+
+ unsigned NumRetired;
+ unsigned NumCycles;
+
+ void updateHistograms() {
+ RetiredPerCycle[NumRetired]++;
+ NumRetired = 0;
+ }
+
+public:
+ RetireControlUnitStatistics() : NumRetired(0), NumCycles(0) {}
+
+ void onInstructionEvent(const HWInstructionEvent &Event) override;
+
+ void onCycleBegin(unsigned Cycle) override { NumCycles++; }
+
+ void onCycleEnd(unsigned Cycle) override { updateHistograms(); }
+
+ void printView(llvm::raw_ostream &OS) const override;
+};
+} // namespace mca
+
+#endif
Modified: llvm/trunk/tools/llvm-mca/llvm-mca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/llvm-mca.cpp?rev=329794&r1=329793&r2=329794&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/llvm-mca.cpp (original)
+++ llvm/trunk/tools/llvm-mca/llvm-mca.cpp Wed Apr 11 05:12:53 2018
@@ -22,13 +22,13 @@
//===----------------------------------------------------------------------===//
#include "BackendPrinter.h"
-#include "BackendStatistics.h"
#include "CodeRegion.h"
#include "DispatchStatistics.h"
#include "InstructionInfoView.h"
#include "InstructionTables.h"
#include "RegisterFileStatistics.h"
#include "ResourcePressureView.h"
+#include "RetireControlUnitStatistics.h"
#include "SchedulerStatistics.h"
#include "SummaryView.h"
#include "TimelineView.h"
@@ -101,11 +101,16 @@ static cl::opt<bool>
cl::init(false));
static cl::opt<bool>
- PrintiSchedulerStats("scheduler-stats",
+ PrintSchedulerStats("scheduler-stats",
cl::desc("Print scheduler statistics"),
cl::init(false));
static cl::opt<bool>
+ PrintRetireStats("retire-stats",
+ cl::desc("Print retire control unit statistics"),
+ cl::init(false));
+
+static cl::opt<bool>
PrintResourcePressureView("resource-pressure",
cl::desc("Print the resource pressure view"),
cl::init(true));
@@ -438,11 +443,11 @@ int main(int argc, char **argv) {
if (PrintDispatchStats)
Printer.addView(llvm::make_unique<mca::DispatchStatistics>(*STI));
- if (PrintiSchedulerStats)
+ if (PrintSchedulerStats)
Printer.addView(llvm::make_unique<mca::SchedulerStatistics>(*STI));
- if (PrintModeVerbose)
- Printer.addView(llvm::make_unique<mca::BackendStatistics>(*STI));
+ if (PrintRetireStats)
+ Printer.addView(llvm::make_unique<mca::RetireControlUnitStatistics>());
if (PrintRegisterFileStats)
Printer.addView(llvm::make_unique<mca::RegisterFileStatistics>(*STI));
More information about the llvm-commits
mailing list