20 Commits

Author SHA1 Message Date
Simon Pilgrim
49f3003c7f Fix typo in declaring code-block snippet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332630 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 16:58:42 +00:00
Andrea Di Biagio
a1fecd54c5 [llvm-mca] Add an example showing how to get Intel assembly syntax
Patch by Jeff Muizelaar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332627 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 16:48:53 +00:00
Andrea Di Biagio
acf3f6ed48 [llvm-mca] add flag -all-views and flag -all-stats.
Flag -all-views enables all the views.
Flag -all-stats enables all the views that print hardware statistics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332602 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 12:27:03 +00:00
Andrea Di Biagio
e508042fca [llvm-mca] Default to the native host cpu if flag -mcpu is not specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330809 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 10:18:25 +00:00
Andrea Di Biagio
97ee2baf09 [llvm-mca][CommandGuide] Fix typo in example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330703 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 10:09:32 +00:00
Andrea Di Biagio
900cf755f0 [llvm-mca] Renamed BackendStatistics to RetireControlUnitStatistics.
Also, removed flag -verbose in favor of flag -retire-stats.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329794 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 12:12:53 +00:00
Andrea Di Biagio
2d438c016c [llvm-mca] Move the logic that prints scheduler statistics from BackendStatistics to its own view.
Added flag -scheduler-stats to print scheduler related statistics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329792 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 11:37:46 +00:00
Sanjay Patel
30c344c945 [llvm-mca] reorder text
On 2nd reading, putting the C example after the bit about
multiple regions makes this flow better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329732 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 18:10:14 +00:00
Sanjay Patel
6592e3d4b5 [llvm-mca] fix formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329729 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 17:56:24 +00:00
Sanjay Patel
272dbbe783 [llvm-mca] add example workflow for source code
This is copied from Andrea's text in PR36875:
https://bugs.llvm.org/show_bug.cgi?id=36875

As noted there, this is a hack...but it's a good one!
It's important to show potential workflows up-front
with examples, so customers can copy and experiment
with them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329726 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 17:49:45 +00:00
Andrea Di Biagio
955aba4f3b [llvm-mca] Move the logic that prints dispatch unit statistics from BackendStatistics to its own view.
This patch moves the logic that collects and analyzes dispatch events to the
DispatchStatistics view.

Added flag -dispatch-stats to print statistics related to the dispatch logic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 14:55:14 +00:00
Andrea Di Biagio
259800c8fc [llvm-mca] Increase the default number of iterations to 100.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329694 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 12:50:03 +00:00
Andrea Di Biagio
aae4cd3ca1 [llvm-mca] Add the ability to mark regions of code for analysis (PR36875)
This patch teaches llvm-mca how to parse code comments in search for special
"markers" used to select regions of code.

Example:

# LLVM-MCA-BEGIN My Code Region
  ....
# LLVM-MCA-END

The MCAsmLexer now delegates to an object of class MCACommentParser (i.e. an
AsmCommentConsumer) the parsing of code comments to search for begin/end code
region markers.

A comment starting with substring "LLVM-MCA-BEGIN" marks the beginning of a new
region of code.  A comment starting with substring "LLVM-MCA-END" marks the end
of the last region.

This implementation doesn't allow regions to overlap. Each region can have a
optional description; internally, each region is identified by a range of source
code locations (SMLoc).

MCInst objects are added to a region R only if the source location for the
MCInst is in the range of locations specified by R.

By default, the tool allocates an implicit "Default" code region which contains
every source location.  See new tests llvm-mca-marker-*.s for a few examples.

A new Backend object is created for every region. So, the analysis is conducted
on every parsed code region.  The final report is the union of the reports
generated for every code region.  Note that empty regions are skipped.

Special "[#] Code Region - ..." strings are used in the report to mark the
portion which is specific to a code region only. For example, see
llvm-mca-markers-5.s.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329590 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-09 16:39:52 +00:00
Andrea Di Biagio
14cfc65a1c [documentation][llvm-mca] Update the documentation.
Scheduling models can now describe processor register files and retire control
units. This updates the existing documentation and the README file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329311 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 16:42:32 +00:00
Andrea Di Biagio
370e64a807 [llvm-mca] Remove flag -max-retire-per-cycle, and update the docs.
This is done in preparation for D45259.
With D45259, models can specify the size of the reorder buffer, and the retire
throughput directly via tablegen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329274 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 11:36:50 +00:00
Andrea Di Biagio
6ea791d917 [llvm-mca] Move the logic that prints register file statistics to its own view. NFCI
Before this patch, the "BackendStatistics" view was responsible for printing the
register file usage (as well as many other statistics).

Now users can enable register file usage statistics using the command line flag
`-register-file-stats`. By default, the tool doesn't print register file
statistics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329083 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 16:46:23 +00:00
Andrea Di Biagio
fafdf4a29c [llvm-mca] Add a flag -instruction-info to enable/disable the instruction info view.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328493 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 13:44:54 +00:00
Andrea Di Biagio
33dfb9de6c [llvm-mca] Update the commandline docs after r328305.
Document that flag -resource-pressure can be used to enable/disable the resource
pressure view. This change should have been part of r328305.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328492 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 13:21:48 +00:00
Andrea Di Biagio
181ce9f609 [llvm-mca] Add flag -instruction-tables to print the theoretical resource pressure distribution for instructions (PR36874)
The goal of this patch is to address most of PR36874.  To fully fix PR36874 we
need to split the "InstructionInfo" view from the "SummaryView". That would make
easy to check the latency and rthroughput as well.

The patch reuses all the logic from ResourcePressureView to print out the
"instruction tables".

We have an entry for every instruction in the input sequence. Each entry reports
the theoretical resource pressure distribution. Resource pressure is uniformly
distributed across all the processor resource units of a group.

At the moment, the backend pipeline is not configurable, so the only way to fix
this is by creating a different driver that simply sends instruction events to
the resource pressure view.  That means, we don't use the Backend interface.
Instead, it is simpler to just have a different code-path for when flag
-instruction-tables is specified.

Once Clement addresses bug 36663, then we can port the "instruction tables"
logic into a stage of our configurable pipeline.

Updated the BtVer2 test cases (thanks Simon for the help). Now we pass flag
-instruction-tables to each modified test.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328487 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26 12:04:53 +00:00
Andrea Di Biagio
29b29cc6a9 [llvm-mca] LLVM Machine Code Analyzer.
llvm-mca is an LLVM based performance analysis tool that can be used to
statically measure the performance of code, and to help triage potential
problems with target scheduling models.

llvm-mca uses information which is already available in LLVM (e.g. scheduling
models) to statically measure the performance of machine code in a specific cpu.
Performance is measured in terms of throughput as well as processor resource
consumption. The tool currently works for processors with an out-of-order
backend, for which there is a scheduling model available in LLVM.

The main goal of this tool is not just to predict the performance of the code
when run on the target, but also help with diagnosing potential performance
issues.

Given an assembly code sequence, llvm-mca estimates the IPC (instructions per
cycle), as well as hardware resources pressure. The analysis and reporting style
were mostly inspired by the IACA tool from Intel.

This patch is related to the RFC on llvm-dev visible at this link:
http://lists.llvm.org/pipermail/llvm-dev/2018-March/121490.html

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326998 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-08 13:05:02 +00:00