Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9406] ProtocolConformance.cpp Tensor Protocol Assertion Failed. #51872

Closed
swift-ci opened this issue Dec 4, 2018 · 1 comment
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. swift for tensorflow

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 4, 2018

Previous ID SR-9406
Radar None
Original Reporter bartchr808 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Swift for TensorFlow
Labels Bug
Assignee @rxwei
Priority Medium

md5: c09aa0c3712369ee60cc55de7e7504e9

Issue Description:

How to Reproduce

  1. Start up a fresh Swift REPL session in the console.

  2. Paste the following code into the console:

import TensorFlow 
func quadratic(_ x: Float) -> Float { 
    return x * x 
}
let dq = #gradient(quadratic)
  1. Hit Enter/Return to execute the code. You should see something that looks like the following in blue in the console:
dq: (Float) -> Float = 0x0000000109e8a2a0 $__lldb_expr2`AD__$s13__lldb_expr_19quadraticyS2fF__grad_src_0_wrt_0 at repl.swift:2
  1. Past the following code into the console:
var x = Tensor<Float>([[1, 2], [3, 4]])
  1. When you hit Enter/Return, it should Error with the following stack trace:
Assertion failed: ((!isComplete() || isInvalid() || requirement->getAttrs().hasAttribute<OptionalAttr>() || requirement->getAttrs().isUnavailable( requirement->getASTContext())) && "Conformance already complete?"), function setWitness, file /usr/local/src/swift-build/swift/lib/AST/ProtocolConformance.cpp, line 886.
0  lldb                     0x000000010f2afa18 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  lldb                     0x000000010f2aec67 llvm::sys::RunSignalHandlers() + 39
2  lldb                     0x000000010f2b0092 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff61a7eb3d _sigtramp + 29
4  libsystem_platform.dylib 0x00007feb6b900000 _sigtramp + 166204640
5  libsystem_c.dylib        0x00007fff6193d1c9 abort + 127
6  libsystem_c.dylib        0x00007fff61905868 basename_r + 0
7  LLDB                     0x000000011e6e3951 swift::NormalProtocolConformance::setWitness(swift::ValueDecl*, swift::Witness) const + 817
8  LLDB                     0x000000011e3d2ed5 swift::ConformanceChecker::recordWitness(swift::ValueDecl*, swift::RequirementMatch const&) + 293
9  LLDB                     0x000000011e3d6185 swift::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 2549
10 LLDB                     0x000000011e3f5cd8 swift::ConformanceChecker::resolveSingleWitness(swift::ValueDecl*) + 472
11 LLDB                     0x000000011e3dce4b swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 443
12 LLDB                     0x000000011e6e11fa swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 330
13 LLDB                     0x000000011e6e0f78 swift::ProtocolConformance::getWitnessDeclRef(swift::ValueDecl*, swift::LazyResolver*) const + 40
14 LLDB                     0x000000011e24d0ab findNamedWitnessImpl(swift::TypeChecker&, swift::DeclContext*, swift::Type, swift::ProtocolDecl*, swift::DeclName, swift::Diag<>, llvm::Optional<swift::ProtocolConformanceRef>) + 475
15 LLDB                     0x000000011e251a1b swift::TypeChecker::callWitness(swift::Expr*, swift::DeclContext*, swift::ProtocolDecl*, swift::ProtocolConformanceRef, swift::DeclName, llvm::MutableArrayRef<swift::Expr*>, swift::Diag<>) + 315
16 LLDB                     0x000000011e26622d (anonymous namespace)::ExprRewriter::convertLiteral(swift::Expr*, swift::Type, swift::Type, swift::ProtocolDecl*, llvm::PointerUnion<swift::Identifier, swift::Type>, swift::DeclName, swift::ProtocolDecl*, llvm::PointerUnion<swift::Identifier, swift::Type>, swift::DeclName, bool (*)(swift::Type), swift::Diag<>, swift::Diag<>) + 845
17 LLDB                     0x000000011e2663da (anonymous namespace)::ExprRewriter::convertLiteral(swift::Expr*, swift::Type, swift::Type, swift::ProtocolDecl*, llvm::PointerUnion<swift::Identifier, swift::Type>, swift::DeclName, swift::ProtocolDecl*, llvm::PointerUnion<swift::Identifier, swift::Type>, swift::DeclName, bool (*)(swift::Type), swift::Diag<>, swift::Diag<>) + 1274
18 LLDB                     0x000000011e2668eb (anonymous namespace)::ExprRewriter::handleIntegerLiteralExpr(swift::LiteralExpr*) + 555
19 LLDB                     0x000000011e251406 (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) + 22
20 LLDB                     0x000000011e2574e6 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) + 22
21 LLDB                     0x000000011e61899f (anonymous namespace)::Traversal::visitCollectionExpr(swift::CollectionExpr*) + 287
22 LLDB                     0x000000011e61897e (anonymous namespace)::Traversal::visitCollectionExpr(swift::CollectionExpr*) + 254
23 LLDB                     0x000000011e6163e0 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 256
24 LLDB                     0x000000011e618c6f (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 207
25 LLDB                     0x000000011e615cb4 swift::Expr::walk(swift::ASTWalker&) + 84
26 LLDB                     0x000000011e24e4ed swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 573
27 LLDB                     0x000000011e37a71c swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1132
28 LLDB                     0x000000011e37f515 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, bool) + 357
29 LLDB                     0x000000011e37f81b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int, bool) + 315
30 LLDB                     0x000000011e394d2e validatePatternBindingEntries(swift::TypeChecker&, swift::PatternBindingDecl*) + 814
31 LLDB                     0x000000011e38d1a4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 884
32 LLDB                     0x000000011e38ce26 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
33 LLDB                     0x000000011e406b73 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 451
34 LLDB                     0x000000011e405ea8 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
35 LLDB                     0x000000011e405dde swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 174
36 LLDB                     0x000000011e426945 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 853
37 LLDB                     0x000000011f0ab988 lldb_private::SwiftExpressionParser::Parse(lldb_private::DiagnosticManager&, unsigned int, unsigned int, unsigned int) + 442
38 LLDB                     0x000000011f0fce76 lldb_private::SwiftUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool, unsigned int) + 904
39 LLDB                     0x000000011ee86dc2 lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, lldb_private::SharingPtr<lldb_private::ValueObject>&, lldb_private::Status&, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<lldb_private::Module>*) + 1294
40 LLDB                     0x000000011ed2d155 lldb_private::REPL::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 1881
41 LLDB                     0x000000011edce147 lldb_private::IOHandlerEditline::Run() + 319
42 LLDB                     0x000000011ec7839a lldb_private::Debugger::ExecuteIOHandlers() + 68
43 LLDB                     0x000000011ec7b124 lldb_private::Debugger::IOHandlerThread(void*) + 14
44 LLDB                     0x000000011eee5012 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 110
45 libsystem_pthread.dylib  0x00007fff61a8733d _pthread_body + 126
46 libsystem_pthread.dylib  0x00007fff61a8a2a7 _pthread_start + 70
47 libsystem_pthread.dylib  0x00007fff61a86425 thread_start + 13
[1]    6104 abort      swift

This should also happen if you were to type this manually and not copy and paste the code into the console. However, you can only verify this once SR-8613 is implemented (refer to the below linked Github issue as to why).

The expected behavior is the code runs with no error occurring. @rxwei thinks that this is likely an LLDB bug.

This ticket refers to this Github issue.

@rxwei
Copy link
Member

rxwei commented Jan 17, 2019

Both have been fixed now!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. swift for tensorflow
Projects
None yet
Development

No branches or pull requests

2 participants