Skip to content

Commit 739d5e0

Browse files
authored
---
yaml --- r: 338943 b: refs/heads/rxwei-patch-1 c: ad37ed6 h: refs/heads/master i: 338941: fb31473 338939: 709d0f9 338935: b6e2678 338927: 89655ea 338911: 9afab6d 338879: b801442 338815: 9ff3ff2 338687: d79809c 338431: c7386a4 337919: 2b4ffa2
1 parent d4b207a commit 739d5e0

File tree

20 files changed

+1
-456
lines changed

20 files changed

+1
-456
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 1b52456dedc23a1410b55f129e11ee5e60c391fd
1018+
refs/heads/rxwei-patch-1: ad37ed689ff436bf8d2447a8ff6a9a16931d8e5f
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/AST/ASTContext.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ class ASTContext final {
495495
/// has been imported. Otherwise, this returns null.
496496
StructDecl *getTensorDataTypeDecl() const;
497497

498-
/// Retrieve the type for Swift._AutoDiffTape.
499-
CanType getAutoDiffTapeType() const;
500-
501498
/// Retrieve the type Swift.Never.
502499
CanType getNeverType() const;
503500

branches/rxwei-patch-1/include/swift/AST/Builtins.def

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -564,16 +564,6 @@ BUILTIN_MISC_OPERATION(TensorFlowSend, "tensorflowSend", "", Special)
564564
/// ID number that allows matching sends and receives.
565565
BUILTIN_MISC_OPERATION(TensorFlowReceive, "tensorflowReceive", "", Special)
566566

567-
// Automatic differentiation builtins.
568-
/// autodiffCreateTape has type <T> () -> Builtin.AutoDiffTape<T>.
569-
BUILTIN_MISC_OPERATION(AutoDiffCreateTape, "autodiffCreateTape", "", Special)
570-
/// autodiffPushToTape has type <T> (Builtin.AutoDiffTape<T>, T, Builtin.Word) -> ().
571-
BUILTIN_MISC_OPERATION(AutoDiffPushToTape, "autodiffPushToTape", "", Special)
572-
/// autodiffPopFromTape has type <T> (Builtin.AutoDiffTape<T>, Builtin.Word) -> T.
573-
BUILTIN_MISC_OPERATION(AutoDiffPopFromTape, "autodiffPopFromTape", "", Special)
574-
/// autodiffDestroyTape has type <T> (Builtin.AutoDiffTape<T>) -> ().
575-
BUILTIN_MISC_OPERATION(AutoDiffDestroyTape, "autodiffDestroyTape", "", Special)
576-
577567
#undef BUILTIN_MISC_OPERATION
578568

579569
/// Builtins for instrumentation added by sanitizers during SILGen.

branches/rxwei-patch-1/include/swift/AST/KnownStdlibTypes.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,4 @@ KNOWN_STDLIB_TYPE_DECL(KeyedEncodingContainer, NominalTypeDecl, 1)
8282
KNOWN_STDLIB_TYPE_DECL(KeyedDecodingContainer, NominalTypeDecl, 1)
8383
KNOWN_STDLIB_TYPE_DECL(RangeReplaceableCollection, ProtocolDecl, 1)
8484

85-
// SWIFT_ENABLE_TENSORFLOW
86-
KNOWN_STDLIB_TYPE_DECL(_AutoDiffTape, ClassDecl, 1)
87-
8885
#undef KNOWN_STDLIB_TYPE_DECL

branches/rxwei-patch-1/include/swift/Runtime/AutoDiff.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

branches/rxwei-patch-1/include/swift/Runtime/RuntimeFunctions.def

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,31 +1320,6 @@ FUNCTION(IntToFloat64, swift_intToFloat64, SwiftCC,
13201320
ARGS(SizeTy->getPointerTo(), SizeTy),
13211321
ATTRS(NoUnwind, ReadOnly))
13221322

1323-
// SWIFT_ENABLE_TENSORFLOW
1324-
// OpaqueValue *swift_autodiffCreateTape();
1325-
FUNCTION(AutoDiffCreateTape, swift_autodiffCreateTape, C_CC,
1326-
RETURNS(OpaquePtrTy),
1327-
ARGS(TypeMetadataPtrTy),
1328-
ATTRS(NoUnwind))
1329-
1330-
// void swift_autodiffDestroyTape(OpaqueValue *tape);
1331-
FUNCTION(AutoDiffDestroyTape, swift_autodiffDestroyTape, C_CC,
1332-
RETURNS(VoidTy),
1333-
ARGS(OpaquePtrTy),
1334-
ATTRS(NoUnwind))
1335-
1336-
// void swift_autodiffPushToTape(OpaqueValue *tape, OpaqueValue *value);
1337-
FUNCTION(AutoDiffPushToTape, swift_autodiffPushToTape, C_CC,
1338-
RETURNS(VoidTy),
1339-
ARGS(OpaquePtrTy, OpaquePtrTy),
1340-
ATTRS(NoUnwind))
1341-
1342-
// OpaqueValue *swift_autodiffPopFromTape(OpaqueValue *tape);
1343-
FUNCTION(AutoDiffPopFromTape, swift_autodiffPopFromTape, C_CC,
1344-
RETURNS(OpaquePtrTy),
1345-
ARGS(OpaquePtrTy),
1346-
ATTRS(NoUnwind))
1347-
13481323
// SWIFT_ENABLE_TENSORFLOW
13491324
//===----------------------------------------------------------------------===//
13501325
// - MARK: Runtime functions issued by IRGen in dynamic compilation mode.

branches/rxwei-patch-1/lib/AST/ASTContext.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ struct ASTContext::Implementation {
150150
/// The declaration of TensorFlow.TensorDataType.
151151
StructDecl *TensorDataTypeDecl = nullptr;
152152

153-
/// The declaration of Swift._AutoDiffTape<T>.
154-
ClassDecl *AutoDiffTapeDecl = nullptr;
155-
156153
#define KNOWN_STDLIB_TYPE_DECL(NAME, DECL_CLASS, NUM_GENERIC_PARAMS) \
157154
/** The declaration of Swift.NAME. */ \
158155
DECL_CLASS *NAME##Decl = nullptr;
@@ -872,12 +869,6 @@ StructDecl *ASTContext::getTensorDataTypeDecl() const {
872869
return nullptr;
873870
}
874871

875-
CanType ASTContext::getAutoDiffTapeType() const {
876-
if (auto adtDecl = get_AutoDiffTapeDecl())
877-
return adtDecl->getDeclaredType()->getCanonicalType();
878-
return CanType();
879-
}
880-
881872
CanType ASTContext::getNeverType() const {
882873
auto neverDecl = getNeverDecl();
883874
if (!neverDecl)

branches/rxwei-patch-1/lib/AST/Builtins.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -990,46 +990,6 @@ static ValueDecl *getTensorFlowReceive(ASTContext &Context, Identifier Id) {
990990
return builder.build(Id);
991991
}
992992

993-
static ValueDecl *getAutoDiffCreateTape(ASTContext &Context, Identifier Id) {
994-
// <T> () -> (Swift._AutoDiffTape<T>)
995-
BuiltinGenericSignatureBuilder builder(Context, 1);
996-
auto *tapeDecl = Context.get_AutoDiffTapeDecl();
997-
builder.setResult(makeBoundGenericType(tapeDecl, makeGenericParam()));
998-
return builder.build(Id);
999-
}
1000-
1001-
static ValueDecl *getAutoDiffPushToTape(ASTContext &Context, Identifier Id) {
1002-
// <T> (Swift._AutoDiffTape<T>, T, Builtin.Word) -> ()
1003-
BuiltinGenericSignatureBuilder builder(Context, 1);
1004-
auto *tapeDecl = Context.get_AutoDiffTapeDecl();
1005-
auto T = makeGenericParam();
1006-
builder.addParameter(makeBoundGenericType(tapeDecl, T));
1007-
builder.addParameter(T);
1008-
builder.addParameter(makeConcrete(BuiltinIntegerType::getWordType(Context)));
1009-
builder.setResult(makeConcrete(Context.TheEmptyTupleType));
1010-
return builder.build(Id);
1011-
}
1012-
1013-
static ValueDecl *getAutoDiffPopFromTape(ASTContext &Context, Identifier Id) {
1014-
// <T> (Swift._AutoDiffTape<T>, Builtin.Word) -> (T)
1015-
BuiltinGenericSignatureBuilder builder(Context, 1);
1016-
auto *tapeDecl = Context.get_AutoDiffTapeDecl();
1017-
auto T = makeGenericParam();
1018-
builder.addParameter(makeBoundGenericType(tapeDecl, T));
1019-
builder.addParameter(makeConcrete(BuiltinIntegerType::getWordType(Context)));
1020-
builder.setResult(T);
1021-
return builder.build(Id);
1022-
}
1023-
1024-
static ValueDecl *getAutoDiffDestroyTape(ASTContext &Context, Identifier Id) {
1025-
// <T> (Swift._AutoDiffTape<T>) -> ()
1026-
BuiltinGenericSignatureBuilder builder(Context, 1);
1027-
auto *tapeDecl = Context.get_AutoDiffTapeDecl();
1028-
builder.addParameter(makeBoundGenericType(tapeDecl, makeGenericParam()));
1029-
builder.setResult(makeConcrete(Context.TheEmptyTupleType));
1030-
return builder.build(Id);
1031-
}
1032-
1033993
static ValueDecl *getAutoDiffApplyAssociatedFunction(
1034994
ASTContext &Context, Identifier Id, AutoDiffAssociatedFunctionKind kind,
1035995
unsigned arity, unsigned order, bool rethrows) {
@@ -2113,14 +2073,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
21132073
return getTensorFlowSend(Context, Id);
21142074
case BuiltinValueKind::TensorFlowReceive:
21152075
return getTensorFlowReceive(Context, Id);
2116-
case BuiltinValueKind::AutoDiffCreateTape:
2117-
return getAutoDiffCreateTape(Context, Id);
2118-
case BuiltinValueKind::AutoDiffPushToTape:
2119-
return getAutoDiffPushToTape(Context, Id);
2120-
case BuiltinValueKind::AutoDiffPopFromTape:
2121-
return getAutoDiffPopFromTape(Context, Id);
2122-
case BuiltinValueKind::AutoDiffDestroyTape:
2123-
return getAutoDiffDestroyTape(Context, Id);
21242076
case BuiltinValueKind::AutoDiffApply:
21252077
llvm_unreachable("Handled above");
21262078

branches/rxwei-patch-1/lib/IRGen/GenBuiltin.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,64 +1007,5 @@ if (Builtin.ID == BuiltinValueKind::id) { \
10071007
return;
10081008
}
10091009

1010-
// SWIFT_ENABLE_TENSORFLOW
1011-
// OpaqueValue *swift_autoDiffCreateTape(Metadata *type);
1012-
if (Builtin.ID == BuiltinValueKind::AutoDiffCreateTape) {
1013-
auto valueTy =
1014-
getLoweredTypeAndTypeInfo(
1015-
IGF.IGM, substitutions.getReplacementTypes().front());
1016-
auto *metadata =
1017-
IGF.emitTypeMetadataRef(valueTy.first.getASTType());
1018-
out.add(IGF.Builder.CreateCall(IGF.IGM.getAutoDiffCreateTapeFn(),
1019-
{ metadata }));
1020-
return;
1021-
}
1022-
1023-
// void swift_autoDiffDestroyTape(OpaqueValue *tape);
1024-
if (Builtin.ID == BuiltinValueKind::AutoDiffDestroyTape) {
1025-
auto tape = args.claimNext();
1026-
IGF.Builder.CreateCall(IGF.IGM.getAutoDiffDestroyTapeFn(), { tape });
1027-
return;
1028-
}
1029-
1030-
// void swift_autoDiffPushToTape(OpaqueValue *tape, OpaqueValue *value);
1031-
if (Builtin.ID == BuiltinValueKind::AutoDiffPushToTape) {
1032-
auto tape = args.claimNext();
1033-
auto value = args.claimNext();
1034-
// `id` argument may be discarded. It is used as a marker in SIL.
1035-
(void)args.claimAll();
1036-
1037-
// Create stack allocation and store value in it.
1038-
auto alloca = IGF.createAlloca(value->getType(),
1039-
IGF.IGM.getPointerAlignment());
1040-
IGF.Builder.CreateStore(value, alloca);
1041-
// Cast alloca to OpaqueValue * and call builtin.
1042-
auto pointer = IGF.Builder.CreatePointerCast(alloca.getAddress(),
1043-
IGF.IGM.OpaquePtrTy);
1044-
IGF.Builder.CreateCall(IGF.IGM.getAutoDiffPushToTapeFn(),
1045-
{ tape, pointer });
1046-
return;
1047-
}
1048-
1049-
// OpaqueValue *swift_autoDiffPopFromTape(OpaqueValue *tape);
1050-
if (Builtin.ID == BuiltinValueKind::AutoDiffPopFromTape) {
1051-
auto tape = args.claimNext();
1052-
// `id` argument may be discarded. It is used as a marker in SIL.
1053-
(void)args.claimAll();
1054-
1055-
auto valueTy = getLoweredTypeAndTypeInfo(
1056-
IGF.IGM, substitutions.getReplacementTypes().front());
1057-
auto pointerTy = valueTy.second.getStorageType()->getPointerTo();
1058-
1059-
// Pop alloca from tape and cast to pointer type.
1060-
auto alloca = IGF.Builder.CreateCall(IGF.IGM.getAutoDiffPopFromTapeFn(),
1061-
{ tape });
1062-
auto pointer = IGF.Builder.CreatePointerCast(alloca, pointerTy);
1063-
// Load value from pointer.
1064-
auto value = IGF.Builder.CreateLoad(pointer, IGF.IGM.getPointerAlignment());
1065-
out.add(value);
1066-
return;
1067-
}
1068-
10691010
llvm_unreachable("IRGen unimplemented for this builtin!");
10701011
}

branches/rxwei-patch-1/lib/SIL/OperandOwnership.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,6 @@ CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, PoundAssert)
10611061
// SWIFT_ENABLE_TENSORFLOW
10621062
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, TensorFlowSend)
10631063
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, TensorFlowReceive)
1064-
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, AutoDiffCreateTape)
1065-
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, AutoDiffPushToTape)
1066-
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, AutoDiffPopFromTape)
1067-
CONSTANT_OWNERSHIP_BUILTIN(Any, MustBeLive, AutoDiffDestroyTape)
10681064
#undef CONSTANT_OWNERSHIP_BUILTIN
10691065

10701066
// Builtins that should be lowered to SIL instructions so we should never see

branches/rxwei-patch-1/lib/SIL/SILVerifier.cpp

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,80 +1485,10 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
14851485
}
14861486
}
14871487

1488-
// SWIFT_ENABLE_TENSORFLOW
1489-
static bool isAutoDiffBuiltinInst(BuiltinInst *BI) {
1490-
auto id = BI->getBuiltinInfo().ID;
1491-
return id == BuiltinValueKind::AutoDiffCreateTape ||
1492-
id == BuiltinValueKind::AutoDiffDestroyTape ||
1493-
id == BuiltinValueKind::AutoDiffPushToTape ||
1494-
id == BuiltinValueKind::AutoDiffPopFromTape;
1495-
}
1496-
1497-
// SWIFT_ENABLE_TENSORFLOW
1498-
void checkAutoDiffBuiltinInst(BuiltinInst *BI) {
1499-
auto &ctx = M->getASTContext();
1500-
auto id = BI->getBuiltinInfo().ID;
1501-
require(BI->getSubstitutions().getReplacementTypes().size() == 1,
1502-
"autodiff builtin should have a single type parameter");
1503-
1504-
auto name = getBuiltinName(id);
1505-
auto resultErrorMsg = "unexpected result type for '" + name + "'";
1506-
auto operandErrorMsg = "unexpected operand type for '" + name + "'";
1507-
1508-
auto canGenericParam = BI->getSubstitutions().getReplacementTypes()[0]
1509-
->getCanonicalType();
1510-
auto tapeType = SILType::getPrimitiveObjectType(
1511-
BoundGenericType::get(ctx.get_AutoDiffTapeDecl(), Type(), canGenericParam)
1512-
->getCanonicalType());
1513-
if (id == BuiltinValueKind::AutoDiffCreateTape) {
1514-
require(BI->getNumOperands() == 0,
1515-
"'" + name + "' should have no arguments");
1516-
requireSameType(BI->getType(), tapeType, resultErrorMsg);
1517-
return;
1518-
}
1519-
1520-
auto voidType = SILType::getPrimitiveObjectType(TupleType::getEmpty(ctx));
1521-
if (id == BuiltinValueKind::AutoDiffDestroyTape) {
1522-
require(BI->getNumOperands() == 1,
1523-
"'" + name + "' should have one argument");
1524-
requireSameType(BI->getType(), voidType, resultErrorMsg);
1525-
requireSameType(BI->getOperand(0)->getType(), tapeType, operandErrorMsg);
1526-
return;
1527-
}
1528-
1529-
auto genericParam = SILType::getPrimitiveObjectType(canGenericParam);
1530-
auto wordType = SILType::getPrimitiveObjectType(
1531-
BuiltinIntegerType::getWordType(ctx)->getCanonicalType());
1532-
if (id == BuiltinValueKind::AutoDiffPushToTape) {
1533-
require(BI->getNumOperands() == 3,
1534-
"'" + name + "' should have three arguments");
1535-
requireSameType(BI->getType(), voidType, resultErrorMsg);
1536-
requireSameType(BI->getOperand(0)->getType(), tapeType, operandErrorMsg);
1537-
requireSameType(BI->getOperand(1)->getType(), genericParam,
1538-
operandErrorMsg);
1539-
requireSameType(BI->getOperand(2)->getType(), wordType, operandErrorMsg);
1540-
return;
1541-
}
1542-
if (id == BuiltinValueKind::AutoDiffPopFromTape) {
1543-
require(BI->getNumOperands() == 2,
1544-
"'" + name + "' should have two arguments");
1545-
requireSameType(BI->getType(), genericParam, resultErrorMsg);
1546-
requireSameType(BI->getOperand(0)->getType(), tapeType, operandErrorMsg);
1547-
requireSameType(BI->getOperand(1)->getType(), wordType, operandErrorMsg);
1548-
return;
1549-
}
1550-
}
1551-
1552-
15531488
void checkBuiltinInst(BuiltinInst *BI) {
15541489
// Check for special constraints on llvm intrinsics.
15551490
if (BI->getIntrinsicInfo().ID != llvm::Intrinsic::not_intrinsic)
15561491
verifyLLVMIntrinsic(BI, BI->getIntrinsicInfo().ID);
1557-
1558-
// SWIFT_ENABLE_TENSORFLOW
1559-
// Verify autodiff builtins.
1560-
if (isAutoDiffBuiltinInst(BI))
1561-
checkAutoDiffBuiltinInst(BI);
15621492
}
15631493

15641494
void checkFunctionRefBaseInst(FunctionRefBaseInst *FRI) {

branches/rxwei-patch-1/lib/SIL/ValueOwnership.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,6 @@ CONSTANT_OWNERSHIP_BUILTIN(Any, PoundAssert)
498498
// SWIFT_ENABLE_TENSORFLOW
499499
CONSTANT_OWNERSHIP_BUILTIN(Any, TensorFlowSend)
500500
CONSTANT_OWNERSHIP_BUILTIN(Any, TensorFlowReceive)
501-
CONSTANT_OWNERSHIP_BUILTIN(Any, AutoDiffCreateTape)
502-
CONSTANT_OWNERSHIP_BUILTIN(Any, AutoDiffPushToTape)
503-
CONSTANT_OWNERSHIP_BUILTIN(Any, AutoDiffPopFromTape)
504-
CONSTANT_OWNERSHIP_BUILTIN(Any, AutoDiffDestroyTape)
505501

506502
#undef CONSTANT_OWNERSHIP_BUILTIN
507503

branches/rxwei-patch-1/lib/SILOptimizer/Transforms/AccessEnforcementReleaseSinking.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,6 @@ static bool isBarrier(SILInstruction *inst) {
157157
// SWIFT_ENABLE_TENSORFLOW
158158
case BuiltinValueKind::TensorFlowSend:
159159
case BuiltinValueKind::TensorFlowReceive:
160-
case BuiltinValueKind::AutoDiffCreateTape:
161-
case BuiltinValueKind::AutoDiffPushToTape:
162-
case BuiltinValueKind::AutoDiffPopFromTape:
163-
case BuiltinValueKind::AutoDiffDestroyTape:
164160
return true;
165161

166162
#define BUILTIN_SANITIZER_OPERATION(Id, Name, Attrs) BUILTIN_NO_BARRIER(Id)

branches/rxwei-patch-1/stdlib/public/core/AutoDiff.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,3 @@ public struct AnyDerivative : Differentiable & AdditiveArithmetic {
765765
return AnyDerivative(_box: _box._tangentVector(from: cotangent._box))
766766
}
767767
}
768-
769-
//===----------------------------------------------------------------------===//
770-
// Builtins
771-
//===----------------------------------------------------------------------===//
772-
773-
@usableFromInline @_fixed_layout
774-
class _AutoDiffTape<Element> {}

0 commit comments

Comments
 (0)