Skip to content

Commit 125daf7

Browse files
Merge pull request #2275 from swiftwasm/maxd/main-merge
Resolve conflicts with `main`
2 parents 7a04fb3 + 36d3b13 commit 125daf7

File tree

599 files changed

+19442
-4997
lines changed

Some content is hidden

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

599 files changed

+19442
-4997
lines changed

.mailmap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Adrian-Constantin Popescu <[email protected]> <[email protected]>
22
33
4-
4+
55
Alexis Beingessner <[email protected]> <[email protected]>
66
77
@@ -79,6 +79,7 @@ Joe Shajrawi <[email protected]> <[email protected]>
7979
8080
8181
82+
8283
8384
8485
Kevin Saldaña <[email protected]>

benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ set(SWIFT_BENCH_MODULES
8080
single-source/DictionaryRemove
8181
single-source/DictionarySubscriptDefault
8282
single-source/DictionarySwap
83+
single-source/Differentiation
8384
single-source/Diffing
8485
single-source/DiffingMyers
8586
single-source/DropFirst
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//===--- Differentiation.swift -------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 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+
#if canImport(_Differentiation)
14+
15+
import TestsUtils
16+
import _Differentiation
17+
18+
public let Differentiation = [
19+
BenchmarkInfo(
20+
name: "DifferentiationIdentity",
21+
runFunction: run_DifferentiationIdentity,
22+
tags: [.regression, .differentiation]
23+
),
24+
BenchmarkInfo(
25+
name: "DifferentiationSquare",
26+
runFunction: run_DifferentiationSquare,
27+
tags: [.regression, .differentiation]
28+
),
29+
BenchmarkInfo(
30+
name: "DifferentiationArraySum",
31+
runFunction: run_DifferentiationArraySum,
32+
tags: [.regression, .differentiation],
33+
setUpFunction: { blackHole(onesArray) }
34+
),
35+
]
36+
37+
@inline(never)
38+
public func run_DifferentiationIdentity(N: Int) {
39+
func f(_ x: Float) -> Float {
40+
x
41+
}
42+
for _ in 0..<1000*N {
43+
blackHole(valueWithGradient(at: 1, in: f))
44+
}
45+
}
46+
47+
@inline(never)
48+
public func run_DifferentiationSquare(N: Int) {
49+
func f(_ x: Float) -> Float {
50+
x * x
51+
}
52+
for _ in 0..<1000*N {
53+
blackHole(valueWithGradient(at: 1, in: f))
54+
}
55+
}
56+
57+
let onesArray: [Float] = Array(repeating: 1, count: 50)
58+
59+
@inline(never)
60+
public func run_DifferentiationArraySum(N: Int) {
61+
func sum(_ array: [Float]) -> Float {
62+
var result: Float = 0
63+
for i in withoutDerivative(at: 0..<array.count) {
64+
result += array[i]
65+
}
66+
return result
67+
}
68+
for _ in 0..<N {
69+
blackHole(valueWithGradient(at: onesArray, in: sum))
70+
}
71+
}
72+
73+
#endif

benchmark/utils/TestsUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public enum BenchmarkCategory : String {
2828
case runtime, refcount, metadata
2929
// Other general areas of compiled code validation.
3030
case abstraction, safetychecks, exceptions, bridging, concurrency, existential
31-
case exclusivity
31+
case exclusivity, differentiation
3232

3333
// Algorithms are "micro" that test some well-known algorithm in isolation:
3434
// sorting, searching, hashing, fibonaci, crypto, etc.

benchmark/utils/main.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ import DictionaryOfAnyHashableStrings
6969
import DictionaryRemove
7070
import DictionarySubscriptDefault
7171
import DictionarySwap
72+
#if canImport(_Differentiation)
73+
import Differentiation
74+
#endif
7275
import Diffing
7376
import DiffingMyers
7477
import DropFirst
@@ -258,6 +261,9 @@ registerBenchmark(DictionaryOfAnyHashableStrings)
258261
registerBenchmark(DictionaryRemove)
259262
registerBenchmark(DictionarySubscriptDefault)
260263
registerBenchmark(DictionarySwap)
264+
#if canImport(_Differentiation)
265+
registerBenchmark(Differentiation)
266+
#endif
261267
registerBenchmark(Diffing)
262268
registerBenchmark(DiffingMyers)
263269
registerBenchmark(DropFirst)

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ macro(configure_sdk_unix name architectures)
297297
else()
298298
message(SEND_ERROR "Couldn't find SWIFT_SDK_ANDROID_ARCH_armv7_PATH")
299299
endif()
300-
set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "armv7-none-linux-androideabi")
300+
set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "armv7-unknown-linux-androideabi")
301301
# The Android ABI isn't part of the module triple.
302-
set(SWIFT_SDK_ANDROID_ARCH_${arch}_MODULE "armv7-none-linux-android")
302+
set(SWIFT_SDK_ANDROID_ARCH_${arch}_MODULE "armv7-unknown-linux-android")
303303
elseif("${arch}" STREQUAL "aarch64")
304304
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "aarch64-linux-android")
305305
set(SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "aarch64")

cmake/modules/SwiftManpage.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ function(manpage)
3939
ALL)
4040

4141
add_dependencies(${MP_INSTALL_IN_COMPONENT} ${manpage_target})
42+
set(MANPAGE_DEST "share/")
43+
if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "OPENBSD")
44+
set(MANPAGE_DEST "")
45+
endif()
4246
swift_install_in_component(FILES "${output_file_name}"
43-
DESTINATION "share/man/man${MP_MAN_SECTION}"
47+
DESTINATION "${MANPAGE_DEST}man/man${MP_MAN_SECTION}"
4448
COMPONENT "${MP_INSTALL_IN_COMPONENT}")
4549
endfunction()
4650

docs/ABI/Mangling.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,11 @@ Types
492492

493493
type ::= 'Bb' // Builtin.BridgeObject
494494
type ::= 'BB' // Builtin.UnsafeValueBuffer
495+
type ::= 'Bc' // Builtin.RawUnsafeContinuation
495496
type ::= 'Bf' NATURAL '_' // Builtin.Float<n>
496497
type ::= 'Bi' NATURAL '_' // Builtin.Int<n>
497498
type ::= 'BI' // Builtin.IntLiteral
499+
type ::= 'Bj' // Builtin.Job
498500
type ::= 'BO' // Builtin.UnknownObject (no longer a distinct type, but still used for AnyObject)
499501
type ::= 'Bo' // Builtin.NativeObject
500502
type ::= 'Bp' // Builtin.RawPointer
@@ -1006,6 +1008,8 @@ Function Specializations
10061008
::
10071009

10081010
specialization ::= type '_' type* 'Tg' SPEC-INFO // Generic re-abstracted specialization
1011+
specialization ::= type '_' type* 'TB' SPEC-INFO // Alternative mangling for generic re-abstracted specializations,
1012+
// used for functions with re-abstracted resilient parameter types.
10091013
specialization ::= type '_' type* 'Ts' SPEC-INFO // Generic re-abstracted prespecialization
10101014
specialization ::= type '_' type* 'TG' SPEC-INFO // Generic not re-abstracted specialization
10111015
specialization ::= type '_' type* 'Ti' SPEC-INFO // Inlined function with generic substitutions.

docs/Android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ $ NDK_PATH="path/to/android-ndk21"
103103
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc \ # The Swift compiler built in the previous step.
104104
# The location of the tools used to build Android binaries
105105
-tools-directory ${NDK_PATH}/toolchains/llvm/prebuilt/linux-x86_64/bin/ \
106-
-target armv7a-none-linux-androideabi \ # Targeting android-armv7, and supply the path to libgcc.
106+
-target armv7a-unknown-linux-androideabi \ # Targeting android-armv7, and supply the path to libgcc.
107107
-L ${NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/armv7-a \
108108
-sdk ${NDK_PATH}/platforms/android-21/arch-arm \ # Use the same architecture and API version as you used to build the stdlib in the previous step.
109109
hello.swift

docs/ContinuousIntegration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ preset=buildbot,tools=RA,stdlib=RD,test=non_executable
215215

216216
### Build and Test the Minimal Freestanding Stdlib using Toolchain Specific Preset Testing
217217

218-
To test the minimal freestanding stdlib on macho, you can use the support for running a miscellanous preset against a snapshot toolchain.
218+
To test the minimal freestanding stdlib on macho, you can use the support for running a miscellaneous preset against a snapshot toolchain.
219219

220220
```
221221
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test

0 commit comments

Comments
 (0)