Hi IRGen experts,
We recently ran into a IRGenDebugInfo crash (TF-597) on the tensorflow
branch during stdlib compilation:
Assertion failed: (OffsetInBits + SizeInBits <= getSizeInBits(Var) && "pars > totum"), function emitVariableDeclaration, file /Users/danielzheng/swift-build/swift/lib/IRGen/IRGenDebugInfo.cpp, line 2212.
Stack dump:
0. Program arguments: ./build/Xcode-ReleaseAssert+swift-DebugAssert/swift-macosx-x86_64/Debug/bin/swift -frontend -c -filelist /var/folders/m_/6f7q8zfs3n9fr0c_4gy8840m00hc_q/T/sources-80e037 -supplementary-output-file-map /var/folders/m_/6f7q8zfs3n9fr0c_4gy8840m00hc_q/T/supplementaryOutputs-68e761 -disable-objc-attr-requires-foundation-module -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/danielzheng/swift-build/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/./lib/swift/macosx -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/../../../Developer/Library/Frameworks -warn-swift3-objc-inference-complete -warn-implicit-overrides -enable-library-evolution -g -module-cache-path /Users/danielzheng/swift-build/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/./module-cache -module-link-name swiftCore -nostdimport -parse-stdlib -resource-dir /Users/danielzheng/swift-build/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/./lib/swift -swift-version 5 -O -D INTERNAL_CHECKS_ENABLED -D SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -enable-resilience -enforce-exclusivity=unchecked -group-info-path /Users/danielzheng/swift-build/swift/stdlib/public/core/GroupInfo.json -verify-syntax-tree -enable-anonymous-context-mangled-names -Xllvm -sil-inline-generics -Xllvm -sil-partial-specialization -Xcc -DswiftCore_EXPORTS -parse-as-library -module-name Swift -o /Users/danielzheng/swift-build/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/stdlib/public/core/OSX/x86_64/Swift.o -runtime-compatibility-version none
1. Swift version 5.1-dev (LLVM e56fafcd29, Swift 07043f52ff)
2. Contents of /var/folders/m_/6f7q8zfs3n9fr0c_4gy8840m00hc_q/T/sources-80e037:
3. While emitting IR SIL function "@$ss8pullback2at2in13TangentVectorQzADQy_cx_q_xXEts14DifferentiableRzsAGR_r0_lF".
for 'pullback(at:in:)' (at /Users/danielzheng/swift-build/swift/stdlib/public/core/AutoDiff.swift:366:8)
namespace)::IRGenDebugInfoImpl::emitVariableDeclaration(swift::irgen::IRBuilder&, llvm::ArrayRef<llvm::Value*>, swift::irgen::DebugTypeInfo, swift::SILDebugScope const*, swift::ValueDecl*, llvm::StringRef, unsigned int, swift::irgen::IndirectionKind, swift::irgen::ArtificialKind) + 2664
The crash appeared after merging from master
to tensorflow
sometime in June: either after syncing to swift-DEVELOPMENT-SNAPSHOT-2019-06-06-a
or swift-DEVELOPMENT-SNAPSHOT-2019-06-13-a
.
The assertion failure happens here in IRGenDebugInfoImpl::emitVariableDeclaration
. It's related to the @differentiable
function typed argument of pullback(at:in:)
:
@inlinable
public func pullback<T, R>(
at x: T, in f: @differentiable (T) -> R
) -> (R.TangentVector) -> T.TangentVector {
return Builtin.autodiffApply_vjp(f, x).1
}
@differentiable
function types only exist on the tensorflow
branch, but we haven't encountered any IRGenDebugInfo crashes until very recently. Looking at the history of lib/IRGen
and lib/IRGen/IRGenDebugInfo.cpp
, it's not clear what changes led to this crash.
Does anyone have any ideas for debugging this? Any help would be appreciated!