Commit Graph

27 Commits

Author SHA1 Message Date
Michael Zolotukhin f70de9caa2 Fix one more reference to lit.util.capture()
The capture method was removed in r306643.

llvm-svn: 307201
2017-07-05 21:06:11 +00:00
Alexander Shaposhnikov be16876e89 [clang] Update lit config in utils/perf-training
This diff replaces --driver-mode=cpp in
utils/perf-training/order-files.lit.cfg and
utils/perf-training/lit.cfg with --driver-mode=g++.
clang --driver-mode=cpp will call the preprocessor and will not
trigger compilation.

Differential revision: https://reviews.llvm.org/D28269

llvm-svn: 290936
2017-01-04 04:33:28 +00:00
Alexander Shaposhnikov fd7afa73b6 [clang] Fix clean build of generate-order-file
This diff fixes the clean build of the target generate-order-file.
In llvm/tools/clang/CMakeLists.txt 
add_subdirectory(utils/perf-training) should go after the block where 
the value of the variable CLANG_ORDER_FILE is set - otherwise 
(tested with cmake's version 3.6.2) the arguments of perf-helper.py gen-order-file
will be ill-formed (CLANG_ORDER_FILE will be empty).

Differential revision: https://reviews.llvm.org/D28153

llvm-svn: 290781
2016-12-31 05:25:52 +00:00
Chris Bieneman 7f5884a489 [Order Files] On Darwin use DTrace's oneshot probe
The oneshot probe only gets executed the first time the probe is hit in the process. For order file generation this is really all we care about.

llvm-svn: 279673
2016-08-24 22:09:46 +00:00
Chris Bieneman 54e044736f Revert "[Order Files] Remove dtrace predicate"
This reverts commit r277487.

Removing the probe predicate was a red herring. It results in more symbols being placed in the final order file, but they are symbols from outside the clang image.

llvm-svn: 277492
2016-08-02 18:23:56 +00:00
Chris Bieneman f7a024b886 [Order Files] Remove dtrace predicate
Having the dtrace predicate setup to only show probes in clang filters out static initializers executed by dyld, which we do want included in the order files.

llvm-svn: 277487
2016-08-02 17:50:53 +00:00
Chris Bieneman 973781bbb4 [Order Files] Fixing an error in the perf-helper script
Dtrace probemod needs to be based on the first argument of the command, not the first argument of the args. This error was introduced a while back when I added support for skipping the driver and invoking cc1 directly.

llvm-svn: 277401
2016-08-01 22:54:00 +00:00
Chris Bieneman 7256f51b18 [Perf-Helper] Add logging for dtrace commands
Logging the dtrace command into the top of the dtrace log is useful when debugging why the order file generation is flaky.

llvm-svn: 277234
2016-07-29 22:48:17 +00:00
Vedant Kumar 3dd0fb3e70 [perf-training] Ignore 'Profile Note' warnings from the runtime
After r272599, -DLLVM_BUILD_INSTRUMENTED passes a default argument to
-fprofile-instr-generate. This confuses the perf-helper script because
the runtime emits a note stating that the default is overridden by the
LLVM_PROFILE_FILE environment variable.

Change the perf-helper script s.t it does not treat these notes as
failures.

This isn't a strictly NFC change, but I don't see a simple way to add a
test for it.

llvm-svn: 272695
2016-06-14 19:06:48 +00:00
Vedant Kumar d6d4b3717e Remove stray semi-colon in *.py file, NFC
llvm-svn: 272610
2016-06-14 01:14:50 +00:00
Alex Denisov d82f494aa4 Replace hardcoded comment at 'lit.site.cfg.in'
At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266516
2016-04-16 06:54:46 +00:00
Chris Bieneman f5a7ec7a5c [OrderFiles] Don't allow lit to run dtrace multithreaded
Dtrace is implemented to try and minimize performance impact on the process being traced. This results in dtrace dropping samples if it is taking too many CPU resources. Multi-threading dtrace increases the sample drop rate dramatically.

llvm-svn: 266213
2016-04-13 17:12:56 +00:00
Chris Bieneman 834a40b463 [Perf-Training] Reworked workflow improvements for order-file generation
This is re-landing r260742. I've reworked the conditionals so that it only hits when targeting Apple platforms with ld64.

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

llvm-svn: 265864
2016-04-08 22:48:18 +00:00
Chris Bieneman 09804e275f [Perf-training] Using os.devnull instead of a temp file
This is based on post-commit feedback from Vedant. Totally didn't know that existed and worked on Windows.

Thanks Vedant!

llvm-svn: 264064
2016-03-22 16:33:23 +00:00
Chris Bieneman d4f094bb2b [Perf-training] Cleanup based on feedback from Sean Silvas
Sean provided feedback based on r257934 on cfe-commits. This change addresses that feedback.

llvm-svn: 264063
2016-03-22 16:27:35 +00:00
Chris Bieneman b6f7efa71f [Perf-training] Fixing an issue with multi-threading PGO generation
When LIT parallelizes the profraw file generation we need to generate unique temp filenames then clean them up after the driver executes.

llvm-svn: 264021
2016-03-22 02:55:40 +00:00
Chris Bieneman 12fd02db6b [Perf-training] Adding support for tests to skip the clang driver
This patch adds a new set of substitutions to the lit run lines for order files and PGO generation which run the clang driver to get the cc1 command, then execute the cc1 command directly. This allows the scripts to bypass profiling the clang driver over and over again.

The approach in this patch was discussed via IRC with Sean Silvas.

Special thanks to Daniel Dunbar whose out-of-tree code I liberally plagiarized.

llvm-svn: 263997
2016-03-21 22:37:14 +00:00
Chandler Carruth ce55f56fbc [cmake] Revert r260742 (and r260744) to improve order file support.
This appears to be passing '-Wl,-order_file' to Linux link commands,
which then causes the linker to silently, behind the scenes, write the
output to 'rder_file' instead of somewhere else. Will work with Chris to
figure out the proper support for this, but so far there are numerous
people who can't get Clang to update when they build because of this.

llvm-svn: 261054
2016-02-17 02:13:35 +00:00
Chris Bieneman 3878bc4a33 [CMake] Improve the clang order-file generation workflow
Summary:
This commit re-lands r259862. The underlying cause of the build breakage was an incorrectly written capabilities test. In tools/Driver/CMakeLists.txt I was attempting to check if a linker flag worked, the test was passing it to the compiler, not the linker. CMake doesn't have a linker test, so we have a hand-rolled one.

Original Patch Review: http://reviews.llvm.org/D16896

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16999

llvm-svn: 260742
2016-02-12 21:36:55 +00:00
Chris Bieneman dc76e70b2a Revert "[CMake] Improve the clang order-file generation workflow"
This reverts commit r259862, and attempts to fix builder CMakeCaches.

Will try this again some other time...

Conflicts:

	CMakeLists.txt
	tools/driver/CMakeLists.txt

llvm-svn: 259872
2016-02-05 03:40:37 +00:00
Chris Bieneman 1681091991 [CMake] Improve the clang order-file generation workflow
Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16896

llvm-svn: 259862
2016-02-05 01:22:03 +00:00
Chris Bieneman 3f746e67df [CMake] Fix bots broken by including order file generation in check-all
llvm-svn: 257948
2016-01-15 22:44:18 +00:00
Chris Bieneman 6c33fc1ee0 [CMake] [Order-files] Use print_function as an attempt at being forward compatible.
Based on feedback from bogner.

llvm-svn: 257936
2016-01-15 21:30:06 +00:00
Chris Bieneman d8b5bde5d6 [CMake] Support generation of linker order files using dtrace
Summary:
This patch extends the lit-based perf-training tooling supplied for PGO data generation to also generate linker order files using dtrace.

This patch should work on any system that has dtrace. If CMake can find the dtrace tool it will generate a target 'generate-order-file' which will run the per-training tests wrapped by dtrace to capture function entries. There are several algorithms implemented for sorting the order files which can be experimented with for best performance. The dtrace wrapper also supports bot oneshot and pid probes.

The perf-helper.py changes to support order file construction are ported from internal changes by ddunbar; he gets all the credit for the hard work here, I just copy and pasted.

Note: I've tested these patches on FreeBSD and OS X 10.10.

Reviewers: ddunbar, bogner, silvas

Subscribers: llvm-commits, emaste

Differential Revision: http://reviews.llvm.org/D16134

llvm-svn: 257934
2016-01-15 21:21:12 +00:00
Chris Bieneman 2281622685 [CMake] Fixing a typo in a flag
Turns out cc1's flag has 1 - not 2...

llvm-svn: 256070
2015-12-19 00:56:12 +00:00
Chris Bieneman de879caeb8 [CMake] PGO training data
Adding in a few more lit substitutions for cc1 and the test exec path.

llvm-svn: 256057
2015-12-18 23:00:57 +00:00
Chris Bieneman ae5433907a [CMake] Add support for generating profdata for clang from training files
Summary:
This patch adds support for using LIT to drive generating PGO profile data for clang.

This first pass implementation should work on Linux and Unix based platforms. If you build clang using CMake with LLVM_BUILD_INSTRUMENTED=On the CMake build generates a generate-profdata target that will use the just-built clang to build any test files (see hello_world.cpp as an example). Each test compile will generate profraw files for each clang process. After all tests have run CMake will merge the profraw files using llvm-profdata.

Future opportunities for extension:
* Support for Build->Profile->Build bootstrapping
* Support for linker order file generation using a similar mechanism and the same training data
* Support for Windows

Reviewers: dexonsmith, friss, bogner, cmatthews, vsk, silvas

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15462

llvm-svn: 255740
2015-12-16 01:02:44 +00:00