Commit Graph

905 Commits

Author SHA1 Message Date
Karoy Lorentey
bd9a22099a [benchmark] Random(), SRand() → LFSR.init(), .next() 2021-09-15 22:08:07 -07:00
Karoy Lorentey
203dc55b60 [benchmark] CheckResults → check
Capitalizing function names is against Swift naming conventions.
2021-09-15 22:08:07 -07:00
LucianoAlmeida
c3c1e6df8d [Benchmarks][stdlib] Adding an extra benchmark for set isDisjoint for disjoint sets of different size 2021-09-12 21:56:54 -03:00
swift-ci
65244f042f Merge pull request #38827 from glessard/buffer-benchmarks 2021-08-12 17:08:16 -07:00
Guillaume Lessard
49ae2dd64b Update benchmark/single-source/BufferFill.swift
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2021-08-12 12:49:25 -06:00
Guillaume Lessard
e06d03e860 [benchmark] initialize an UMBP<UInt8> from an URBP 2021-08-10 18:33:46 -06:00
David Smith
376c0293fe Merge pull request #38818 from Catfish-Man/home-home-on-the-rangeofstring
Add benchmarks exercizing bridged rangeOfString more thoroughly
2021-08-10 00:16:31 -07:00
David Smith
15b55bfe4b Rename and rescale benchmarks 2021-08-09 17:59:03 -07:00
David Smith
847047e867 Add benchmarks exercizing bridged rangeOfString more thoroughly in preparation for adding a native version 2021-08-09 16:18:28 -07:00
Guillaume Lessard
210ade36d6 add a reference to a bugs.swift.org report 2021-07-28 10:15:29 -06:00
Guillaume Lessard
314220ff07 benchmarks of performance when filling memory buffers 2021-07-28 01:58:33 -06:00
Michael Gottesman
804bcac1e6 [assembly-vision] Change release to do backwards then forwards when inferring source locs.
TLDR: I fixed a whole in the assembly-vision opt-remark pass where we were not
emitting a remark for end of scope instructions at the beginning of blocks. Now
all of these instructions (strong_release, end_access) should always reliably
have a remark emitted for them.

----

I think that this is a pragmatic first solution to the problem of
strong_release, release_value being the first instruction of a block. For those
who are unaware, this issue is that for a long time we have searched backwards
first for "end of scope" like instructions. This then allows us to identify the
"end of scope" instruction as happening at the end of the previous statement
which is where the developer thinks it should be:

```
var global: Klass
func bar() -> @owned Klass { global }
func foo() {
   // We want the remark for the
   bar()                          // expected-remark {{retain}}
}
```

This makes sense since we want to show end of scope instructions as being
applied to the earlier code whose scope it is ending. We can be clear that it is
at the end of the statement by placing the carrot on the end of statement
SourceLoc so there isn't any confusion upon whether or not

That generally has delivered nice looking results, but what if our release is
the first instruction in the block? In that case, we do not have any instruction
that we can immediately use, so traditionally we just gave up and didn't emit
anything. This is not an acceptable solution! We should be able to emit
something for every retain/release in the program if we want users to be able to
rely upon this! Thus we need to be able to get source location information from
somewhere around

First before we begin, my approach here is informed by my seeing over time that
the optimizer does a pretty good job of not breaking SourceLoc info for
terminators.

With that in mind, there are two possible approaches here: using the terminator
from the previous block and searching forward at worst taking the SourceLoc of
the current block's terminator (or earlier if we find a good SourceLoc). I
wasn't sure what the correct thing to do was at the time so I didn't fix the
issue. After some thought, I realized that the correct solution is to if we fail
a backwards search, search forwards. The reason why is that since our remarks
runs late in the optimization pipeline, there is a very high likelihood that if
we aren't folded into our previous block that there is a true need in the
program for conditional control flow here. We want to avoid placing the release
out of such pieces of code since it is misleading to the user:

```

In this example there is a release inside the case for .x but none for .y. In
that case it is possible that we get a release for .f since payload is passed in
at +1 at SILGen time. In such a case, using the terminator of the previous block
would mean that we would have the release be marked as on payload instead of
inside the case of .x. By using the terminator of the releases block, we can

switch payload {
case let .x(f):
  ...
case let .y:
  ...
}
```

So using the terminator from the previous block would be
  misleading to the user. Instead it is better to pick a location after the release that way
  we know at least the instruction we are inferring from must in some sense be

With this fix, we should not emit locations for all retains, releases. We may
not identify a good source loc for all of them, but we will identify them.

optimization pipeline, if our block was not folded into the previous block there
is a very high liklihood that there is some sort of conditional control flow
that is truly necessary in the program. If we

this
generally implies that there is a real side effect in the program that is
requiring conditional code execution (since the optimizer would have folded it).

The reason why is that we are at least going to hit a terminator or a
side-effect having instruction that generally have debug info preserved by the
optimizer.
2021-07-02 11:51:09 -07:00
Stephen Canon
f538b49fc9 Use the "nearly divisionless" algorithm on all targets. (#37920)
* Use the "nearly divisionless" algorithm on all targets.

We have multipliedFullWidth available everywhere now, so we don't need to carry around the old implementation on 32b targets.

Also adds a few more benchmarks for random number generation.

* Obscure the range boundaries for some of the new random value benchmarks.

When these are visible compile-time constants, the compiler is smart enough to evaluate the division in the "nearly divisionless" algorithm, which makes it completely divisionless. That's good, but it obscures what the runtime performance of the algorithm will be when the bounds are _not_ available as compile-time constants. Thus, for some of the newly-added benchmarks, we pass the upper bound through `identity` to hide it from the optimizer (this is imperfect, but it's the simplest tool we have).

We don't want to do this for all the tests for two reasons:
- compile-time constant bounds are a common case that should still be reflected in our testing
- we don't want to perturb existing benchmark results more than we have to.
2021-06-15 20:27:49 -04:00
Stephen Canon
9ddbd56d32 Simd random mask benchmark (#36579)
* Add benchmark for SIMDMask.random generation.

* Add bitcast for IntN -> VecNxInt1
2021-03-25 08:54:40 -04:00
Stephen Canon
b972d31458 Use correct setup for Int8 2021-03-19 18:47:37 -04:00
Stephen Canon
22f4c4553a Update benchmark naming. 2021-03-19 15:08:41 -04:00
Stephen Canon
13812776cc Some initial benchmarks for simd integer arithmetic. 2021-03-19 11:19:35 -04:00
Michael Ilseman
4fe6873c72 [benchmark] Conform to naming and timing conventions 2021-03-06 09:01:09 -07:00
Michael Ilseman
4612a5b02f [benchmark] Cleanup and bug fix 2021-03-05 17:26:29 -07:00
Michael Ilseman
73af20fdbf [benchmark] Add StringSplitting and lines benchmarks
Add a new benchmark module StringSplitting for split-like benchmarking.

Add lineSink benchmarks, which separates Unicode content by lines and feeds
Strings into a sink.
2021-03-04 17:20:12 -07:00
Michael Ilseman
288a0db849 Merge pull request #36018 from Lukasa/cb-add-naive-whitespace-trim-benchmark
Add Substring benchmark for naive ACSII whitespace trimming.
2021-02-24 08:24:42 -07:00
Richard Wei
0b53a02544 [AutoDiff] Rename 'in:' to 'of:' in differential operators.
Rename the argument label `in:` in `gradient(at:in:)`, `pullback(at:in:)`, etc to `of:`, as suggested in the [pitch thread](https://forums.swift.org/t/differentiable-programming-for-gradient-based-machine-learning/42147).
2021-02-24 01:33:42 -05:00
Cory Benfield
69a8e73966 Add Substring benchmark for naive ACSII whitespace trimming.
This is derived from swift-nio-http2's codebase, which contains this
unfortunate code for trimming ASCII whitespace.
2021-02-19 17:26:53 +00:00
zoecarver
cbfe358065 [benchmark] Add "StringSwitch" benchmark to match "StringEnum".
This benchmark compares 184 strings in a string-based switch statement.
This will be used to test #28260.
2021-01-04 11:33:57 -08:00
Richard Wei
b8581cb83b [AutoDiff] Add differentiation benchmarks (#34901)
* Add differentiation benchmarks.
* Make install name of _Differentiation be @rpath/libswift_Differentiation.dylib.

Co-authored-by: Marc Rasi <marcrasi@google.com>
2020-12-02 12:26:31 -08:00
Micah Benn
25bd5eaed7 Fix styling, optimize 2020-11-09 17:04:59 -06:00
Micah Benn
477bef7dfc Condense benchmarks 2020-11-06 20:11:16 -06:00
Micah Benn
6f103c63b2 Pre-construct indexPath, use setUpFunction 2020-11-02 00:29:30 -06:00
Micah Benn
55b3b34dcc Decrease load 16x, fix naming, fix mem usage
Fixes mem usage of run_IndexPathSubscriptRangeMutation
2020-11-01 23:05:00 -06:00
Micah Benn
fe5d2762f0 Apply swift-format 2020-11-01 19:20:08 -06:00
Micah Benn
13a638532f Fix indentation, move params to new line 2020-11-01 15:25:30 -06:00
Micah Benn
e69b71f4ec Update per style guildelines 2020-11-01 15:07:24 -06:00
Micah Benn
3d40513acb Fix formatting 2020-11-01 09:07:27 -06:00
Micah Benn
71784065cb Add IndexPath benchmarks
Add benchmarks for subscripts, max, min
2020-11-01 08:39:51 -06:00
Andrew Trick
d43c1cc059 Merge pull request #34042 from atrick/verify-chacha
Add result checking to the ChaCha benchmark.
2020-09-24 00:01:45 -07:00
Andrew Trick
eef1cf6688 Add result checking to the ChaCha benchmark.
This benchmark was being miscompiled for some time and
we did not catch it. I only noticed because a correcteness
fix caused a regression.
2020-09-23 21:12:02 -07:00
Xiaodi Wu
cb96bfbfdf [benchmark] Tweak naming and workload for two new tests 2020-09-16 21:38:19 -04:00
Xiaodi Wu
26f3c81e44 [benchmark] Add another floating point conversion benchmark 2020-09-16 19:32:13 -04:00
Xiaodi Wu
94887747a4 [benchmark] Add another test to floating point conversion benchmark 2020-09-16 19:05:09 -04:00
Xiaodi Wu
41d0e2937b [benchmark] Add benchmark for generic floating-point to integer conversion (#33895)
* [benchmark] Add a benchmark for generic floating-point to integer conversion

* [benchmark] Increase workload on new benchmark before merging
2020-09-15 17:15:24 -04:00
Xiaodi Wu
6a85fa7509 [benchmark] Delete two benchmarks and add generic floating-point conversion lit tests 2020-09-08 13:10:24 -04:00
Suyash Srijan
3692751690 [Benchmark] Fix build failure on armv7 by guarding Float80 availability 2020-09-07 01:23:00 +01:00
Xiaodi Wu
44a7038f9e [benchmark] Address review comments on FP conversion benchmarks 2020-09-05 11:27:54 -04:00
Xiaodi Wu
60b7c578c4 [benchmark] Add mock floating-point types for conversion benchmarks 2020-09-04 23:47:10 -04:00
Xiaodi Wu
514dce144f Update copyright year on benchmark and its template 2020-09-04 15:02:38 -04:00
Xiaodi Wu
65a547c4e6 [benchmark] Add new benchmark for floating-point conversion 2020-09-04 13:42:47 -04:00
Mike Ash
60e12f109d Add a benchmark for protocol conformance testing. 2020-08-14 15:32:51 -04:00
tbkka
2c8ae98e5e Python3 compatibility for Benchmarks (#33039)
Three issues addressed here:

1. Dependency on dictionary iteration order

 CharacterProperties.swift.gyb iterated a dictionary to produce its output.
 Changed this to a list of tuples to ensure the order is predictable.

2. Python3 `map` returns an iterator, not a list

 Changed a bunch of `map` calls to `list(map(...))` to ensure the result is a list

3. Python3 `int()` expects a string, won't accept a list of characters

 Added a concatenation step that is effectively a no-op on Python2
2020-07-22 12:24:10 -07:00
tbkka
9bc5be372c Rework a couple of benchmarks to work with both Python2 and Python3 (#32905) 2020-07-15 15:16:14 -07:00
Robert Widmann
cddf73ecdb [Gardening] Clean Up OS-Test Patterns Across The Codebase
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
apple/swift-package-manager#1826.
2020-06-30 22:55:58 -07:00