__asm volatile("# LLVM-MCA-BEGIN foo");
a += 42;
__asm volatile("# LLVM-MCA-END");
- a *= b;
+ a \*= b;
return a;
}
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.
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.
--- /dev/null
+# 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%)
+
add_llvm_tool(llvm-mca
Backend.cpp
BackendPrinter.cpp
- BackendStatistics.cpp
CodeRegion.cpp
Dispatch.cpp
DispatchStatistics.cpp
llvm-mca.cpp
RegisterFileStatistics.cpp
ResourcePressureView.cpp
+ RetireControlUnitStatistics.cpp
Scheduler.cpp
SchedulerStatistics.cpp
Support.cpp
-//===--------------------- BackendStatistics.cpp ---------------*- C++ -*-===//
+//===--------------------- RetireControlUnitStatistics.cpp ---------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
/// \file
///
-/// Functionalities used by the BackendPrinter to print out histograms
-/// related to number of {issue/retire} per number of cycles.
+/// This file implements the RetireControlUnitStatistics interface.
///
//===----------------------------------------------------------------------===//
-#include "BackendStatistics.h"
+#include "RetireControlUnitStatistics.h"
#include "llvm/Support/Format.h"
using namespace llvm;
namespace mca {
-void BackendStatistics::onInstructionEvent(const HWInstructionEvent &Event) {
+void RetireControlUnitStatistics::onInstructionEvent(
+ const HWInstructionEvent &Event) {
if (Event.Type == HWInstructionEvent::Retired)
++NumRetired;
}
-void BackendStatistics::printView(llvm::raw_ostream &OS) const {
+void RetireControlUnitStatistics::printView(llvm::raw_ostream &OS) const {
std::string Buffer;
raw_string_ostream TempStream(Buffer);
TempStream << "\n\nRetire Control Unit - "
-//===--------------------- BackendStatistics.h ------------------*- C++ -*-===//
+//===--------------------- RetireControlUnitStatistics.h ------------------*-
+//C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
/// \file
///
-/// This file implements a View named BackendStatistics that knows how to
-/// collect and print a few statistics related to the retire unit.
+/// This file defines class RetireControlUnitStatistics: a view that knows how
+/// to print general statistics related to the retire control unit.
///
/// Example:
/// ========
///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_LLVM_MCA_BACKENDSTATISTICS_H
-#define LLVM_TOOLS_LLVM_MCA_BACKENDSTATISTICS_H
+#ifndef LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_H
+#define LLVM_TOOLS_LLVM_MCA_RETIRECONTROLUNITSTATISTICS_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;
-
+class RetireControlUnitStatistics : public View {
using Histogram = llvm::DenseMap<unsigned, unsigned>;
Histogram RetiredPerCycle;
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) {}
+ RetireControlUnitStatistics() : NumRetired(0), NumCycles(0) {}
void onInstructionEvent(const HWInstructionEvent &Event) override;
//===----------------------------------------------------------------------===//
#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"
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));
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));