1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00
llvm-mirror/tools/llvm-mca/Views
Andrea Di Biagio db94372a40 [MCA] Simplify the rounding logic used in TimelineView::printWaitTimeEntry.
This is related to PR51392.

Before this patch, the timeline view was rounding doubles to the first decimal,
using a logic similar to this:

```
  double AverageTime = (double)Input / CumulativeExecutions;
  double Result = floor((AverageTime * 10) + 0.5) / 10
```

Here, Input and CumulativeExecutions are both unsigned integers.
The last operation is what effectively performs the rounding of AverageTime.

PR51392 has been raised because - under specific -m32 configurations of GCC -
one of the timeline tests reports slighlty different values (due to a different
rounding choice).

This patch tries to minimise the propagation of floating-point error by
hoisting the multiply by 10, so that it is performed on the unsigned.

```
  double AverageTime = (double)(Input * 10) / CumulativeExecutions;
  floor(AverageTime + 0.5) / 10
```

So we are trading a floating point multiply for a integer multiply (which can be
expanded using a simple MUL or using an `ADD + LEA` sequence). This decrease in
floating point operations executed should also help with decreasing the error in
the computation..

Strictly speaking, that computation will always be potentially subject to error
(depending on what values are passed in input). However, this patch should
improve the situation and make bug like PR51392 less frequent.

(cherry picked from commit 45685a1fc4524579a25b03eb1a27e8fcb792afc7)
2021-08-11 13:42:58 -07:00
..
BottleneckAnalysis.cpp [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
BottleneckAnalysis.h [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
DispatchStatistics.cpp [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
DispatchStatistics.h [llvm-mca] Fix JSON output (PR50922) 2021-07-01 12:53:20 +01:00
InstructionInfoView.cpp [llvm-mca] Fix JSON output (PR50922) 2021-07-01 12:53:20 +01:00
InstructionInfoView.h [llvm-mca] Addressing build failures due to missing override specifiers 2021-01-21 17:32:18 -08:00
InstructionView.cpp [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
InstructionView.h [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
RegisterFileStatistics.cpp [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
RegisterFileStatistics.h [llvm-mca] Fix JSON output (PR50922) 2021-07-01 12:53:20 +01:00
ResourcePressureView.cpp [llvm-mca] Initial implementation of serialization using JSON. The views 2021-01-21 15:15:54 -08:00
ResourcePressureView.h [llvm-mca] Addressing build failures due to missing override specifiers 2021-01-21 17:32:18 -08:00
RetireControlUnitStatistics.cpp [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
RetireControlUnitStatistics.h [llvm-mca] Fix JSON output (PR50922) 2021-07-01 12:53:20 +01:00
SchedulerStatistics.cpp [Tools] Fixes -Wrange-loop-analysis warnings 2019-12-22 19:11:17 +01:00
SchedulerStatistics.h [llvm-mca] Fix JSON output (PR50922) 2021-07-01 12:53:20 +01:00
SummaryView.cpp [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
SummaryView.h [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
TimelineView.cpp [MCA] Simplify the rounding logic used in TimelineView::printWaitTimeEntry. 2021-08-11 13:42:58 -07:00
TimelineView.h [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00
View.cpp [llvm-mca][JSON] Further refactoring of the JSON printing logic. 2021-07-10 12:38:19 +01:00
View.h [llvm-mca] [NFC] Formatting code 2021-07-13 19:13:59 +02:00