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-9722] [AD] Ownership verifier: Found a leaked owned value that was never consumed #52157

Closed
rxwei opened this issue Jan 22, 2019 · 0 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. swift for tensorflow

Comments

@rxwei
Copy link
Member

rxwei commented Jan 22, 2019

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

md5: 9bda3a8824c9daf6ad4d85a59ddaef91

Issue Description:

public func foo<T, U>(
  _ f: @escaping @autodiff (T) -> U
) -> @autodiff (T) -> U where T : Differentiable, U : Differentiable {
  @differentiable(vjp: _vjp)
  func original(_ x: T) -> U {
    return f(x)
  }
  func _vjp(_ x: T) -> (U, (U.CotangentVector) -> (T.CotangentVector)) {
    return (f(x), { v in pullback(at: x, in: f)(v) })
  }
  return original
}
Error! Found a leaked owned value that was never consumed.
Value:   %6 = autodiff_function_extract [original] %5 : $@autodiff @callee_guaranteed (@in_guaranteed T) -> @out U // user: %7
...
2.  While emitting SIL for 'withRecomputationInDerivatives(_:)' at /Users/rxwei/Development/Swift/swift-tf-source/swift/stdlib/public/core/AutoDiff.swift:151:8
3.  While silgen emitFunction SIL function "@$ss30withRecomputationInDerivativesyq_xcq_xcs14DifferentiableRzsABR_r0_lF".
 for 'withRecomputationInDerivatives(_:)' at /Users/rxwei/Development/Swift/swift-tf-source/swift/stdlib/public/core/AutoDiff.swift:151:8
4.  While emitting SIL for 'original(_:)' at /Users/rxwei/Development/Swift/swift-tf-source/swift/stdlib/public/core/AutoDiff.swift:158:3
5.  While silgen emitFunction SIL function "@$ss30withRecomputationInDerivativesyq_xcq_xcs14DifferentiableRzsABR_r0_lF8originalL_yq_xsABRzsABR_r0_lF".
 for 'original(_:)' at /Users/rxwei/Development/Swift/swift-tf-source/swift/stdlib/public/core/AutoDiff.swift:158:3
6.  While verifying SIL function "@$ss30withRecomputationInDerivativesyq_xcq_xcs14DifferentiableRzsABR_r0_lF8originalL_yq_xsABRzsABR_r0_lF".
 for 'original(_:)' at /Users/rxwei/Development/Swift/swift-tf-source/swift/stdlib/public/core/AutoDiff.swift:158:3
0  swift                    0x00000001058f5028 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x00000001058f3ff8 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x00000001058f5642 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff66804b3d _sigtramp + 29
4  swift                    0x0000000106299008 (anonymous namespace)::DarwinX86AsmBackend::getCompactUnwindRegNum(unsigned int) const::CU64BitRegs + 219736
5  libsystem_c.dylib        0x00007fff666c21c9 abort + 127
6  swift                    0x0000000105887f9e llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 542
7  swift                    0x0000000102f8a515 (anonymous namespace)::SILValueOwnershipChecker::handleError(llvm::function_ref<void ()>&&) const + 165
8  swift                    0x0000000102f890bd (anonymous namespace)::SILValueOwnershipChecker::check() + 4237
9  swift                    0x0000000102f87e21 swift::SILValue::verifyOwnership(swift::SILModule&, swift::DeadEndBlocks*) const + 353
10 swift                    0x0000000102f7dfac (anonymous namespace)::SILVerifier::visitSILInstruction(swift::SILInstruction*) + 2844
11 swift                    0x0000000102f6bfb9 swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) + 10473
12 swift                    0x0000000102f6824c (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 1196
13 swift                    0x0000000102f62617 swift::SILFunction::verify(bool) const + 8007
14 swift                    0x00000001028ad2bd swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 205
15 swift                    0x00000001028b6d71 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 305
16 swift                    0x00000001028acca5 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 725
17 swift                    0x0000000102990813 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8211
18 swift                    0x000000010298e7f5 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
19 swift                    0x0000000102944a29 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 425
20 swift                    0x00000001028b6d4c swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 268
21 swift                    0x00000001028acca5 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 725
22 swift                    0x00000001028b2de6 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 822
23 swift                    0x00000001028b3d53 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 371
24 swift                    0x00000001028b4280 swift::performSILGeneration(swift::ModuleDecl*, swift::SILOptions&) + 16
25 swift                    0x0000000101fa9886 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 9046
26 swift                    0x0000000101fa64c0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2848
27 swift                    0x0000000101f5829e main + 686
28 libdyld.dylib            0x00007fff66619ed9 start + 1
29 libdyld.dylib            0x0000000000000031 start + 2577293657
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
ninja: build stopped: subcommand failed.
@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

1 participant