1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/docs/CommandGuide
Andrea Di Biagio c5a150eca8 [MCA] Highlight kernel bottlenecks in the summary view.
This patch adds a new flag named -bottleneck-analysis to print out information
about throughput bottlenecks.

MCA knows how to identify and classify dynamic dispatch stalls. However, it
doesn't know how to analyze and highlight kernel bottlenecks.  The goal of this
patch is to teach MCA how to correlate increases in backend pressure to backend
stalls (and therefore, the loss of throughput).

From a Scheduler point of view, backend pressure is a function of the scheduler
buffer usage (i.e. how the number of uOps in the scheduler buffers changes over
time). Backend pressure increases (or decreases) when there is a mismatch
between the number of opcodes dispatched, and the number of opcodes issued in
the same cycle.  Since buffer resources are limited, continuous increases in
backend pressure would eventually leads to dispatch stalls. So, there is a
strong correlation between dispatch stalls, and how backpressure changed over
time.

This patch teaches how to identify situations where backend pressure increases
due to:
 - unavailable pipeline resources.
 - data dependencies.

Data dependencies may delay execution of instructions and therefore increase the
time that uOps have to spend in the scheduler buffers. That often translates to
an increase in backend pressure which may eventually lead to a bottleneck.
Contention on pipeline resources may also delay execution of instructions, and
lead to a temporary increase in backend pressure.

Internally, the Scheduler classifies instructions based on whether register /
memory operands are available or not.

An instruction is marked as "ready to execute" only if data dependencies are
fully resolved.
Every cycle, the Scheduler attempts to execute all instructions that are ready
to execute. If an instruction cannot execute because of unavailable pipeline
resources, then the Scheduler internally updates a BusyResourceUnits mask with
the ID of each unavailable resource.

ExecuteStage is responsible for tracking changes in backend pressure. If backend
pressure increases during a cycle because of contention on pipeline resources,
then ExecuteStage sends a "backend pressure" event to the listeners.
That event would contain information about instructions delayed by resource
pressure, as well as the BusyResourceUnits mask.

Note that ExecuteStage also knows how to identify situations where backpressure
increased because of delays introduced by data dependencies.

The SummaryView observes "backend pressure" events and prints out a "bottleneck
report".

Example of bottleneck report:

```
Cycles with backend pressure increase [ 99.89% ]
Throughput Bottlenecks:
  Resource Pressure       [ 0.00% ]
  Data Dependencies:      [ 99.89% ]
   - Register Dependencies [ 0.00% ]
   - Memory Dependencies   [ 99.89% ]
```

A bottleneck report is printed out only if increases in backend pressure
eventually caused backend stalls.

About the time complexity:

Time complexity is linear in the number of instructions in the
Scheduler::PendingSet.

The average slowdown tends to be in the range of ~5-6%.
For memory intensive kernels, the slowdown can be significant if flag
-noalias=false is specified. In the worst case scenario I have observed a
slowdown of ~30% when flag -noalias=false was specified.

We can definitely recover part of that slowdown if we optimize class LSUnit (by
doing extra bookkeeping to speedup queries). For now, this new analysis is
disabled by default, and it can be enabled via flag -bottleneck-analysis. Users
of MCA as a library can enable the generation of pressure events through the
constructor of ExecuteStage.

This patch partially addresses https://bugs.llvm.org/show_bug.cgi?id=37494

Differential Revision: https://reviews.llvm.org/D58728

llvm-svn: 355308
2019-03-04 11:52:34 +00:00
..
bugpoint.rst
dsymutil.rst [dsymutil] Upstream emitting of papertrail warnings. 2018-04-02 10:40:43 +00:00
FileCheck.rst [FileCheck] Suppress old -v/-vv diags if dumping input 2019-01-22 21:41:42 +00:00
index.rst Add flag to llvm-profdata to allow symbols in profile data to be remapped, and 2018-09-13 20:22:02 +00:00
lit.rst [llvm] Document "%T" as deprecated in CommandGuide/lit.rst 2018-08-25 01:27:48 +00:00
llc.rst Replace "no-frame-pointer-*" function attributes with "frame-pointer" 2019-01-14 10:55:55 +00:00
lli.rst [AArch64] Add Tiny Code Model for AArch64 2018-08-22 11:31:39 +00:00
llvm-ar.rst
llvm-as.rst
llvm-bcanalyzer.rst
llvm-build.rst
llvm-config.rst
llvm-cov.rst [llvm-cov] Add support for gcov --hash-filenames option 2019-02-19 20:45:00 +00:00
llvm-cxxmap.rst Add flag to llvm-profdata to allow symbols in profile data to be remapped, and 2018-09-13 20:22:02 +00:00
llvm-diff.rst
llvm-dis.rst
llvm-dwarfdump.rst Remove duplicate option from documentation. 2017-12-09 19:09:59 +00:00
llvm-exegesis-analysis.png [llvm-exegesis] Show sched class details in analysis. 2018-05-24 10:47:05 +00:00
llvm-exegesis.rst [llvm-exegesis] Split Epsilon param into two (PR40787) 2019-02-25 09:36:12 +00:00
llvm-extract.rst
llvm-lib.rst
llvm-link.rst
llvm-mca.rst [MCA] Highlight kernel bottlenecks in the summary view. 2019-03-04 11:52:34 +00:00
llvm-nm.rst nm: Add -no-weak flag for hiding weak symbols 2018-07-02 17:24:37 +00:00
llvm-objdump.rst llvm-objdump -m -D should disassemble all text segments 2019-01-15 20:41:30 +00:00
llvm-pdbutil.rst [docs] Update code block for compatibility with Sphinx 1.5.1 2017-11-06 11:47:24 +00:00
llvm-profdata.rst [PGO] Context sensitive PGO (part 2) 2019-02-28 19:55:07 +00:00
llvm-readobj.rst [llvm-readobj][ELF]Add demangling support 2019-01-17 15:34:12 +00:00
llvm-stress.rst
llvm-symbolizer.rst [llvm-symbolizer][doc] Tweak wording of --adjust-vma switch description 2019-01-29 10:43:48 +00:00
opt.rst Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
tblgen.rst [MCSched] Bind PFM Counters to the CPUs instead of the SchedModel. 2018-10-25 07:44:01 +00:00