Skip to content

Commit c8df93f

Browse files
committed
Cleanup and additional init(repeating:) test.
1 parent ffdb4c4 commit c8df93f

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,8 +2628,7 @@ static FuncDecl *resolveAutoDiffAssociatedFunction(
26282628
auto isABIPublic = [&](AbstractFunctionDecl *func) {
26292629
return func->getFormalAccess() >= AccessLevel::Public ||
26302630
func->getAttrs().hasAttribute<InlinableAttr>() ||
2631-
func->getAttrs().hasAttribute<UsableFromInlineAttr>() ||
2632-
func->getAttrs().hasAttribute<AlwaysEmitIntoClientAttr>();
2631+
func->getAttrs().hasAttribute<UsableFromInlineAttr>();
26332632
};
26342633

26352634
// If the original function is exported (i.e. it is public or

stdlib/public/core/SIMDVector.swift

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ extension SIMD where Scalar : FloatingPoint {
803803
@_transparent
804804
// SWIFT_ENABLE_TENSORFLOW
805805
@differentiable(vjp: _vjpSubtract(lhs:rhs:)
806-
where Self: Differentiable,
806+
where Self : Differentiable,
807807
Self.TangentVector: SIMD,
808808
Scalar : BinaryFloatingPoint,
809809
Self.TangentVector.Scalar : BinaryFloatingPoint)
@@ -1197,9 +1197,10 @@ extension SIMD where Scalar: FixedWidthInteger {
11971197
extension SIMD where Scalar: FloatingPoint {
11981198

11991199
@_transparent
1200+
// SWIFT_ENABLE_TENSORFLOW
12001201
@differentiable(vjp: _vjpNegate(rhs:)
1201-
where Self: Differentiable,
1202-
Self.TangentVector: SIMD,
1202+
where Self : Differentiable,
1203+
Self.TangentVector : SIMD,
12031204
Scalar : BinaryFloatingPoint,
12041205
Self.TangentVector.Scalar : BinaryFloatingPoint)
12051206
public static prefix func -(rhs: Self) -> Self {
@@ -1209,10 +1210,10 @@ extension SIMD where Scalar: FloatingPoint {
12091210
@_transparent
12101211
// SWIFT_ENABLE_TENSORFLOW
12111212
@differentiable(vjp: _vjpAdd(lhs:rhs:)
1212-
where Self: Differentiable,
1213+
where Self : Differentiable,
12131214
Self.TangentVector: SIMD,
12141215
Scalar : Differentiable & BinaryFloatingPoint,
1215-
Scalar.TangentVector: BinaryFloatingPoint,
1216+
Scalar.TangentVector : BinaryFloatingPoint,
12161217
Self.TangentVector.Scalar == Scalar.TangentVector)
12171218
public static func +(lhs: Scalar, rhs: Self) -> Self {
12181219
return Self(repeating: lhs) + rhs
@@ -1221,10 +1222,10 @@ extension SIMD where Scalar: FloatingPoint {
12211222
@_transparent
12221223
// SWIFT_ENABLE_TENSORFLOW
12231224
@differentiable(vjp: _vjpAdd(lhs:rhs:)
1224-
where Self: Differentiable,
1225-
Self.TangentVector: SIMD,
1225+
where Self : Differentiable,
1226+
Self.TangentVector : SIMD,
12261227
Scalar : Differentiable & BinaryFloatingPoint,
1227-
Scalar.TangentVector: BinaryFloatingPoint,
1228+
Scalar.TangentVector : BinaryFloatingPoint,
12281229
Self.TangentVector.Scalar == Scalar.TangentVector)
12291230
public static func -(lhs: Scalar, rhs: Self) -> Self {
12301231
return Self(repeating: lhs) - rhs
@@ -1257,10 +1258,10 @@ extension SIMD where Scalar: FloatingPoint {
12571258
@_transparent
12581259
// SWIFT_ENABLE_TENSORFLOW
12591260
@differentiable(vjp: _vjpAdd(lhs:rhs:)
1260-
where Self: Differentiable,
1261-
Self.TangentVector: SIMD,
1261+
where Self : Differentiable,
1262+
Self.TangentVector : SIMD,
12621263
Scalar : Differentiable & BinaryFloatingPoint,
1263-
Scalar.TangentVector: BinaryFloatingPoint,
1264+
Scalar.TangentVector : BinaryFloatingPoint,
12641265
Self.TangentVector.Scalar == Scalar.TangentVector)
12651266
public static func +(lhs: Self, rhs: Scalar) -> Self {
12661267
return lhs + Self(repeating: rhs)
@@ -1269,10 +1270,10 @@ extension SIMD where Scalar: FloatingPoint {
12691270
@_transparent
12701271
// SWIFT_ENABLE_TENSORFLOW
12711272
@differentiable(vjp: _vjpAdd(lhs:rhs:)
1272-
where Self: Differentiable,
1273-
Self.TangentVector: SIMD,
1273+
where Self : Differentiable,
1274+
Self.TangentVector : SIMD,
12741275
Scalar : Differentiable & BinaryFloatingPoint,
1275-
Scalar.TangentVector: BinaryFloatingPoint,
1276+
Scalar.TangentVector : BinaryFloatingPoint,
12761277
Self.TangentVector.Scalar == Scalar.TangentVector)
12771278
public static func -(lhs: Self, rhs: Scalar) -> Self {
12781279
return lhs - Self(repeating: rhs)
@@ -1511,10 +1512,10 @@ where T: SIMD, T.Scalar: FloatingPoint {
15111512

15121513
// SWIFT_ENABLE_TENSORFLOW
15131514
extension SIMD
1514-
where Self: Differentiable,
1515-
TangentVector: SIMD,
1515+
where Self : Differentiable,
1516+
TangentVector : SIMD,
15161517
Scalar : BinaryFloatingPoint,
1517-
TangentVector.Scalar: BinaryFloatingPoint {
1518+
TangentVector.Scalar : BinaryFloatingPoint {
15181519
@inlinable
15191520
static func _vjpAdd(
15201521
lhs: Self, rhs: Self
@@ -1543,7 +1544,7 @@ extension SIMD
15431544
}
15441545

15451546
extension SIMD
1546-
where Self: Differentiable,
1547+
where Self : Differentiable,
15471548
TangentVector: SIMD,
15481549
Scalar : BinaryFloatingPoint,
15491550
Self.TangentVector == Self {

test/AutoDiff/SIMD.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ SIMDTests.test("Negate") {
3030
expectEqual(-a, bp1(a))
3131
}
3232

33+
SIMDTests.test("init(repeating:)") {
34+
let g = SIMD4<Float>(1, 1, 1, 1)
35+
36+
let foo1 = { (x: Float) -> SIMD4<Float> in
37+
return SIMD4<Float>(repeating: x)
38+
}
39+
let bp1 = pullback(at: 5, in: foo1)
40+
expectEqual(4, bp1(g))
41+
}
42+
3343
SIMDTests.test("Sum") {
3444
let a = SIMD4<Float>(1, 2, 3, 4)
3545

0 commit comments

Comments
 (0)