llvm.org GIT mirror llvm / a1b2649
[llvm-mca] Emit a message when no bottlenecks are identified. Summary: Since bottleneck hints are enabled via user request, it can be confusing if no bottleneck information is presented. Such is the case when no bottlenecks are identified. This patch emits a message in that case. Reviewers: andreadb Reviewed By: andreadb Subscribers: tschuett, gbedwell, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59098 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355628 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Davis 7 months ago
4 changed file(s) with 30 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
0 # NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
1 # 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'
2
3 add %eax, %ebx
4
5 # CHECK: Iterations: 1
6 # CHECK-NEXT: Instructions: 1
7 # CHECK-NEXT: Total Cycles: 4
8 # CHECK-NEXT: Total uOps: 1
9
10 # CHECK: Dispatch Width: 2
11 # CHECK-NEXT: uOps Per Cycle: 0.25
12 # CHECK-NEXT: IPC: 0.25
13 # CHECK-NEXT: Block RThroughput: 0.5
14
15 # CHECK: No resource or data dependency bottlenecks discovered.
2222 #define DEBUG_TYPE "llvm-mca"
2323
2424 SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef S,
25 unsigned Width)
25 unsigned Width, bool EmitBottleneckAnalysis)
2626 : SM(Model), Source(S), DispatchWidth(Width), LastInstructionIdx(0),
2727 TotalCycles(0), NumMicroOps(0), BPI({0, 0, 0, 0, 0}),
2828 ResourcePressureDistribution(Model.getNumProcResourceKinds(), 0),
3131 ResIdx2ProcResID(Model.getNumProcResourceKinds(), 0),
3232 PressureIncreasedBecauseOfResources(false),
3333 PressureIncreasedBecauseOfDataDependencies(false),
34 SeenStallCycles(false) {
34 SeenStallCycles(false),
35 ShouldEmitBottleneckAnalysis(EmitBottleneckAnalysis) {
3536 computeProcResourceMasks(SM, ProcResourceMasks);
3637 for (unsigned I = 1, E = SM.getNumProcResourceKinds(); I < E; ++I) {
3738 unsigned Index = getResourceStateIndex(ProcResourceMasks[I]);
110111 }
111112
112113 void SummaryView::printBottleneckHints(raw_ostream &OS) const {
113 if (!SeenStallCycles || !BPI.PressureIncreaseCycles)
114 if (!SeenStallCycles || !BPI.PressureIncreaseCycles) {
115 OS << "\nNo resource or data dependency bottlenecks discovered.\n";
114116 return;
117 }
115118
116119 double PressurePerCycle =
117120 (double)BPI.PressureIncreaseCycles * 100 / TotalCycles;
180183 TempStream << "\nBlock RThroughput: "
181184 << format("%.1f", floor((BlockRThroughput * 10) + 0.5) / 10)
182185 << '\n';
183
184 printBottleneckHints(TempStream);
186 if (ShouldEmitBottleneckAnalysis)
187 printBottleneckHints(TempStream);
185188 TempStream.flush();
186189 OS << Buffer;
187190 }
8383 // True if throughput was affected by dispatch stalls.
8484 bool SeenStallCycles;
8585
86 // True if the bottleneck analysis should be displayed.
87 bool ShouldEmitBottleneckAnalysis;
88
8689 // Compute the reciprocal throughput for the analyzed code block.
8790 // The reciprocal block throughput is computed as the MAX between:
8891 // - NumMicroOps / DispatchWidth
9497
9598 public:
9699 SummaryView(const llvm::MCSchedModel &Model, llvm::ArrayRef S,
97 unsigned Width);
100 unsigned Width, bool EmitBottleneckAnalysis);
98101
99102 void onCycleEnd() override {
100103 ++TotalCycles;
468468 mca::PipelinePrinter Printer(*P);
469469
470470 if (PrintSummaryView)
471 Printer.addView(llvm::make_unique(SM, Insts, Width));
471 Printer.addView(llvm::make_unique(
472 SM, Insts, Width, EnableBottleneckAnalysis));
472473
473474 if (PrintInstructionInfoView)
474475 Printer.addView(