Skip to content

Commit 2e26a5f

Browse files
---
yaml --- r: 313213 b: refs/heads/tensorflow-merge c: 009d0e5 h: refs/heads/master i: 313211: 460a614
1 parent 59f7965 commit 2e26a5f

38 files changed

+270
-706
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ refs/heads/chase-my-tail: 8bb91443a9e81bbfac92a2621a0af887a1da8dbf
13791379
refs/heads/consider-outer-alternatives: 708bac749ec60a22a79e2eefbe734f9488a7370d
13801380
refs/heads/revert-25740-oops-i-linked-it-again: fdd41aeb682fc488572bdc1cf71b2ff6997ba576
13811381
refs/heads/swift-5.1-branch-06-12-2019: e63b7b2d3b93c48232d386099d0ec525d21d8f8d
1382-
refs/heads/tensorflow-merge: 05d2ef22b8c27e1bf07a4c4f5d5765e59bb8a7ee
1382+
refs/heads/tensorflow-merge: 009d0e548107fc5405a3c3c565563d8a66efec60
13831383
refs/heads/update-checkout-sha-info: 5832743c5c2a842976c42a508a4c6dcceefb0aef
13841384
refs/tags/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-12-a: 228f0448d9bb909aacbba4afcb7c600a405d15da
13851385
refs/tags/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-14-a: 922861a77b5fc2bf46bc917da70ceb15eef76836

branches/tensorflow-merge/benchmark/Package.swift

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:4.2
22

33
import PackageDescription
44
import Foundation
@@ -9,15 +9,10 @@ unsupportedTests.insert("ObjectiveCBridging")
99
unsupportedTests.insert("ObjectiveCBridgingStubs")
1010
#endif
1111

12-
//===---
13-
// Single Source Libraries
14-
//
15-
16-
/// Return the source files in subDirectory that we will translate into
17-
/// libraries. Each source library will be compiled as its own module.
18-
func getSingleSourceLibraries(subDirectory: String) -> [String] {
12+
// This is a stop gap hack so we can edit benchmarks in Xcode.
13+
let singleSourceLibraries: [String] = {
1914
let f = FileManager.`default`
20-
let dirURL = URL(fileURLWithPath: subDirectory)
15+
let dirURL = URL(fileURLWithPath: "single-source").absoluteURL
2116
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
2217
includingPropertiesForKeys: nil)
2318
return fileURLs.compactMap { (path: URL) -> String? in
@@ -30,45 +25,27 @@ func getSingleSourceLibraries(subDirectory: String) -> [String] {
3025
return nil
3126
}
3227

33-
let name = String(c[0])
28+
let s = String(c[0])
3429

3530
// We do not support this test.
36-
if unsupportedTests.contains(name) {
31+
if unsupportedTests.contains(s) {
3732
return nil
3833
}
3934

40-
return name
35+
assert(s != "PrimsSplit")
36+
return s
4137
}
42-
}
43-
44-
var singleSourceLibraryDirs: [String] = []
45-
singleSourceLibraryDirs.append("single-source")
46-
47-
var singleSourceLibraries: [String] = singleSourceLibraryDirs.flatMap {
48-
getSingleSourceLibraries(subDirectory: $0)
49-
}
38+
}()
5039

51-
//===---
52-
// Multi Source Libraries
53-
//
54-
55-
func getMultiSourceLibraries(subDirectory: String) -> [(String, String)] {
40+
let multiSourceLibraries: [String] = {
5641
let f = FileManager.`default`
57-
let dirURL = URL(string: subDirectory)!
58-
let subDirs = try! f.contentsOfDirectory(at: dirURL, includingPropertiesForKeys: nil)
59-
return subDirs.map { (subDirectory, $0.lastPathComponent) }
60-
}
61-
62-
var multiSourceLibraryDirs: [String] = []
63-
multiSourceLibraryDirs.append("multi-source")
64-
65-
var multiSourceLibraries: [(parentSubDir: String, name: String)] = multiSourceLibraryDirs.flatMap {
66-
getMultiSourceLibraries(subDirectory: $0)
67-
}
68-
69-
//===---
70-
// Products
71-
//
42+
let dirURL = URL(fileURLWithPath: "multi-source").absoluteURL
43+
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
44+
includingPropertiesForKeys: nil)
45+
return fileURLs.map { (path: URL) -> String in
46+
return path.lastPathComponent
47+
}
48+
}()
7249

7350
var products: [Product] = []
7451
products.append(.library(name: "TestsUtils", type: .static, targets: ["TestsUtils"]))
@@ -77,15 +54,9 @@ products.append(.library(name: "DriverUtils", type: .static, targets: ["DriverUt
7754
products.append(.library(name: "ObjectiveCTests", type: .static, targets: ["ObjectiveCTests"]))
7855
#endif
7956
products.append(.executable(name: "SwiftBench", targets: ["SwiftBench"]))
80-
57+
products.append(.library(name: "PrimsSplit", type: .static, targets: ["PrimsSplit"]))
8158
products += singleSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
82-
products += multiSourceLibraries.map {
83-
return .library(name: $0.name, type: .static, targets: [$0.name])
84-
}
85-
86-
//===---
87-
// Targets
88-
//
59+
products += multiSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
8960

9061
var targets: [Target] = []
9162
targets.append(.target(name: "TestsUtils", path: "utils", sources: ["TestsUtils.swift"]))
@@ -102,7 +73,7 @@ swiftBenchDeps.append(.target(name: "ObjectiveCTests"))
10273
#endif
10374
swiftBenchDeps.append(.target(name: "DriverUtils"))
10475
swiftBenchDeps += singleSourceLibraries.map { .target(name: $0) }
105-
swiftBenchDeps += multiSourceLibraries.map { .target(name: $0.name) }
76+
swiftBenchDeps += multiSourceLibraries.map { .target(name: $0) }
10677

10778
targets.append(
10879
.target(name: "SwiftBench",
@@ -121,27 +92,20 @@ var singleSourceDeps: [Target.Dependency] = [.target(name: "TestsUtils")]
12192
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
12293
singleSourceDeps.append(.target(name: "ObjectiveCTests"))
12394
#endif
124-
125-
targets += singleSourceLibraries.map { name in
126-
return .target(name: name,
95+
targets += singleSourceLibraries.map { x in
96+
return .target(name: x,
12797
dependencies: singleSourceDeps,
12898
path: "single-source",
129-
sources: ["\(name).swift"])
99+
sources: ["\(x).swift"])
130100
}
131-
132-
targets += multiSourceLibraries.map { lib in
133-
return .target(
134-
name: lib.name,
101+
targets += multiSourceLibraries.map { x in
102+
return .target(name: x,
135103
dependencies: [
136104
.target(name: "TestsUtils")
137105
],
138-
path: lib.parentSubDir)
106+
path: "multi-source/\(x)")
139107
}
140108

141-
//===---
142-
// Top Level Definition
143-
//
144-
145109
let p = Package(
146110
name: "swiftbench",
147111
products: products,

branches/tensorflow-merge/benchmark/README.md

Lines changed: 18 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Swift Benchmark Suite
1+
Swift Benchmark Suite
2+
=====================
23

34
This directory contains the Swift Benchmark Suite.
45

5-
## Running Swift Benchmarks
6+
Running Swift Benchmarks
7+
------------------------
68

79
To run Swift benchmarks, pass the `--benchmark` flag to `build-script`. The
810
current benchmark results will be compared to the previous run's results if
@@ -14,17 +16,8 @@ impacting changes, and run the benchmarks again. Upon benchmark completion, the
1416
benchmark results for the development branch will be compared to the most
1517
recent benchmark results for `master`.
1618

17-
## Building the Swift Benchmarks
18-
19-
The swift benchmark suite currently supports building with CMake and
20-
SwiftPM. We support the following platforms respectively.
21-
22-
* CMake: macOS, iOS, tvOS, watchOS
23-
* SwiftPM: macOS, linux
24-
25-
We describe how to build both standalone and with build-script below.
26-
27-
### build-script invoking CMake
19+
Building with build-script
20+
--------------------------
2821

2922
By default, Swift benchmarks for OS X are compiled during the Swift build
3023
process. To build Swift benchmarks for additional platforms, pass the following
@@ -40,7 +33,8 @@ drivers dynamically link Swift standard library dylibs from a path
4033
relative to their run-time location (../lib/swift) so the standard
4134
library should be distributed alongside them.
4235

43-
### CMake Standalone (no build-script)
36+
Building Independently
37+
----------------------
4438

4539
To build the Swift benchmarks using only an Xcode installation: install an
4640
Xcode version with Swift support, install cmake 2.8.12, and ensure Xcode is
@@ -116,57 +110,8 @@ installed libraries instead, enable
116110
This will reflect the performance of the Swift standard library
117111
installed on the device, not the one included in the Swift root.
118112

119-
### build-script using SwiftPM+LLBuild
120-
121-
To build the benchmarks using build-script/swiftpm, one must build both
122-
swiftpm/llbuild as part of one's build and create a "just-built" toolchain. This
123-
toolchain is then used by build-script to compile the benchmarks. This is
124-
accomplished by passing to build-script the following options:
125-
126-
```
127-
swift-source$ swift/utils/build-script --swiftpm --llbuild --install-swift --install-swiftpm --install-llbuild --toolchain-benchmarks
128-
```
129-
130-
build-script will then compile the toolchain and then build the benchmarks 3
131-
times, once for each optimization level, at the path
132-
`./build/benchmarks-$PLATFORM-$ARCH/bin/Benchmark_$OPT`:
133-
134-
### Standalone SwiftPM/LLBuild
135-
136-
The benchmark suite can be built with swiftpm/llbuild without needing any help
137-
from build-script by invoking swift build in the benchmark directory:
138-
139-
```
140-
swift-source/swift/benchmark$ swift build -configuration release
141-
swift-source/swift/benchmark$ .build/release/SwiftBench
142-
#,TEST,SAMPLES,MIN(μs),MAX(μs),MEAN(μs),SD(μs),MEDIAN(μs)
143-
1,Ackermann,1,169,169,169,0,169
144-
2,AngryPhonebook,1,2044,2044,2044,0,2044
145-
...
146-
```
147-
148-
## Editing in Xcode
149-
150-
It is now possible to work on swiftpm benchmarks in Xcode! This is done by using
151-
the ability swiftpm build of the benchmarks to generate an xcodeproject. This is
152-
done by running the commands:
153-
154-
```
155-
swift-source/swift/benchmark$ swift package generate-xcodeproj
156-
generated: ./swiftbench.xcodeproj
157-
swift-source/swift/benchmark$ open swiftbench.xcodeproj
158-
```
159-
160-
Assuming that Xcode is installed on ones system, this will open the project in
161-
Xcode. The benchmark binary is built by the target 'SwiftBench'.
162-
163-
**NOTE: Files added to the Xcode project will not be persisted back to the
164-
package! To add new benchmarks follow the instructions from the section below!**
165-
166-
**NOTE: By default if one just builds/runs the benchmarks in Xcode, the
167-
benchmarks will be compiled with -Onone!**
168-
169-
## Using the Benchmark Driver
113+
Using the Benchmark Driver
114+
--------------------------
170115

171116
### Usage
172117

@@ -209,39 +154,32 @@ You can use test numbers instead of test names like this:
209154
Test numbers are not stable in the long run, adding and removing tests from the
210155
benchmark suite will reorder them, but they are stable for a given build.
211156

212-
## Using the Harness Generator
157+
Using the Harness Generator
158+
---------------------------
213159

214160
`scripts/generate_harness/generate_harness.py` runs `gyb` to automate generation
215161
of some benchmarks.
216162

217163
** FIXME ** `gyb` should be invoked automatically during the
218164
build so that manually invoking `generate_harness.py` is not required.
219165

220-
## Adding New Benchmarks
166+
Adding New Benchmarks
167+
---------------------
221168

222-
Adding a new benchmark requires some boilerplate updates. To ease this (and
223-
document the behavior), a harness generator script is provided for both
224-
single/multiple file tests.
169+
The harness generator supports both single and multiple file tests.
225170

226-
To add a new single file test, execute the following script with the new of the
227-
benchmark:
171+
To add a new single file test, execute the following script with the new of the benchmark:
228172

229173
```
230174
swift-source$ ./swift/benchmark/scripts/create_benchmark.py YourTestNameHere
231175
```
232176

233177
The script will automatically:
234-
235178
1. Add a new Swift file (`YourTestNameHere.swift`), built according to
236179
the template below, to the `single-source` directory.
237180
2. Add the filename of the new Swift file to `CMakeLists.txt`.
238181
3. Edit `main.swift` by importing and registering your new Swift module.
239182

240-
No changes are needed to the Package.swift file since the benchmark's
241-
Package.swift is set to dynamically lookup each Swift file in `single-source`
242-
and translate each of those individual .swift files into individual modules. So
243-
the new test file will be automatically found.
244-
245183
To add a new multiple file test:
246184

247185
1. Add a new directory and files under the `multi-source` directory as
@@ -262,9 +200,6 @@ To add a new multiple file test:
262200

263201
3. Edit `main.swift`. Import and register your new Swift module.
264202

265-
No changes are needed to the swiftpm build since it knows how to infer
266-
multi-source libraries automatically from the library structure.
267-
268203
**Note:**
269204

270205
The benchmark harness will execute the routine referenced by
@@ -309,8 +244,8 @@ public func run_YourTestName(N: Int) {
309244
The current set of tags are defined by the `BenchmarkCategory` enum in
310245
`TestsUtils.swift` .
311246

312-
## Testing the Benchmark Drivers
313-
247+
Testing the Benchmark Drivers
248+
-----------------------------
314249
When working on tests, after the initial build
315250
````
316251
swift-source$ ./swift/utils/build-script -R -B

branches/tensorflow-merge/include/swift/AST/ASTTypeIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
//===----------------------------------------------------------------------===//
1717
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
1818
SWIFT_TYPEID_NAMED(VarDecl *, VarDecl)
19-
SWIFT_TYPEID_NAMED(ValueDecl *, ValueDecl)
2019
SWIFT_TYPEID_NAMED(Decl *, Decl)
2120
SWIFT_TYPEID(Type)
2221
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)

branches/tensorflow-merge/include/swift/AST/Decl.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,20 +4120,7 @@ class ProtocolDecl final : public NominalTypeDecl {
41204120
Bits.ProtocolDecl.RequiresClass = requiresClass;
41214121
}
41224122

4123-
/// Returns the cached result of \c existentialConformsToSelf or \c None if it
4124-
/// hasn't yet been computed.
4125-
Optional<bool> getCachedExistentialConformsToSelf() const {
4126-
if (Bits.ProtocolDecl.ExistentialConformsToSelfValid)
4127-
return Bits.ProtocolDecl.ExistentialConformsToSelf;
4128-
4129-
return None;
4130-
}
4131-
4132-
/// Caches the result of \c existentialConformsToSelf
4133-
void setCachedExistentialConformsToSelf(bool result) {
4134-
Bits.ProtocolDecl.ExistentialConformsToSelfValid = true;
4135-
Bits.ProtocolDecl.ExistentialConformsToSelf = result;
4136-
}
4123+
bool existentialConformsToSelfSlow();
41374124

41384125
bool existentialTypeSupportedSlow();
41394126

@@ -4147,7 +4134,6 @@ class ProtocolDecl final : public NominalTypeDecl {
41474134
friend class SuperclassTypeRequest;
41484135
friend class RequirementSignatureRequest;
41494136
friend class ProtocolRequiresClassRequest;
4150-
friend class ExistentialConformsToSelfRequest;
41514137
friend class TypeChecker;
41524138

41534139
public:
@@ -4218,7 +4204,13 @@ class ProtocolDecl final : public NominalTypeDecl {
42184204
/// This is only permitted if there is nothing "non-trivial" that we
42194205
/// can do with the metatype, which means the protocol must not have
42204206
/// any static methods and must be declared @objc.
4221-
bool existentialConformsToSelf() const;
4207+
bool existentialConformsToSelf() const {
4208+
if (Bits.ProtocolDecl.ExistentialConformsToSelfValid)
4209+
return Bits.ProtocolDecl.ExistentialConformsToSelf;
4210+
4211+
return const_cast<ProtocolDecl *>(this)
4212+
->existentialConformsToSelfSlow();
4213+
}
42224214

42234215
/// Does this protocol require a self-conformance witness table?
42244216
bool requiresSelfConformanceWitnessTable() const;

branches/tensorflow-merge/include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4523,9 +4523,6 @@ WARNING(property_wrapper_init_initialValue,none,
45234523
())
45244524
ERROR(property_wrapper_projection_value_missing,none,
45254525
"could not find projection value property %0", (Identifier))
4526-
ERROR(property_wrapper_missing_arg_init, none, "missing argument for parameter "
4527-
"%0 in property wrapper initializer; add 'wrappedValue' and %0 "
4528-
"arguments in '@%1(...)'", (Identifier, StringRef))
45294526

45304527
//------------------------------------------------------------------------------
45314528
// MARK: function builder diagnostics

0 commit comments

Comments
 (0)