You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After fixing SR-15205 the following code triggers an assertion:
import _Differentiation
structFoo{varbar:Floatvarbaz:Floatvarname:String?}func outerFunc(doIterations :Int, value:inoutFloat)->(Float,(Float)->Float){@differentiable(reverse, wrt: param)func innerFunc1(param:Float, other:Foo)->Float{
value += param * other.bar
return value * param * 2.0
}@differentiable(reverse, wrt: param)func innerFunc2(param:Float, other:Foo)->Float{
value += param * other.baz
return value * param * 3.0
}@differentiable(reverse, wrt:(param1, param2))func loop(param1 :Float, param2:Float, other1:Foo, other2:Foo)->Float{varres:Float;
res = 0.0
for _ in 0..< doIterations {
res +=innerFunc1(param: param1, other: other1)
res +=innerFunc2(param: param2, other: other2)}return res
}@differentiable(reverse)func curriedFunc(param:Float)->Float{letother=Foo(bar:7, baz:9)returnloop(param1: param, param2: param, other1: other, other2: other)}letvalAndPullback=valueWithPullback(at: value, of: curriedFunc)return(value + valAndPullback.value, valAndPullback.pullback)}
Assertion is:
Assertion failed: (srcAddr->getType() == destAddr->getType()), function createCopyAddr, file SILBuilder.h, line 1022.
Stack dump:
0. Program arguments: ./swift-frontend -frontend 3.swift -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -color-diagnostics -new-driver-path /Users/asl/Projects/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/bin/swift-driver -resource-dir /Users/asl/Projects/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift -module-name main -target-sdk-version 12.1 -interpret
1. Swift version 5.7-dev (LLVM fb1cb9b18897f6d, Swift 30d318a697a5b43)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for main)
4. While running pass #​88 SILModuleTransform "Differentiation".
5. While canonicalizing `differentiable_function` SIL node %21 = differentiable_function [parameters 0 1 5] [results 0 1] %20 : $@convention(thin) (Float, Float, @guaranteed Foo, @guaranteed Foo, Int, @inout_aliasable Float) -> Float // user: %22
6. While ...in SIL function "@$s4main9outerFunc12doIterations5valueSf_S2fctSi_SfztF07curriedC0L_5paramS2f_tFTJrSUUpSr".
for 'curriedFunc(param:)' (at 3.swift:35:3)
7. While processing // differentiability witness for loop #​1 (param1:param2:other1:other2:) in outerFunc(doIterations:value:)
sil_differentiability_witness private [reverse] [parameters 0 1 5] [results 0 1] @$s4main9outerFunc12doIterations5valueSf_S2fctSi_SfztF4loopL_6param16param26other16other2S2f_SfAA3FooVAKtF : $@convention(thin) (Float, Float, @guaranteed Foo, @guaranteed Foo, Int, @inout_aliasable Float) -> Float {
}
on SIL function "@$s4main9outerFunc12doIterations5valueSf_S2fctSi_SfztF4loopL_6param16param26other16other2S2f_SfAA3FooVAKtF".
for 'loop(param1:param2:other1:other2:)' (at 3.swift:23:3)
8. While generating VJP for SIL function "@$s4main9outerFunc12doIterations5valueSf_S2fctSi_SfztF4loopL_6param16param26other16other2S2f_SfAA3FooVAKtF".
for 'loop(param1:param2:other1:other2:)' (at 3.swift:23:3)
9. While generating pullback for SIL function "@$s4main9outerFunc12doIterations5valueSf_S2fctSi_SfztF4loopL_6param16param26other16other2S2f_SfAA3FooVAKtF".
for 'loop(param1:param2:other1:other2:)' (at 3.swift:23:3)
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 717a550c91a9b4d88b9a1b4a014b8a4a
Issue Description:
After fixing SR-15205 the following code triggers an assertion:
Assertion is:
The text was updated successfully, but these errors were encountered: