Closed
Description
Previous ID | SR-12175 |
Radar | rdar://problem/59496016 |
Original Reporter | @dan-zheng |
Type | Sub-task |
Additional Detail from JIRA
Votes | 0 |
Component/s | |
Labels | Sub-task |
Assignee | None |
Priority | Medium |
md5: 93e14b077ba1c338e9439a8336b784bc
Parent-Task:
Issue Description:
class C: Differentiable {
@differentiable
var float: Float = 0.0
}
$ swift -enable-experimental-forward-mode-differentiation -Xllvm -debug-only=differentiation sr-12175.swift
...
[AD] Original bb0: To differentiate or not to differentiate?
[ ] debug_value %0 : $C, let, name "self", argno 1 // id: %1
[x] %2 = ref_element_addr %0 : $C, #C.float // user: %3
[x] %3 = begin_access [read] [dynamic] %2 : $*Float // users: %5, %4
[x] %4 = load [trivial] %3 : $*Float // user: %6
[x] end_access %3 : $*Float // id: %5
[ ] return %4 : $Float // id: %6
[AD] Adding tangent for %0 = argument of bb0 : $C // users: %2, %1
[AD] Assigned parameter %0 = argument of bb0 : $C.TangentVector
as the tangent of original result %0 = argument of bb0 : $C // users: %2, %1
[AD] JVPEmitter visited:
[ORIG] %2 = ref_element_addr %0 : $C, #C.float // user: %3
[TAN] Emitted in differential:
[AD] JVPEmitter visited:
[ORIG] %3 = begin_access [read] [dynamic] %2 : $*Float // users: %5, %4
Assertion failed: (!insertion.second && "tangent buffer should already exist"), function getTangentBuffer, file /Users/danielzheng/swift-dev/swift/lib/SILOptimizer/Utils/Differentiation/JVPEmitter.cpp, line 257.
Stack dump:
0. Program arguments: /Users/danielzheng/swift-dev/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -interpret sr-12175.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -enable-experimental-forward-mode-differentiation -Xllvm -debug-only=differentiation -module-name main
1. Swift version 5.2-dev (Swift 9a55217738)
2. While running pass #​507 SILModuleTransform "Differentiation".
3. While processing // differentiability witness for C.float.getter
sil_differentiability_witness hidden [parameters 0] [results 0] @$s4main1CC5floatSfvg : $@convention(method) (@guaranteed C) -> Float {
}
on SIL function "@$s4main1CC5floatSfvg".
for getter for float (at sr-12175.swift:3:7)
4. While generating JVP and differential for SIL function "@$s4main1CC5floatSfvg".
for getter for float (at sr-12175.swift:3:7)