[llvm] r327215 - [llvm-mca] BackendStatistics: early exit from method printSchedulerUsage if the
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 10 09:40:26 PST 2018
Author: adibiagio
Date: Sat Mar 10 09:40:25 2018
New Revision: 327215
URL: http://llvm.org/viewvc/llvm-project?rev=327215&view=rev
Log:
[llvm-mca] BackendStatistics: early exit from method printSchedulerUsage if the
no scheduler resources were consumed.
Added:
llvm/trunk/test/tools/llvm-mca/AArch64/Exynos/scheduler-queue-usage.s
llvm/trunk/test/tools/llvm-mca/X86/BtVer2/scheduler-queue-usage.s
Modified:
llvm/trunk/tools/llvm-mca/BackendStatistics.cpp
Added: llvm/trunk/test/tools/llvm-mca/AArch64/Exynos/scheduler-queue-usage.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/AArch64/Exynos/scheduler-queue-usage.s?rev=327215&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/AArch64/Exynos/scheduler-queue-usage.s (added)
+++ llvm/trunk/test/tools/llvm-mca/AArch64/Exynos/scheduler-queue-usage.s Sat Mar 10 09:40:25 2018
@@ -0,0 +1,7 @@
+# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m3 -iterations=1 -verbose < %s | FileCheck %s -check-prefix=ALL
+# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m1 -iterations=1 -verbose < %s | FileCheck %s -check-prefix=ALL
+
+ b t
+
+# ALL: Scheduler's queue usage:
+# ALL-NEXT: No scheduler resources used.
Added: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/scheduler-queue-usage.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/scheduler-queue-usage.s?rev=327215&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/scheduler-queue-usage.s (added)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/scheduler-queue-usage.s Sat Mar 10 09:40:25 2018
@@ -0,0 +1,34 @@
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=1 -verbose < %s | FileCheck %s
+
+vmulps (%rsi), %xmm0, %xmm0
+add %rsi, %rsi
+
+# CHECK: Scheduler's queue usage:
+# CHECK-NEXT: JALU01, 1/20
+# CHECK-NEXT: JFPU01, 1/18
+# CHECK-NEXT: JLSAGU, 1/12
+
+# CHECK: Resources:
+# CHECK-NEXT: [0] - JALU0
+# CHECK-NEXT: [1] - JALU1
+# CHECK-NEXT: [2] - JDiv
+# CHECK-NEXT: [3] - JFPA
+# CHECK-NEXT: [4] - JFPM
+# CHECK-NEXT: [5] - JFPU0
+# CHECK-NEXT: [6] - JFPU1
+# CHECK-NEXT: [7] - JLAGU
+# CHECK-NEXT: [8] - JMul
+# CHECK-NEXT: [9] - JSAGU
+# CHECK-NEXT: [10] - JSTC
+# CHECK-NEXT: [11] - JVALU0
+# CHECK-NEXT: [12] - JVALU1
+# CHECK-NEXT: [13] - JVIMUL
+
+# CHECK: Resource pressure per iteration:
+# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
+# CHECK-NEXT: - 1.00 - - - - 1.00 1.00 - - - - - -
+
+# CHECK: Resource pressure by instruction:
+# CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] Instructions:
+# CHECK-NEXT: - - - - - - 1.00 1.00 - - - - - - vmulps (%rsi), %xmm0, %xmm0
+# CHECK-NEXT: - 1.00 - - - - - - - - - - - - addq %rsi, %rsi
Modified: llvm/trunk/tools/llvm-mca/BackendStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/BackendStatistics.cpp?rev=327215&r1=327214&r2=327215&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/BackendStatistics.cpp (original)
+++ llvm/trunk/tools/llvm-mca/BackendStatistics.cpp Sat Mar 10 09:40:25 2018
@@ -118,9 +118,18 @@ void BackendStatistics::printDispatchSta
void BackendStatistics::printSchedulerUsage(
raw_ostream &OS, const MCSchedModel &SM,
const ArrayRef<BufferUsageEntry> &Usage) const {
+
std::string Buffer;
raw_string_ostream TempStream(Buffer);
TempStream << "\n\nScheduler's queue usage:\n";
+ // Early exit if no buffered resources were consumed.
+ if (Usage.empty()) {
+ TempStream << "No scheduler resources used.\n";
+ TempStream.flush();
+ OS << Buffer;
+ return;
+ }
+
for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I) {
const MCProcResourceDesc &ProcResource = *SM.getProcResource(I);
if (!ProcResource.BufferSize)
More information about the llvm-commits
mailing list