--- /dev/null
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -bottleneck-analysis -all-views=false -summary-view -iterations 1 < %s | FileCheck %s -implicit-check-not 'Cycles with backend pressure increase'
+
+add %eax, %ebx
+
+# CHECK: Iterations: 1
+# CHECK-NEXT: Instructions: 1
+# CHECK-NEXT: Total Cycles: 4
+# CHECK-NEXT: Total uOps: 1
+
+# CHECK: Dispatch Width: 2
+# CHECK-NEXT: uOps Per Cycle: 0.25
+# CHECK-NEXT: IPC: 0.25
+# CHECK-NEXT: Block RThroughput: 0.5
+
+# CHECK: No resource or data dependency bottlenecks discovered.
#define DEBUG_TYPE "llvm-mca"
SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef<MCInst> S,
- unsigned Width)
+ unsigned Width, bool EmitBottleneckAnalysis)
: SM(Model), Source(S), DispatchWidth(Width), LastInstructionIdx(0),
TotalCycles(0), NumMicroOps(0), BPI({0, 0, 0, 0, 0}),
ResourcePressureDistribution(Model.getNumProcResourceKinds(), 0),
ResIdx2ProcResID(Model.getNumProcResourceKinds(), 0),
PressureIncreasedBecauseOfResources(false),
PressureIncreasedBecauseOfDataDependencies(false),
- SeenStallCycles(false) {
+ SeenStallCycles(false),
+ ShouldEmitBottleneckAnalysis(EmitBottleneckAnalysis) {
computeProcResourceMasks(SM, ProcResourceMasks);
for (unsigned I = 1, E = SM.getNumProcResourceKinds(); I < E; ++I) {
unsigned Index = getResourceStateIndex(ProcResourceMasks[I]);
}
void SummaryView::printBottleneckHints(raw_ostream &OS) const {
- if (!SeenStallCycles || !BPI.PressureIncreaseCycles)
+ if (!SeenStallCycles || !BPI.PressureIncreaseCycles) {
+ OS << "\nNo resource or data dependency bottlenecks discovered.\n";
return;
+ }
double PressurePerCycle =
(double)BPI.PressureIncreaseCycles * 100 / TotalCycles;
TempStream << "\nBlock RThroughput: "
<< format("%.1f", floor((BlockRThroughput * 10) + 0.5) / 10)
<< '\n';
-
- printBottleneckHints(TempStream);
+ if (ShouldEmitBottleneckAnalysis)
+ printBottleneckHints(TempStream);
TempStream.flush();
OS << Buffer;
}
// True if throughput was affected by dispatch stalls.
bool SeenStallCycles;
+ // True if the bottleneck analysis should be displayed.
+ bool ShouldEmitBottleneckAnalysis;
+
// Compute the reciprocal throughput for the analyzed code block.
// The reciprocal block throughput is computed as the MAX between:
// - NumMicroOps / DispatchWidth
public:
SummaryView(const llvm::MCSchedModel &Model, llvm::ArrayRef<llvm::MCInst> S,
- unsigned Width);
+ unsigned Width, bool EmitBottleneckAnalysis);
void onCycleEnd() override {
++TotalCycles;
mca::PipelinePrinter Printer(*P);
if (PrintSummaryView)
- Printer.addView(llvm::make_unique<mca::SummaryView>(SM, Insts, Width));
+ Printer.addView(llvm::make_unique<mca::SummaryView>(
+ SM, Insts, Width, EnableBottleneckAnalysis));
if (PrintInstructionInfoView)
Printer.addView(