Skip to content

Commit

Permalink
Reapply "[llvm-mca] Do not separate iterations with a newline in the …
Browse files Browse the repository at this point in the history
…timeline view."

This reapplies r329403 with a fix for the floating point rounding issue.

llvm-svn: 329680
  • Loading branch information
Andrea Di Biagio authored and Andrea Di Biagio committed Apr 10, 2018
1 parent 31f199c commit c9f409e
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 53 deletions.
15 changes: 7 additions & 8 deletions llvm/test/tools/llvm-mca/AArch64/CortexA57/direct-branch.s
@@ -1,4 +1,4 @@
# RUN: llvm-mca -march=aarch64 -mcpu=cortex-a57 -iterations=600 -timeline < %s | FileCheck %s
# RUN: llvm-mca -march=aarch64 -mcpu=cortex-a57 -iterations=600 -timeline -timeline-max-iterations=4 < %s | FileCheck %s

b t

Expand Down Expand Up @@ -42,13 +42,12 @@


# CHECK: Timeline view:
# CHECK-NEXT: 012
# CHECK-NEXT: Index 0123456789
# CHECK: Index 0123456

# CHECK: [0,0] DeER . . . b t
# CHECK: [1,0] D=eER. . . b t
# CHECK: [2,0] D==eER . . b t
# CHECK: [3,0] .D==eER . . b t
# CHECK: [0,0] DeER .. b t
# CHECK-NEXT: [1,0] D=eER.. b t
# CHECK-NEXT: [2,0] D==eER. b t
# CHECK-NEXT: [3,0] .D==eER b t


# CHECK: Average Wait times (based on the timeline view):
Expand All @@ -58,4 +57,4 @@
# CHECK-NEXT: [3]: Average time elapsed from WB until retire stage

# CHECK: [0] [1] [2] [3]
# CHECK-NEXT: 0. 10 4.3 4.3 0.0 b t
# CHECK-NEXT: 0. 4 2.3 2.3 0.0 b t
6 changes: 3 additions & 3 deletions llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s
@@ -1,5 +1,5 @@
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m3 -iterations=300 -timeline < %s | FileCheck %s -check-prefix=ALL -check-prefix=M3
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m1 -iterations=300 -timeline < %s | FileCheck %s -check-prefix=ALL -check-prefix=M1
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m3 -iterations=300 -timeline -timeline-max-iterations=3 -resource-pressure=false < %s | FileCheck %s -check-prefix=ALL -check-prefix=M3
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m1 -iterations=300 -timeline -timeline-max-iterations=3 -resource-pressure=false < %s | FileCheck %s -check-prefix=ALL -check-prefix=M1

b t

Expand Down Expand Up @@ -34,4 +34,4 @@
# ALL-NEXT: [3]: Average time elapsed from WB until retire stage

# ALL: [0] [1] [2] [3]
# ALL-NEXT: 0. 10 0.0 0.0 0.0 b t
# ALL-NEXT: 0. 3 0.0 0.0 0.0 b t
@@ -1,5 +1,5 @@
# 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
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m3 -iterations=1 -verbose -resource-pressure=false -instruction-info=false < %s | FileCheck %s -check-prefix=ALL
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m1 -iterations=1 -verbose -resource-pressure=false -instruction-info=false < %s | FileCheck %s -check-prefix=ALL

b t

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-mca/X86/BtVer2/dot-product.s
Expand Up @@ -59,10 +59,10 @@ vhaddps %xmm3, %xmm3, %xmm4
# CHECK: [0,0] DeeER. . . vmulps %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [0,1] D==eeeER . . vhaddps %xmm2, %xmm2, %xmm3
# CHECK-NEXT: [0,2] .D====eeeER . vhaddps %xmm3, %xmm3, %xmm4
# CHECK: [1,0] .DeeE-----R . vmulps %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [1,0] .DeeE-----R . vmulps %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [1,1] . D=eeeE---R . vhaddps %xmm2, %xmm2, %xmm3
# CHECK-NEXT: [1,2] . D====eeeER . vhaddps %xmm3, %xmm3, %xmm4
# CHECK: [2,0] . DeeE-----R . vmulps %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [2,0] . DeeE-----R . vmulps %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [2,1] . D====eeeER . vhaddps %xmm2, %xmm2, %xmm3
# CHECK-NEXT: [2,2] . D======eeeER vhaddps %xmm3, %xmm3, %xmm4

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/BtVer2/pipes-fpu.s
Expand Up @@ -87,7 +87,7 @@ vsqrtps %ymm0, %ymm2
# CHECK-NEXT: [0,5] . DeeeeeeeeeeeeeeeeeeeeeER . . . . . . . . . vsqrtps %xmm0, %xmm2
# CHECK-NEXT: [0,6] . DeeeE-----------------R . . . . . . . . . vaddps %ymm0, %ymm1, %ymm2
# CHECK-NEXT: [0,7] . D===================eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeER . vsqrtps %ymm0, %ymm2
# CHECK: [1,0] . .DeeeeE--------------------------------------------------------R . vpmulld %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [1,0] . .DeeeeE--------------------------------------------------------R . vpmulld %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [1,1] . . DeE-----------------------------------------------------------R. vpand %xmm0, %xmm1, %xmm2
# CHECK-NEXT: [1,2] . . DeeeE--------------------------------------------------------R. vcvttps2dq %xmm0, %xmm2
# CHECK-NEXT: [1,3] . . DeeE----------------------------------------------------------R vpclmulqdq $0, %xmm0, %xmm1, %xmm2
Expand Down
11 changes: 6 additions & 5 deletions llvm/test/tools/llvm-mca/X86/BtVer2/register-files-1.s
@@ -1,4 +1,4 @@
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=5 -verbose -register-file-stats -timeline < %s | FileCheck %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=5 -verbose -instruction-info=false -register-file-stats -timeline < %s | FileCheck %s

vaddps %xmm0, %xmm0, %xmm0
vmulps %xmm0, %xmm0, %xmm0
Expand Down Expand Up @@ -34,13 +34,14 @@ vmulps %xmm0, %xmm0, %xmm0
# CHECK: Timeline view:
# CHECK-NEXT: 0123456789
# CHECK-NEXT: Index 0123456789 01234567

# CHECK: [0,0] DeeeER . . . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [0,1] D===eeER . . . . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [1,0] .D====eeeER . . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [1,0] .D====eeeER . . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [1,1] .D=======eeER . . . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [2,0] . D========eeeER . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [2,0] . D========eeeER . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [2,1] . D===========eeER . . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [3,0] . D============eeeER . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [3,0] . D============eeeER . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [3,1] . D===============eeER . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [4,0] . D================eeeER . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [4,0] . D================eeeER . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [4,1] . D===================eeER vmulps %xmm0, %xmm0, %xmm0
10 changes: 5 additions & 5 deletions llvm/test/tools/llvm-mca/X86/BtVer2/register-files-2.s
@@ -1,4 +1,4 @@
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -register-file-size=5 -iterations=5 -verbose -register-file-stats -timeline < %s | FileCheck %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -register-file-size=5 -iterations=5 -verbose -instruction-info=false -register-file-stats -timeline < %s | FileCheck %s

vaddps %xmm0, %xmm0, %xmm0
vmulps %xmm0, %xmm0, %xmm0
Expand Down Expand Up @@ -36,11 +36,11 @@ vmulps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: Index 0123456789 01234567
# CHECK: [0,0] DeeeER . . . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [0,1] D===eeER . . . . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [1,0] .D====eeeER . . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [1,0] .D====eeeER . . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [1,1] .D=======eeER . . . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [2,0] . D========eeeER . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [2,0] . D========eeeER . . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [2,1] . D========eeER . . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [3,0] . . D========eeeER . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [3,0] . . D========eeeER . . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [3,1] . . D========eeER . . vmulps %xmm0, %xmm0, %xmm0
# CHECK: [4,0] . . . D========eeeER . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [4,0] . . . D========eeeER . vaddps %xmm0, %xmm0, %xmm0
# CHECK-NEXT: [4,1] . . . D========eeER vmulps %xmm0, %xmm0, %xmm0
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/X86/BtVer2/register-files-3.s
Expand Up @@ -46,4 +46,4 @@ idiv %eax
# CHECK-NEXT: Index 0123456789 0123456789 0123456789

# CHECK: [0,0] DeeeeeeeeeeeeeeeeeeeeeeeeeER . . . . . . idivl %eax
# CHECK: [1,0] . . . . . . DeeeeeeeeeeeeeeeeeeeeeeeeeER idivl %eax
# CHECK-NEXT: [1,0] . . . . . . DeeeeeeeeeeeeeeeeeeeeeeeeeER idivl %eax
6 changes: 3 additions & 3 deletions llvm/test/tools/llvm-mca/X86/BtVer2/register-files-4.s
@@ -1,4 +1,4 @@
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=22 -verbose -register-file-stats -timeline -timeline-max-iterations=3 < %s | FileCheck %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=22 -verbose -register-file-stats -resource-pressure=false -timeline -timeline-max-iterations=3 < %s | FileCheck %s

idiv %eax

Expand Down Expand Up @@ -45,5 +45,5 @@ idiv %eax
# CHECK-NEXT: 0123456789 0123456789 0123456789 01234567
# CHECK-NEXT: Index 0123456789 0123456789 0123456789 0123456789
# CHECK: [0,0] DeeeeeeeeeeeeeeeeeeeeeeeeeER . . . . . . . . . . . idivl %eax
# CHECK: [1,0] .D========================eeeeeeeeeeeeeeeeeeeeeeeeeER . . . . . . idivl %eax
# CHECK: [2,0] . D================================================eeeeeeeeeeeeeeeeeeeeeeeeeER idivl %eax
# CHECK-NEXT: [1,0] .D========================eeeeeeeeeeeeeeeeeeeeeeeeeER . . . . . . idivl %eax
# CHECK-NEXT: [2,0] . D================================================eeeeeeeeeeeeeeeeeeeeeeeeeER idivl %eax
3 changes: 2 additions & 1 deletion llvm/tools/llvm-mca/ResourcePressureView.cpp
Expand Up @@ -120,7 +120,8 @@ void ResourcePressureView::printResourcePressurePerIteration(
}

double Pressure = Usage / Executions;
TempStream << format("%.2f", Pressure);
// Round to the value to the nearest hundredth and then print it.
TempStream << format("%.2f", floor((Pressure * 100) + 0.5)/100);
if (Pressure < 10.0)
TempStream << " ";
else if (Pressure < 100.0)
Expand Down
37 changes: 15 additions & 22 deletions llvm/tools/llvm-mca/TimelineView.cpp
Expand Up @@ -72,6 +72,17 @@ void TimelineView::onInstructionEvent(const HWInstructionEvent &Event) {
LastCycle = std::max(LastCycle, CurrentCycle);
}

static void printAverageTime(raw_string_ostream &OS, double AverageTime) {
// Round to the nearest tenth.
OS << format("%.1f", floor((AverageTime * 10) + 0.5)/10);
if (AverageTime < 10.0)
OS << " ";
else if (AverageTime < 100.0)
OS << " ";
else
OS << " ";
}

void TimelineView::printWaitTimeEntry(raw_string_ostream &OS,
const WaitTimeEntry &Entry,
unsigned SourceIndex) const {
Expand Down Expand Up @@ -100,27 +111,9 @@ void TimelineView::printWaitTimeEntry(raw_string_ostream &OS,
else
OS << Executions << " ";

OS << format("%.1f", AverageTime1);
if (AverageTime1 < 10.0)
OS << " ";
else if (AverageTime1 < 100.0)
OS << " ";
else
OS << " ";

OS << format("%.1f", AverageTime2);
if (AverageTime2 < 10.0)
OS << " ";
else if (AverageTime2 < 100.0)
OS << " ";
else
OS << " ";

OS << format("%.1f", AverageTime3);
if (AverageTime3 < 10.0)
OS << " ";
else if (AverageTime3 < 100.0)
OS << ' ';
printAverageTime(OS, AverageTime1);
printAverageTime(OS, AverageTime2);
printAverageTime(OS, AverageTime3);
}
}

Expand Down Expand Up @@ -155,7 +148,7 @@ void TimelineView::printTimelineViewEntry(raw_string_ostream &OS,
const TimelineViewEntry &Entry,
unsigned Iteration,
unsigned SourceIndex) const {
if (SourceIndex == 0)
if (Iteration == 0 && SourceIndex == 0)
OS << '\n';
OS << '[' << Iteration << ',' << SourceIndex << "]\t";
for (unsigned I = 0, E = Entry.CycleDispatched; I < E; ++I)
Expand Down

0 comments on commit c9f409e

Please sign in to comment.