Skip to content

Commit 86d9c82

Browse files
authored
Merge pull request #34676 from apple/tensorflow-merge
Merge 2020-11-10 into tensorflow
2 parents 2232a3e + e432c5f commit 86d9c82

File tree

682 files changed

+18984
-8789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

682 files changed

+18984
-8789
lines changed

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ set(SWIFT_BENCH_MODULES
9898
single-source/Hash
9999
single-source/Histogram
100100
single-source/HTTP2StateMachine
101+
single-source/IndexPathTest
101102
single-source/InsertCharacter
102103
single-source/IntegerParsing
103104
single-source/Integrate
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
//===--- IndexPathTest.swift ----------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import Foundation
14+
import TestsUtils
15+
16+
let size = 200
17+
let increasingIndexPath = indexPath(size)
18+
let decreasingIndexPath = indexPath(size, reversed: true)
19+
let increasingMaxMiddleIndexPath = indexPath(size, middle: size + 1)
20+
let increasingMinMiddleIndexPath = indexPath(size, middle: -1)
21+
let tags: [BenchmarkCategory] = [.validation, .api, .IndexPath]
22+
23+
public let IndexPathTest = [
24+
BenchmarkInfo(
25+
name: "IndexPath.Subscript.Mutation",
26+
runFunction: run_IndexPathSubscriptMutation,
27+
tags: tags,
28+
setUpFunction: { blackHole(increasingIndexPath) }),
29+
BenchmarkInfo(
30+
name: "IndexPath.Subscript.Range.Mutation",
31+
runFunction: run_IndexPathSubscriptRangeMutation,
32+
tags: tags,
33+
setUpFunction: { blackHole(increasingIndexPath) }),
34+
BenchmarkInfo(
35+
name: "IndexPath.Max",
36+
runFunction: run_IndexPathMax,
37+
tags: tags,
38+
setUpFunction: {
39+
blackHole(decreasingIndexPath)
40+
blackHole(increasingMaxMiddleIndexPath)
41+
blackHole(increasingIndexPath)
42+
}),
43+
BenchmarkInfo(
44+
name: "IndexPath.Min",
45+
runFunction: run_IndexPathMin,
46+
tags: tags,
47+
setUpFunction: {
48+
blackHole(increasingIndexPath)
49+
blackHole(increasingMinMiddleIndexPath)
50+
blackHole(decreasingIndexPath)
51+
}),
52+
]
53+
54+
func indexPath(_ size: Int, reversed: Bool = false) -> IndexPath {
55+
let indexes = Array(0..<size)
56+
return IndexPath(indexes: reversed ? indexes.reversed() : indexes)
57+
}
58+
59+
func indexPath(_ size: Int, middle: Int) -> IndexPath {
60+
var indexes = Array(0..<size)
61+
indexes.insert(middle, at: (indexes.count - 1) / 2)
62+
return IndexPath(indexes: indexes)
63+
}
64+
65+
// Subscript Mutations
66+
67+
@inline(__always)
68+
func subscriptMutation(
69+
n: Int,
70+
mutations: Int,
71+
indexPath: IndexPath,
72+
mutate: (inout IndexPath, Int) -> Void
73+
) {
74+
for _ in 0..<n {
75+
for i in 0..<mutations {
76+
var ip = indexPath
77+
mutate(&ip, i)
78+
}
79+
}
80+
}
81+
82+
@inline(never)
83+
public func run_IndexPathSubscriptMutation(_ n: Int) {
84+
subscriptMutation(
85+
n: n * 10, mutations: size, indexPath: increasingIndexPath,
86+
mutate: { ip, i in
87+
ip[i % 4] += 1
88+
})
89+
}
90+
91+
@inline(never)
92+
public func run_IndexPathSubscriptRangeMutation(_ n: Int) {
93+
subscriptMutation(
94+
n: n, mutations: size, indexPath: increasingIndexPath,
95+
mutate: { ip, i in
96+
ip[0..<i] += [i]
97+
})
98+
}
99+
100+
// Max
101+
102+
@inline(never)
103+
public func run_IndexPathMax(_ n: Int) {
104+
for _ in 0..<n * 10 {
105+
var val: Int?
106+
// Beginning max
107+
val = decreasingIndexPath.max()
108+
blackHole(val)
109+
// Middle max
110+
val = increasingMaxMiddleIndexPath.max()
111+
blackHole(val)
112+
// End max
113+
val = increasingIndexPath.max()
114+
blackHole(val)
115+
}
116+
}
117+
118+
// Min
119+
120+
@inline(never)
121+
public func run_IndexPathMin(_ n: Int) {
122+
for _ in 0..<n * 10 {
123+
var val: Int?
124+
// Beginning min
125+
val = increasingIndexPath.min()
126+
blackHole(val)
127+
// Middle min
128+
val = increasingMinMiddleIndexPath.min()
129+
blackHole(val)
130+
// End min
131+
val = decreasingIndexPath.min()
132+
blackHole(val)
133+
}
134+
}

benchmark/utils/TestsUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum BenchmarkCategory : String {
2323
// we know is important to measure.
2424
case validation
2525
// subsystems to validate and their subcategories.
26-
case api, Array, String, Dictionary, Codable, Set, Data
26+
case api, Array, String, Dictionary, Codable, Set, Data, IndexPath
2727
case sdk
2828
case runtime, refcount, metadata
2929
// Other general areas of compiled code validation.

benchmark/utils/main.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ import Hanoi
8686
import Hash
8787
import Histogram
8888
import HTTP2StateMachine
89+
import IndexPathTest
8990
import InsertCharacter
9091
import IntegerParsing
9192
import Integrate
@@ -274,6 +275,7 @@ registerBenchmark(Hanoi)
274275
registerBenchmark(HashTest)
275276
registerBenchmark(Histogram)
276277
registerBenchmark(HTTP2StateMachine)
278+
registerBenchmark(IndexPathTest)
277279
registerBenchmark(InsertCharacter)
278280
registerBenchmark(IntegerParsing)
279281
registerBenchmark(IntegrateTest)

docs/ABI/Mangling.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Globals
175175

176176
global ::= global 'MJ' // noncanonical specialized generic type metadata instantiation cache associated with global
177177
global ::= global 'MN' // noncanonical specialized generic type metadata for global
178+
global ::= global 'Mz' // canonical specialized generic type metadata caching token
178179

179180
#if SWIFT_RUNTIME_VERSION >= 5.4
180181
global ::= context (decl-name '_')+ 'WZ' // global variable one-time initialization function
@@ -218,6 +219,8 @@ types where the metadata itself has unknown layout.)
218219
global ::= global 'Tm' // merged function
219220
global ::= entity // some identifiable thing
220221
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
222+
global ::= from-type to-type generic-signature? 'TR' // reabstraction thunk
223+
global ::= impl-function-type 'Tz' // objc-to-swift-async completion handler block implementation
221224
global ::= from-type to-type self-type generic-signature? 'Ty' // reabstraction thunk with dynamic 'Self' capture
222225
global ::= from-type to-type generic-signature? 'Tr' // obsolete mangling for reabstraction thunk
223226
global ::= entity generic-signature? type type* 'TK' // key path getter

docs/ContinuousIntegration.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
- [Linting](#linting)
1212
- [Source Compatibility Testing](#source-compatibility-testing)
1313
- [Sourcekit Stress Testing](#sourcekit-stress-testing)
14-
- [Specific Preset Testing](#specific-preset-testing)
15-
- [Running Non-Executable Device Tests](#running-non-executable-device-tests)
1614
- [Build Swift Toolchain](#build-swift-toolchain)
15+
- [Build and Test Stdlib against Snapshot Toolchain](#build-and-test-stdlib-against-snapshot-toolchain)
16+
- [Specific Preset Testing](#specific-preset-testing)
17+
- [Specific Preset Testing against a Snapshot Toolchain](#specific-preset-testing-against-a-snapshot-toolchain)
18+
- [Running Non-Executable Device Tests using Specific Preset Testing](#running-non-executable-device-tests-using-specific-preset-testing)
19+
- [Build and Test the Minimal Freestanding Stdlib using Toolchain Specific Preset Testing](#build-and-test-the-minimal-freestanding-stdlib-using-toolchain-specific-preset-testing)
1720
- [Testing Compiler Performance](#testing-compiler-performance)
1821
- [Swift Community Hosted CI Pull Request Testing](#swift-community-hosted-ci-pull-request-testing)
1922
- [Cross Repository Testing](#cross-repository-testing)
@@ -168,6 +171,21 @@ Platform | Comment | Check Status
168171
------------ | ------- | ------------
169172
macOS platform | @swift-ci Please Sourcekit Stress test | Swift Sourcekit Stress Tester on macOS Platform
170173

174+
### Build Swift Toolchain
175+
176+
Platform | Comment | Check Status
177+
------------ | ------- | ------------
178+
macOS platform | @swift-ci Please Build Toolchain macOS Platform| Swift Build Toolchain macOS Platform
179+
Linux platform | @swift-ci Please Build Toolchain Linux Platform| Swift Build Toolchain Linux Platform
180+
181+
### Build and Test Stdlib against Snapshot Toolchain
182+
183+
To test/build the stdlib for a branch that changes only the stdlib using a last known good snapshot toolchain:
184+
185+
Platform | Comment | Check Status
186+
------------ | ------- | ------------
187+
macOS platform | @swift-ci Please test stdlib with toolchain| Swift Test stdlib with toolchain macOS Platform
188+
171189
### Specific Preset Testing
172190

173191
Platform | Comment | Check Status
@@ -183,7 +201,23 @@ preset=buildbot_incremental,tools=RA,stdlib=RD,smoketest=macosx,single-thread
183201
@swift-ci Please test with preset macOS
184202
```
185203

186-
### Running Non-Executable Device Tests
204+
205+
### Specific Preset Testing against a Snapshot Toolchain
206+
207+
One can also run an arbitrary preset against a snapshot toolchain
208+
209+
Platform | Comment | Check Status
210+
------------ | ------- | ------------
211+
macOS platform | preset=<preset> <br> @swift-ci Please test with toolchain and preset| Swift Test stdlib with toolchain macOS Platform (Preset)
212+
213+
For example:
214+
215+
```
216+
preset=$PRESET_NAME
217+
@swift-ci Please test with toolchain and preset
218+
```
219+
220+
### Running Non-Executable Device Tests using Specific Preset Testing
187221

188222
Using the specific preset testing, one can run non-executable device tests by
189223
telling swift-ci:
@@ -193,12 +227,14 @@ preset=buildbot,tools=RA,stdlib=RD,test=non_executable
193227
@swift-ci Please test with preset macOS
194228
```
195229

196-
### Build Swift Toolchain
230+
### Build and Test the Minimal Freestanding Stdlib using Toolchain Specific Preset Testing
197231

198-
Platform | Comment | Check Status
199-
------------ | ------- | ------------
200-
macOS platform | @swift-ci Please Build Toolchain macOS Platform| Swift Build Toolchain macOS Platform
201-
Linux platform | @swift-ci Please Build Toolchain Linux Platform| Swift Build Toolchain Linux Platform
232+
To test the minimal freestanding stdlib on macho, you can use the support for running a miscellanous preset against a snapshot toolchain.
233+
234+
```
235+
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test
236+
@swift-ci please test with toolchain and preset
237+
```
202238

203239
### Testing Compiler Performance
204240

0 commit comments

Comments
 (0)