1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

24 Commits

Author SHA1 Message Date
Adam Nemet
f2820def91 [opt-viewer] HTML-escape function names
llvm-svn: 293869
2017-02-02 05:49:02 +00:00
Adam Nemet
d7b037ff30 [opt-viewer] Alternating row background colors on index page
llvm-svn: 293868
2017-02-02 05:49:00 +00:00
Adam Nemet
048d1de98a [opt-viewer] Introduce global context
This is necessary since globals (max_hotness, caller_loc) need to be
explicitly passed to the subprocesses.

llvm-svn: 293266
2017-01-27 06:39:09 +00:00
Adam Nemet
b6cdaf306c [opt-viewer] Remove message from the key
This is causing problems because the rendering of the text will depend on
varying global state to show relative hotness or a link in the inlining
context.

llvm-svn: 293265
2017-01-27 06:39:08 +00:00
Adam Nemet
7d7d8fbb84 [opt-viewer] Unique across the different jobs as well
llvm-svn: 293264
2017-01-27 06:39:06 +00:00
Adam Nemet
ffe6b78a23 [opt-viewer] Make sorting for the index page deterministic
Break the tie between entries with identical hotness deterministically.

llvm-svn: 293263
2017-01-27 06:39:02 +00:00
Adam Nemet
b7b4a7b0c5 [opt-viewer] Include the function in the remark key
Avoid uniquing remarks with different the inlining context (Function).

llvm-svn: 293262
2017-01-27 06:39:01 +00:00
Adam Nemet
c38acefa67 [opt-viewer] Put critical items in parallel
Summary:
Put opt-viewer critical items in parallel

Patch by Brian Cain!

Requires features from Python 2.7

**Performance**
Below are performance results across various configurations. These were taken on an i5-5200U (dual core + HT). They were taken with a small subset of the YAML output of building Python 3.6.0b3 with LTO+PGO. 60 YAML files.

"multiprocessing" is the current submission contents. "baseline" is as of 544f14c6b2a07a94168df31833dba9dc35fd8289 (I think this is aka r287505).

"ImportError" vs "class<...CLoader>" below are just confirming the expected configuration (with/without CLoader).

The below was measured on AMD A8-5500B (4 cores) with 224 input YAML files, showing a ~1.75x speed increase over the baseline with libYAML.  I suspect it would scale well on high-end servers.

```
**************************************** MULTIPROCESSING ****************************************
PyYAML:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
        ImportError: cannot import name CLoader
        Python 2.7.10
489.42user 5.53system 2:38.03elapsed 313%CPU (0avgtext+0avgdata 400308maxresident)k
0inputs+31392outputs (0major+473540minor)pagefaults 0swaps

PyYAML+libYAML:
        <class 'yaml.cyaml.CLoader'>
        Python 2.7.10
78.69user 5.45system 0:32.63elapsed 257%CPU (0avgtext+0avgdata 398560maxresident)k
0inputs+31392outputs (0major+542022minor)pagefaults 0swaps

PyPy/PyYAML:
        Traceback (most recent call last):
          File "<builtin>/app_main.py", line 75, in run_toplevel
          File "<builtin>/app_main.py", line 601, in run_it
          File "<string>", line 1, in <module>
        ImportError: cannot import name 'CLoader'
        Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17)
        [PyPy 2.6.0 with GCC 4.9.3]
154.27user 8.12system 0:53.83elapsed 301%CPU (0avgtext+0avgdata 627960maxresident)k
808inputs+30376outputs (0major+727994minor)pagefaults 0swaps
**************************************** BASELINE        ****************************************
PyYAML:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
        ImportError: cannot import name CLoader
        Python 2.7.10
        358.08user 4.05system 6:08.37elapsed 98%CPU (0avgtext+0avgdata 315004maxresident)k
0inputs+31392outputs (0major+85252minor)pagefaults 0swaps

PyYAML+libYAML:
        <class 'yaml.cyaml.CLoader'>
        Python 2.7.10
50.32user 3.30system 0:56.59elapsed 94%CPU (0avgtext+0avgdata 307296maxresident)k
0inputs+31392outputs (0major+79335minor)pagefaults 0swaps

PyPy/PyYAML:
        Traceback (most recent call last):
          File "<builtin>/app_main.py", line 75, in run_toplevel
          File "<builtin>/app_main.py", line 601, in run_it
          File "<string>", line 1, in <module>
        ImportError: cannot import name 'CLoader'
        Python 2.7.9 (2.6.0+dfsg-3, Jul 04 2015, 05:43:17)
        [PyPy 2.6.0 with GCC 4.9.3]
72.94user 5.18system 1:23.41elapsed 93%CPU (0avgtext+0avgdata 455312maxresident)k
0inputs+30392outputs (0major+110280minor)pagefaults 0swaps

```

Reviewers: fhahn, anemet

Reviewed By: anemet

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 293261
2017-01-27 06:38:31 +00:00
Adam Nemet
26f675cbf1 [opt-viewer] Add support for libYAML for faster parsing
This results in a speed-up of over 6x on sqlite3.

Before:

$ time -p /org/llvm/utils/opt-viewer/opt-viewer.py ./MultiSource/Applications/sqlite3/CMakeFiles/sqlite3.dir/sqlite3.c.opt.yaml html
  real 415.07
  user 410.00
  sys 4.66

After with libYAML:

$ time -p /org/llvm/utils/opt-viewer/opt-viewer.py ./MultiSource/Applications/sqlite3/CMakeFiles/sqlite3.dir/sqlite3.c.opt.yaml html
  real 63.96
  user 60.03
  sys 3.67

I followed these steps to get libYAML working with PyYAML: http://rmcgibbo.github.io/blog/2013/05/23/faster-yaml-parsing-with-libyaml/

llvm-svn: 286942
2016-11-15 08:40:51 +00:00
Adam Nemet
f025804d9c [opt-viewer] Don't fail with remarks without debug location
llvm-svn: 286861
2016-11-14 18:38:48 +00:00
Adam Nemet
e1a960b7a5 [opt-viewer] Make it work in the absence of hotness information
In this case the index page is sorted by the source location.

llvm-svn: 286572
2016-11-11 06:11:56 +00:00
Mandeep Singh Grang
a28582ba38 [opt-viewer] PEPify opt-viewer.py
Reviewers: anemet

Subscribers: fhahn

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

llvm-svn: 286564
2016-11-11 04:51:27 +00:00
Adam Nemet
eb13622ad7 [opt-viewer] Add column number support
With this the yellow (bubble) part of the remark shows up under the
corresponding expression.

llvm-svn: 286545
2016-11-11 01:51:34 +00:00
Adam Nemet
30161c9292 [opt-viewer] Display inlining context
When a function is inlined, each instance is optimized in their own
inlining context.  This can produce different remarks all pointing to
the same source line.

This adds a new column on the source view to display the inlining
context.

llvm-svn: 286537
2016-11-11 01:25:04 +00:00
Adam Nemet
f5ebf8ea93 [opt-viewer] Add option to set source directory
llvm-svn: 286536
2016-11-11 01:08:02 +00:00
Adam Nemet
02063796f2 [opt-viewer] Mention Pygments in the description
llvm-svn: 286535
2016-11-11 01:08:00 +00:00
Adam Nemet
2eb6f1f69f [opt-viewer] Add syntax highlighting
Uses pygments.

llvm-svn: 286532
2016-11-11 00:51:32 +00:00
Adam Nemet
217f9f4002 [opt-viewer] Avoid duplicated remarks
This can happen if a pass is run multiple times or if the code is in a
header file which is included multiple times.

llvm-svn: 286489
2016-11-10 18:42:56 +00:00
Adam Nemet
d19e635a8e [opt-viewer] Avoid division by zero
llvm-svn: 286172
2016-11-07 23:12:13 +00:00
Adam Nemet
afb5f69d51 [OptDiag, opt-viewer] Save callee's location and display as link
With this we get a new field in the YAML record if the value being
streamed out has a debug location.  For examples, please see the changes
to the tests.

This is then used in opt-viewer to display a link for the callee
function in the inlining remarks.

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

llvm-svn: 286169
2016-11-07 22:41:13 +00:00
Adam Nemet
1b02274c11 [opt-viewer] Remove unnecessary call to demangle
llvm-svn: 283898
2016-10-11 16:20:40 +00:00
Adam Nemet
ee4aced190 [opt-viewer] Print hotness as percentage of the maximum hotness
llvm-svn: 283897
2016-10-11 16:20:38 +00:00
Adam Nemet
27f691d520 [opt-viewer] Convert another HTML output to use a multiline string
llvm-svn: 283896
2016-10-11 16:19:06 +00:00
Adam Nemet
1496f9df72 New utility to visualize optimization records
This is a new tool built on top of the new YAML ouput generated from
optimization remarks.  It produces HTML for easy navigation and
visualization.

The tool assumes that hotness information for the remarks is available
(the YAML file was produced with PGO).  It uses hotness to list the
remarks prioritized by the hotness on the index page.  Clicking the
source location of the remark in the list takes you the source where the
remarks are rendedered inline in the source.

For now, the tool is meant as prototype.

It's written in Python.  It uses PyYAML to parse the input.

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

llvm-svn: 283571
2016-10-07 17:06:34 +00:00