-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
AutoDiffbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
Previous ID | SR-14225 |
Radar | None |
Original Reporter | @dan-zheng |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, AutoDiff |
Assignee | None |
Priority | Medium |
md5: 3dd687f0115babbacf97b20cbcb90eba
Issue Description:
@differentiable
func TF_966(_ x: Float, _ bool: Bool) -> Float {
let tuple = (x, 1)
let result = bool ? tuple : tuple
return result.0
}
$ swift -Xllvm -debug-only=differentiation tf-966.swift
PROPAGATING ADJOINT VALUE FOR ACTIVE VALUE
(%16, **%17**) = destructure_tuple %8 : $(Float, Int) // user: %18
$Int
Assertion failed: (hasVal), function getValue, file /Users/danielzheng/swift-bart/llvm/include/llvm/ADT/Optional.h, line 173.
Stack dump:
0. Program arguments: /Users/danielzheng/swift-bart/build/Xcode-ReleaseAssert+swift-DebugAssert/swift-macosx-x86_64/Debug/bin/swift -frontend -interpret tf-966.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -Xllvm -debug-only=differentiation -module-name main
1. Swift version 5.1.1-dev (Swift f655d9e91a)
2. While running pass #​17 SILModuleTransform "Differentiation".
3. While processing `[differentiable source 0 wrt 0]` attribute on SIL function "@$s4main6TF_966yS2f_SbtF".
for 'TF_966(_:_:)' (at tf-966.swift:2:1)
0 swift 0x000000010f317525 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 swift 0x000000010f316508 llvm::sys::RunSignalHandlers() + 248
2 swift 0x000000010f317b28 SignalHandler(int) + 264
3 libsystem_platform.dylib 0x00007fff728e4b5d _sigtramp + 29
4 libsystem_platform.dylib 0x0000000000013e38 _sigtramp + 2373120760
5 libsystem_c.dylib 0x00007fff7279e6a6 abort + 127
6 libsystem_c.dylib 0x00007fff7276720d basename_r + 0
7 swift 0x000000010be20c65 llvm::optional_detail::OptionalStorage<swift::VectorSpace, true>::getValue() & + 69
8 swift 0x000000010be20c15 llvm::Optional<swift::VectorSpace>::getPointer() + 21
9 swift 0x000000010be07f95 llvm::Optional<swift::VectorSpace>::operator->() + 21
10 swift 0x000000010a649362 (anonymous namespace)::PullbackEmitter::getRemappedTangentType(swift::SILType) + 98
11 swift 0x000000010a629ea9 (anonymous namespace)::PullbackEmitter::run() + 3529
Pullback generation crashes while propagating adjoint values for active values because dominated active values may have no tangent space.
Perhaps we can modify activity analysis to avoid this issue. Otherwise, we can skip non-differentiable values while tracking dominated active values.
Metadata
Metadata
Assignees
Labels
AutoDiffbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself