swift
94efee12 - [AutoDiff upstream] Add `@differentiable` function reabstraction.

Commit
5 years ago
[AutoDiff upstream] Add `@differentiable` function reabstraction. Add SILGen logic for reabstracting `@differentiable` functions. Current status: IRGenDebugInfo crash. ``` import _Differentiation func foo(_ x: Any) {} let x: @differentiable (Float) -> Float = { $0 } foo(x) // Failed to reconstruct type for $sS2fIedgyd_D // Original type: // (sil_function_type type=@differentiable @callee_guaranteed (Float) -> Float // (input=struct_type decl=Swift.(file).Float) // (result=struct_type decl=Swift.(file).Float) // (substitution_map generic_signature=<nullptr>) // (substitution_map generic_signature=<nullptr>)) // Stack dump: // 0. Program arguments: /Users/danielzheng/swift-master/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -interpret foo.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -enable-experimental-differentiable-programming -module-name foo // 1. Swift version 5.3-dev (LLVM 29520fcb6f, Swift 91b729d478) // 2. While running user code "foo.swift" // 3. While evaluating request IRGenWholeModuleRequest(IR Generation for module foo) // 0 swift 0x000000010a45ada5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37 // 1 swift 0x000000010a459d58 llvm::sys::RunSignalHandlers() + 248 // 2 swift 0x000000010a45b39c SignalHandler(int) + 268 // 3 libsystem_platform.dylib 0x00007fff6deebb5d _sigtramp + 29 // 4 libsystem_platform.dylib 0x00007fa3c291e410 _sigtramp + 18446743679992539344 // 5 libsystem_c.dylib 0x00007fff6dda56a6 abort + 127 // 6 swift 0x000000010a597fb6 (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) (.cold.2) + 102 // 7 swift 0x000000010627f00a (anonymous namespace)::IRGenDebugInfoImpl::getOrCreateType(swift::irgen::DebugTypeInfo) + 3610 // 8 swift 0x0000000106279797 swift::irgen::IRGenDebugInfo::emitGlobalVariableDeclaration(llvm::GlobalVariable*, llvm::StringRef, llvm::StringRef, swift::irgen::DebugTypeInfo, bool, bool, llvm::Optional<swift::SILLocation>) + 167 // 9 swift 0x000000010619e3f2 swift::irgen::createVariable(swift::irgen::IRGenModule&, swift::irgen::LinkInfo&, llvm::Type*, swift::irgen::Alignment, swift::irgen::DebugTypeInfo, llvm::Optional<swift::SILLocation>, llvm::StringRef, bool) + 546 // 10 swift 0x000000010619f440 swift::irgen::IRGenModule::getAddrOfSILGlobalVariable(swift::SILGlobalVariable*, swift::irgen::TypeInfo const&, swift::ForDefinition_t) + 2624 // 11 swift 0x0000000106199793 swift::irgen::IRGenerator::emitGlobalTopLevel(llvm::StringSet<llvm::MallocAllocator>*) + 723 ``` Resolves TF-1223.
Author
Committer
Parents
Loading