michael zolotukhin, applellvm.org/devmtg/2017-10/slides/zolotukhin-llvm compile time.pdf · llvmlab...
TRANSCRIPT
![Page 1: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/1.jpg)
Michael Zolotukhin, Apple
•LLVM Compile Time. •Challenges. Improvements. Outlook.
![Page 2: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/2.jpg)
Agenda
• Benchmarking and tracking
• Historical findings
• Future work
• Tools and tricks
![Page 3: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/3.jpg)
Compile Time Trend
1x
1.25x
1.5x
3.6 3.7 3.8 3.9
O0-g Os O3
LLVM Version
Com
pile
Tim
e In
crea
se
![Page 4: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/4.jpg)
Compile Time Trend
1x
1.25x
1.5x
3.6 3.7 3.8 3.9
O0-g Os O3
LLVM Version
Com
pile
Tim
e In
crea
seWhy did it happen?
![Page 5: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/5.jpg)
CTMark
• Easy to use
• Reliable
• Fast
• Representative
![Page 6: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/6.jpg)
CTMark
CTMark
-60%
-40%
-20%
0%
20%
40%
60%
maff
t
lenc
od
tram
p3d-
v4
sqlit
e3
cons
umer
-type
set
SPAS
S
7zip
Bulle
t
kim
witu
++
Cla
mAV
Cla
mAV
LLVM Testsuite
-60%
-40%
-20%
0%
20%
40%
60%
![Page 7: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/7.jpg)
LLVM Testsuite
-60%
-40%
-20%
0%
20%
40%
60%
CTMark
CTMark
-60%
-40%
-20%
0%
20%
40%
60%
maff
t
lenc
od
tram
p3d-
v4
sqlit
e3
cons
umer
-type
set
SPAS
S
7zip
Bulle
t
kim
witu
++
Cla
mAV
Cla
mAV
![Page 8: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/8.jpg)
Regular Tracking
• Test every compiler build on several optlevels
• Detect and analyze incoming regressions
• Publish results on Green Dragon
• Raise awareness with reports
![Page 9: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/9.jpg)
Historical Data
![Page 10: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/10.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
![Page 11: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/11.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
![Page 12: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/12.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
![Page 13: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/13.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
![Page 14: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/14.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
![Page 15: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/15.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
![Page 16: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/16.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
Optimized implementation
![Page 17: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/17.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
Optimized implementation
![Page 18: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/18.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
Optimized implementation
![Page 19: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/19.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
Optimized implementation
Refactorings, NFC, etc.
![Page 20: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/20.jpg)
1.25x
1.5x
1.75x
220000 240000 260000 280000 300000 320000
2015
2016
2017
Historical DataCo
mpi
le T
ime
Incr
ease
Revision
Cost Model Changes
LibCXX changes
New features
Optimized implementation
Refactorings, NFC, etc.
![Page 21: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/21.jpg)
Compile Time Trend
1x
1.25x
1.5x
3.6 3.7 3.8 3.9
O0-g Os O3
LLVM Version
Com
pile
Tim
e In
crea
se
![Page 22: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/22.jpg)
1x
1.25x
1.5x
3.6 3.7 3.8 3.9 4.0 5.0
O0-g Os O3
Compile Time Trend
LLVM Version
Com
pile
Tim
e In
crea
se
![Page 23: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/23.jpg)
Compile Time Trend
1x
1.25x
1.5x
3.6 3.7 3.8 3.9 4.0 5.0
O0-g Os O3
LLVM Version
Com
pile
Tim
e In
crea
se
![Page 24: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/24.jpg)
Future Outlook
• Look at other components: front-end, libraries
• Find new ways to speed-up LLVM
• Add more benchmarks
• Speed-up your favorite pass
![Page 25: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/25.jpg)
Tools and Tricks
![Page 26: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/26.jpg)
llvmlabTools and Tricks
![Page 27: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/27.jpg)
llvmlabTools and Tricks
Installation: $ virtualenv venv && . venv/bin/activate
(venv)$ git clone http://llvm.org/git/zorg
(venv)$ pip install requests
(venv)$ python zorg/llvmbisect/setup.py install
(venv)$ which llvmlab
/path/to/venv/bin/llvmlab
![Page 28: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/28.jpg)
llvmlabTools and Tricks
Usage: $ ### List available builders:
$ llvmlab ls
clang-cmake-aarch64clang-cmake-armv7aclang-cmake-mipsclang-cmake-mipselclang-stage1-configure-RAclang-stage1-configure-RA_buildclang-stage2-cmake-RgTSanclang-stage2-configure-Rltoclang-stage2-configure-Rlto_buildclang-stage2-configure-Rthinlto_build
![Page 29: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/29.jpg)
llvmlabTools and Tricks
Usage: $ ### List available artifacts:
$ llvmlab ls clang-stage2-configure-Rlto
clang-r314805-b21519clang-r314804-b21518clang-r314803-b21517clang-r314799-b21516clang-r314798-b21515clang-r314795-b21514clang-r314793-b21513...
![Page 30: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/30.jpg)
llvmlabTools and Tricks
Usage: $ ### Download specified artifact:
$ llvmlab fetch clang-stage2-configure-Rlto clang-r314805-b21519
downloaded root: clang-r314805-b21519.tar.gzextracted path : clang-r314805-b21519
$ clang-r314805-b21519/bin/clang -v
Apple clang version 6.0.99 (master 314805) (based on LLVM 6.0.99)Target: x86_64-apple-darwin16.7.0Thread model: posixInstalledDir: /tmp/clang-r314805-b21519/bin
![Page 31: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/31.jpg)
Test-suite + LNTTools and Tricks
![Page 32: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/32.jpg)
Test-suite + LNT
Installation: $ virtualenv venv && . venv/bin/activate
(venv)$ git clone http://llvm.org/git/test-suite
(venv)$ git clone http://llvm.org/git/lnt
(venv)$ pip install -r lnt/requirements.client.txt
(venv)$ python lnt/setup.py install
(venv)$ pip install svn+http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit
(venv)$ which lit
/path/to/venv/bin/lit
(venv)$ which lnt
/path/to/venv/bin/lnt
Tools and Tricks
![Page 33: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/33.jpg)
Test-suite + LNT
Running CTMark: $ lnt runtest test-suite --sandbox /Path/To/Sandbox \ —-use-lit=lit \ --cc /Path/To/Compiler/bin/clang \ --test-suite=/Path/To/test-suite \ -C target-x86_64-macosx \ -C Os \ --cmake-define TEST_SUITE_RUN_BENCHMARKS=Off \ --cmake-define TEST_SUITE_SUBDIRS=CTMark
Tools and Tricks
![Page 34: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/34.jpg)
Test-suite + LNT
Running full LLVM test-suite: $ lnt runtest test-suite --sandbox /Path/To/Sandbox \ —-use-lit=lit \ --cc /Path/To/Compiler/bin/clang \ --test-suite=/Path/To/test-suite \ -C target-x86_64-macosx \ -C Os \ --cmake-define TEST_SUITE_BENCHMARKING_ONLY=On
Tools and Tricks
![Page 35: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/35.jpg)
Test-suite + LNT
Running a subset of LLVM test-suite: $ lnt runtest test-suite --sandbox /Path/To/Sandbox \ —-use-lit=lit \ --cc /Path/To/Compiler/bin/clang \ --test-suite=/Path/To/test-suite \ -C target-x86_64-macosx \ -C Os \ --cmake-define TEST_SUITE_BENCHMARKING_ONLY=On \ —only-test MultiSource/Applications
Tools and Tricks
![Page 36: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/36.jpg)
Test-suite + LNT
Running a test-suite: $ lnt runtest test-suite --sandbox /Path/To/Sandbox \ —-use-lit=lit \ --cc /Path/To/Compiler/bin/clang \ --test-suite=/Path/To/test-suite \ -C target-x86_64-macosx \ -C Os \ --cmake-define TEST_SUITE_BENCHMARKING_ONLY=On \ —only-test MultiSource/Applications
$ ### Results will be in /Path/To/Sandbox/test-DATETIME/output*.json
Tools and Tricks
![Page 37: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/37.jpg)
Comparing results: $ pip install pandas
$ /Path/To/test-suite/utils/compare.py -m compile_time output1.json output2.json
Tests: 27Metric: compile_timeProgram output1 output2 diffflops-3.test 0.03 0.03 14.9%flops-2.test 0.03 0.03 -13.7%himenobmtxpa.test 0.10 0.12 11.6%ffbench.test 0.06 0.07 9.3%…
$ ### The tool also has many useful options, see ‘—-help’ for details
Test-suite + LNTTools and Tricks
![Page 38: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/38.jpg)
Test-suite + cmake + litTools and Tricks
![Page 39: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/39.jpg)
Building and running: $ cd /Path/To/Sandbox
$ cmake -DCMAKE_C_COMPILER=/Path/To/Compiler/bin/clang \ -C /Path/To/test-suite/cmake/caches/target-x86_64-macosx.cmake \ -C /Path/To/test-suite/cmake/caches/Os.cmake \ -DTEST_SUITE_RUN_BENCHMARKS=Off \ -DTEST_SUITE_SUBDIRS=CTMark \ /Path/To/test-suite
Tools and TricksTest-suite + cmake + lit
![Page 40: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/40.jpg)
Building and running: $ cd /Path/To/Sandbox
$ cmake -DCMAKE_C_COMPILER=/Path/To/Compiler/bin/clang \ -C /Path/To/test-suite/cmake/caches/target-x86_64-macosx.cmake \ -C /Path/To/test-suite/cmake/caches/Os.cmake \ -DTEST_SUITE_RUN_BENCHMARKS=Off \ -DTEST_SUITE_SUBDIRS=CTMark \ /Path/To/test-suite
$ ### Go to a subfolder if we don’t want to build all the tests:
$ cd CTMark/bullet
$ make -k -j 1 VERBOSE=1 all
Tools and TricksTest-suite + cmake + lit
![Page 41: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/41.jpg)
Building and running: $ cd /Path/To/Sandbox
$ cmake -DCMAKE_C_COMPILER=/Path/To/Compiler/bin/clang \ -C /Path/To/test-suite/cmake/caches/target-x86_64-macosx.cmake \ -C /Path/To/test-suite/cmake/caches/Os.cmake \ -DTEST_SUITE_RUN_BENCHMARKS=Off \ -DTEST_SUITE_SUBDIRS=CTMark \ /Path/To/test-suite
$ ### Go to a subfolder if we don’t want to build all the tests:
$ cd CTMark/bullet
$ make -k -j 1 VERBOSE=1 all
$ /Path/To/LLVM-Repo/utils/lit/lit.py -v -j 1 /Path/To/Sandbox/CTMark/bullet -o output.json
Tools and TricksTest-suite + cmake + lit
![Page 42: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/42.jpg)
Per file stats: $ find CTMark/Bullet -name “*.time"
CTMark/Bullet/bullet.link.timeCTMark/Bullet/CMakeFiles/bullet.dir/BenchmarkDemo.cpp.o.time…
CTMark/Bullet/CMakeFiles/bullet.dir/SphereTriangleDetector.cpp.o.time
$ cat CTMark/Bullet/CMakeFiles/bullet.dir/SphereTriangleDetector.cpp.o.time
exit 0real 0.1942user 0.1676sys 0.0172
$ size CTMark/Bullet/CMakeFiles/bullet.dir/SphereTriangleDetector.cpp.o
__TEXT __DATA __OBJC others dec hex3755 88 0 288 4131 1023
Tools and TricksTest-suite + cmake + lit
![Page 43: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/43.jpg)
Compiler OptionsTools and Tricks
![Page 44: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/44.jpg)
Compiler OptionsTools and Tricks
Collecting pass timings: $ clang myfile.c -O3 —c -ftime-report
===-------------------------------------------------------------------------=== Miscellaneous Ungrouped Timers===-------------------------------------------------------------------------=== ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 6.7877 ( 97.5%) 0.5060 ( 96.7%) 7.2938 ( 97.5%) 7.4313 ( 97.3%) Code Generation Time 0.1720 ( 2.5%) 0.0172 ( 3.3%) 0.1892 ( 2.5%) 0.2075 ( 2.7%) LLVM IR Generation Time 6.9598 (100.0%) 0.5232 (100.0%) 7.4830 (100.0%) 7.6388 (100.0%) Total
===-------------------------------------------------------------------------=== Register Allocation===-------------------------------------------------------------------------=== Total Execution Time: 0.2353 seconds (0.2364 wall clock) ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 0.1907 ( 83.5%) 0.0024 ( 34.6%) 0.1931 ( 82.1%) 0.1940 ( 82.0%) Global Splitting 0.0213 ( 9.3%) 0.0010 ( 13.7%) 0.0222 ( 9.4%) 0.0222 ( 9.4%) Spiller ...
![Page 45: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/45.jpg)
Compiler OptionsTools and Tricks
Collecting pass timings: $ clang myfile.c -O3 -c -ftime-report -save-stats=obj
$ cat myfile.stats { "time.regalloc.local_split.wall": 1.283169e-03, "time.regalloc.local_split.user": 1.176000e-03, "time.regalloc.local_split.sys": 9.700000e-05, "time.regalloc.spill.wall": 2.174950e-02, "time.regalloc.spill.user": 2.083200e-02, "time.regalloc.spill.sys": 8.420000e-04, ...}
![Page 46: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/46.jpg)
Compiler OptionsTools and Tricks
Collecting pass timings: $ clang myfile.c -O3 -c -disable-llvm-passes -emit-llvm
$ opt -O3 myfile.bc -o myfile.o -time-passes ===-------------------------------------------------------------------------=== ... Pass execution timing report ...===-------------------------------------------------------------------------=== Total Execution Time: 5.9781 seconds (6.0340 wall clock) ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 0.5257 ( 9.2%) 0.0044 ( 1.7%) 0.5302 ( 8.9%) 0.5351 ( 8.9%) Global Value Numbering 0.3432 ( 6.0%) 0.0035 ( 1.3%) 0.3467 ( 5.8%) 0.3494 ( 5.8%) Function Integration/Inlining 0.2423 ( 4.2%) 0.0019 ( 0.7%) 0.2443 ( 4.1%) 0.2458 ( 4.1%) Combine redundant instructions ...
![Page 47: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/47.jpg)
Compiler OptionsTools and Tricks
Collecting optimization remarks: $ clang myfile.c -O3 -c -fsave-optimization-record
$ cat myfile.opt.yaml --- !PassedPass: loop-unrollName: FullyUnrolledDebugLoc: { File: myfile.c, Line: 3, Column: 3 }Function: fooArgs: - String: 'completely unrolled loop with ' - UnrollCount: '4' - String: ' iterations'...
![Page 48: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/48.jpg)
Compiler OptionsTools and Tricks
Inspecting optimization remarks: $ opt-viewer.py myfile.opt.yaml
$ open html/myfile.c.html
![Page 49: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/49.jpg)
Compiler OptionsTools and Tricks
Inspecting optimization remarks: $ opt-viewer.py myfile.opt.yaml
$ open html/myfile.c.html
$ opt-diff.py myfile1.opt.yaml myfile2.opt.yaml
$ opt-viewer.py diff.opt.yaml
![Page 50: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/50.jpg)
Compiler OptionsTools and Tricks
Inspecting optimization remarks: $ opt-viewer.py myfile.opt.yaml
$ open html/myfile.c.html
$ opt-diff.py myfile1.opt.yaml myfile2.opt.yaml
$ opt-viewer.py diff.opt.yaml
More details: LLVM Dev 2016 Talk: Compiler-assisted Performance Analysis
![Page 51: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/51.jpg)
Summary
• Test your patches for compile time
• Use CTMark
• Know your tools
• Make LLVM faster!
![Page 52: Michael Zolotukhin, Applellvm.org/devmtg/2017-10/slides/Zolotukhin-LLVM Compile Time.pdf · llvmlab Tools and Tricks Usage: $ ### Download specified artifact: $ llvmlab fetch clang-stage2-configure-Rlto](https://reader034.vdocument.in/reader034/viewer/2022043003/5f849cb07bc6b27535554b14/html5/thumbnails/52.jpg)