Commit Graph

1638 Commits

Author SHA1 Message Date
Max Moiseev
86eeb5416b Introduce .skip tag and properly handle --skip-tags parameter 2017-10-03 10:07:50 -07:00
Max Moiseev
68cdba2df2 Use registerBenchmark for all benchmarks 2017-10-03 10:07:14 -07:00
Max Moiseev
528b3a0f3a [benchmark] Remove precommit/registered flags, add skipTags
The idea being, we need to decide what benchmarks to run solely based on
tags.

`--tag` allows to list all tags that are required;
`--skip-tags` allows to skip benchmarks that have any of those tags.

By default, skip-tags list contains .unstable and .String, which results
in the same subset of benchmarks as before.
2017-10-03 09:37:56 -07:00
Michael Gottesman
96bc70d6ad [benchmark] Update perf_test_driver for benchmark driver updates.
This ensures that Benchmark_GuardMalloc, Benchmark_RuntimeLeaksRunner, etc. all
support the new way benchmark --list outputs benchmark names.
2017-10-02 22:06:47 -07:00
Max Moiseev
cc723b9aff Minor refactoring 2017-10-02 17:10:44 -07:00
Michael Gottesman
48f4a276ba [benchmark] Only add -external suffix to targets in standalone builds where SWIFT_BENCHMARK_SUBCMAKE_BUILD is set.
This enables us to distinguish in between builds which are triggered by a
subcmake call from the main swift cmake file and one from a user who is trying
to compile the swift benchmark suite against a misc swift installation/use the
ninja file by hand.
2017-10-01 10:41:48 -07:00
swift-ci
a0a1a76cfe Merge pull request #12146 from gottesmm/add_support_for_initFunction 2017-09-28 11:05:52 -07:00
swift-ci
e72960cf65 Merge pull request #12160 from gottesmm/pr-0f176401f4123a30b554c1b4b3c97369359aad1d 2017-09-28 10:34:44 -07:00
Michael Gottesman
2a6b4fbb38 [benchmark] Re-add support for anding multiple tags by splitting on ','
As an example:

--tags=Array,cpubench

would select all tests that are both tagged as Array benchmarks and cpu
benchmarks.
2017-09-28 10:11:23 -07:00
Michael Gottesman
f7681a993a [benchmark] Add support for specifying a benchmark setUp and tearDown function via BenchmarkInfo.
The key thing here is that by providing one of these closures, a benchmark can
inject the initialization/deinitialization of its internal data structures,
outside of the time period where timing is occurring.

The intention is that this will provide us the framework for as we annotate
tests with BenchmarkInfo, to move initialization work out of benchmarks.

It will also allow for more complex benchmarks to be written such as ones that
perform bulk reads from a pipe (my interest in this).
2017-09-28 09:57:46 -07:00
Michael Gottesman
5cdd946734 [benchmark] Simplify how we filter tests down to 1 filter implementation.
Previously, we both filtered tests and marked tests as not being able to be run.
This commit rips out the marking of tests as being unable to be run (but counted
as part of the indices output by the compiler).

This also ensures benchmarks that are run are always given an ascending index
instead of sometimes having indices being skipped.
2017-09-28 09:43:20 -07:00
Michael Gottesman
dbd2168b33 Merge pull request #12148 from gottesmm/pr-48c783c75a7c505d690066c5f21b24a79ef16682
[benchmark][driver] Teach the Benchmark_Driver how to parse ./Benchmark_O{,none} --list now that tags are output as well.
2017-09-28 03:18:07 -07:00
Michael Gottesman
dfc780a744 [benchmark][driver] Teach the Benchmark_Driver how to parse ./Benchmark_O{,none} --list now that tags are output as well. 2017-09-27 19:14:52 -07:00
Michael Gottesman
37c8052494 [benchmark] Change DriverUtils.Test to contain a BenchmarkInfo struct instead of destructuring a BenchmarkInfo.
This will allow me to add support for running an initFunction before running
samples.
2017-09-27 12:46:38 -07:00
Michael Gottesman
8a69de7332 [benchmark] Have legacy tests use BenchmarkInfo and combine this with registered benches.
*NOTE* We always prefer a registered benchmark if we have one.

I am going to use BenchmarkInfo to solve the "create data for benchmark while we
are already timing" problem. I am going to add a field to BenchmarkInfo that if
it is not-null is called before we start measuring time. This closure can be
used to initialize any global data structures/etc.

But to do this, I need to be able to combine the registered and legacy
not-registered benchmarks.
2017-09-27 12:46:38 -07:00
Andrew Trick
a4f4b72e4e Stip .abstraction tag from most benchmarks.
Only use the .abstraction tag for benchmarks that are primarilly stressing the
optimization of a specific kind of abstraction. Then I can use these as CPU
benchmarks.

Previously this tag was applied to any benchmark that happened to involve
classes or protocols. When a compiler engineer changes something that might
affect codegen in these cases, they should simply benchmark the entire stable
suite. There's no value in having a separate set of 97 "abstraction" benchmarks
that are primarilly testing something else, like a stdlib API.
2017-09-27 11:06:10 -07:00
Michael Gottesman
f1e6e86a9e [benchmark] Eliminate a multiple ternary operator in favor of a closure.
These are really hard to read naively.
2017-09-27 10:02:07 -07:00
Michael Gottesman
77acbe82b7 [benchmark] Rename BenchmarkCategories => BenchmarkCategory.
This is an enum that represents a single category of benchmarks. Per the API
guidelines this should really be singular.
2017-09-26 19:28:34 -07:00
Michael Gottesman
45b1609c23 [benchmark] Make BenchmarkCategories a StringEnum.
This ensures that we get BenchmarkCategories <-> String for free and enables the
code that implemented that transform to be deleted.
2017-09-26 19:28:05 -07:00
Michael Gottesman
d7f4c99696 [benchmark] Update DriverUtils to match the API guidelines closer. 2017-09-26 19:04:22 -07:00
Michael Gottesman
d6c6ba722a [benchmark] Add some comments to BenchmarkInfo's properties. 2017-09-26 19:04:22 -07:00
Michael Gottesman
7a188c6039 [benchmark] Add PrimsSplit a multi source version of the Prims benchmark.
This will enable us to at least validate on swift.org that the multisource
benchmark stuff is working.

rdar://34556274
2017-09-25 19:27:56 -07:00
Michael Gottesman
a36c649429 [benchmark] We need the module_name in swift_benchmark_compile_archopts to look up sources.
This solves problems relating to the SOURCES variable not finding anything
files. module_name expanded to nothing so:

  ${${module_name}_sources} -> ${_sources} -> ''

Now we handle this properly.

rdar://34556274
2017-09-25 19:27:56 -07:00
Michael Gottesman
5dfbec05c4 [benchmark] Allow for swift3 and swift4 multi source benchmarks
rdar://34556274
2017-09-25 15:26:43 -07:00
Michael Gottesman
1b960d58b7 [benchmark] Extract multisource benchmark cmake code into helper functions.
This is the next step in allowing (at least the multi-source benchmarks) to
compile swift 4 and swift 3 in a nice way.

rdar://34556274
2017-09-25 14:16:39 -07:00
Michael Gottesman
c2d8cc7ff0 [benchmark] Add support for building out of tree via build-script against the just built swift.
I recently broke the out of tree build by mistake [its fixed now ; )]. This
inspired me to make it easy to test this behavior by adding support to
build-script/cmake/etc for running an external benchmark build via
AddExternalProjects.

Now I can just call build-script with --build-external-benchmarks and thats it!
It should just work! It already helped me to avoid breaking the external build
twice!

I hope that eventually we get this on a bot to make sure it keeps working [or
even added to the smoke tests ; )].

*NOTE* This is disabled by default so it will not affect normal builds.

*NOTE* This just builds the external benchmarks. There is an rpath issue that
prevents you from running them (the benchmarks have the rpath set as if they are
next to the stdlib, but they are not. This can be fixed in a few different ways,
but I do not have time to finish implementing it = (. But this commit is a good
first step and at least detects build errors.
2017-09-25 12:31:39 -07:00
Michael Gottesman
574b05d252 Merge pull request #12092 from gottesmm/recommit_benchmark_changes_with_precondition
Recommit benchmark changes with precondition
2017-09-25 10:46:15 -07:00
Michael Gottesman
84f5446a78 Revert "Reverting benchmark cmake changes. They break out-of-tree benchmark builds, which is used by some bots"
This reverts commit db21063afa.
2017-09-24 23:19:25 -07:00
Michael Gottesman
d04f97a3f0 [benchmark][cmake] Provide our own precondition impl.
This ensures that we have a precondition implementation both when building in
tree and out of tree.
2017-09-24 23:19:25 -07:00
Michael Gottesman
83ae78727d [benchmark][cmake] Implement IS_SWIFT_BUILD correctly and rename it to SWIFT_BENCHMARK_BUILT_STANDALONE. 2017-09-24 22:53:50 -07:00
Andrew Trick
7a4adbe980 Fix enum indentation. 2017-09-22 21:44:05 -07:00
Andrew Trick
3560ad2203 Register AnyHashableWithAClass benchmark. 2017-09-22 21:25:46 -07:00
Andrew Trick
e7edd270e5 Register PolymorphicCalls benchmark. 2017-09-22 21:11:30 -07:00
Andrew Trick
a6dcdfda29 Register SevenBoom benchmark. 2017-09-22 21:06:51 -07:00
Andrew Trick
d38e8da6a2 Register the LinkedList benchmark. 2017-09-22 20:51:46 -07:00
Andrew Trick
c0ffc0d451 Register the Exclusivity benchmark. 2017-09-22 20:43:23 -07:00
Joe Shajrawi
ca6ccb4864 Benchmark categorization support 2017-09-22 17:39:04 -07:00
Andrew Trick
78b072b4da Add a CPU microbenchmarks for isUniquelyReferenced. 2017-09-22 16:38:49 -07:00
Andrew Trick
2e60052d1d ObjectAllocation is a .cpubench. 2017-09-22 14:52:47 -07:00
Andrew Trick
d9af4c5f45 Introduce BenchmarkInfo and BenchmarkCategories. 2017-09-22 12:49:59 -07:00
Andrew Trick
cc1165fc43 Benchmark cmake: DriverUtils will depend on TestsUtils. 2017-09-22 12:49:59 -07:00
Andrew Trick
aaece4f1f2 Remove benchmark CMakeLists and main.swift from gyb.
When a benchmark is added, it's name will be manually added to CMakeLists and
main.swift.

Adding a benchmark no longer requires discovering a nonobvious script.

If the build works locally, then it will work everywhere else.

Note that generate_harness.py should now be renamed to generate_benchmarks.py,
but I think it's name may be hard-coded somewhere in the compiler tests. Anyway,
this script should go away as soon as someone fixes the cmake configuration to
automatically run gyb.
2017-09-22 12:49:59 -07:00
Andrew Trick
e53451a98b cmake: Benchmarks need to build as a separate project (out-of-tree). 2017-09-22 12:49:59 -07:00
Erik Eckstein
db21063afa Reverting benchmark cmake changes. They break out-of-tree benchmark builds, which is used by some bots
Revert "Refactor out the creation of the benchmark libraries into a helper routine swift_benchmark_library. Initially just use it for DriverUtils."

This reverts commit ac539730e4. (+3 squashed commits)
Squashed commits:
[755f057] Revert "[benchmark][cmake] Refactor the swift benchmark helper libraries to use swift_benchmark_library."

This reverts commit a82945e033.
[58e09c6] Revert "[benchmark][cmake] "swift_benchmark_library" => "add_swift_benchmark_library"."

This reverts commit 0e4b7b69cd.
[5f5f2c1] Revert "[benchmark][cmake] Fix typo. This is NFC since this option is usually disabled."

This reverts commit 30f4b1b3e5.
2017-09-21 17:34:04 -07:00
Michael Gottesman
30f4b1b3e5 [benchmark][cmake] Fix typo. This is NFC since this option is usually disabled. 2017-09-20 17:25:47 -07:00
Michael Gottesman
0e4b7b69cd [benchmark][cmake] "swift_benchmark_library" => "add_swift_benchmark_library".
This matches the names used in the rest of our cmake.

rdar://34556274
2017-09-20 17:25:47 -07:00
Michael Gottesman
a82945e033 [benchmark][cmake] Refactor the swift benchmark helper libraries to use swift_benchmark_library.
rdar://34556274
2017-09-20 17:25:42 -07:00
Michael Gottesman
ac539730e4 Refactor out the creation of the benchmark libraries into a helper routine swift_benchmark_library. Initially just use it for DriverUtils.
This will allow for per-benchmark flags to be added.

rdar://34556274
2017-09-20 16:36:48 -07:00
Erik Eckstein
d6f6774214 benchmarks: add a benchmark for string enum construction from a string raw value. 2017-09-18 17:50:24 -07:00
Erik Eckstein
9e432294e1 benchmarks: fix warnings
rdar://problem/33660902
2017-08-01 17:47:16 -07:00