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
SR-13506 [AD] Use principled mangling for AD-generated symbols
Issue Description:
Mangle AutoDiff-generated linear map structs and branching trace enums.
Without proper mangling, an IRGenDebugInfo assertion triggers:
import _Differentiation
extensionFloat{@_silgen_name("add")staticfunc add(_ x:Float, _ y:Float)->Float{return x + y
}@derivative(of: add)staticfunc addVJP(_ x:Float, _ y:Float)->(
value:Float, pullback:(Float)->(Float,Float)){return(add(x, y),{ v in(v, v)})}}@differentiablefunc foo(_ x:Float)->Float{lety=Float.add(x, x)return y
}// Failed to reconstruct type for $s4main42_AD__$s4main3fooyS2fF_bb0__PB__src_0_wrt_0VmD// Original type:// (metatype_type// (struct_type decl=main.(file)._AD__$s4main3fooyS2fF_bb0__PB__src_0_wrt_0))// Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Users/danielzheng/swift-merge/llvm-project/llvm/include/llvm/Support/Casting.h, line 264.
This blocks end-to-end AutoDiff testing on master branch.
The text was updated successfully, but these errors were encountered:
It turns out AutoDiff-generated declarations don't need special mangling support, they just need to be correctly added to file units so that they can be found via name lookup.
Additional Detail from JIRA
md5: 8ba730207e6c9b8443e7c80770d0f6b6
Parent-Task:
Issue Description:
Mangle AutoDiff-generated linear map structs and branching trace enums.
Without proper mangling, an IRGenDebugInfo assertion triggers:
This blocks end-to-end AutoDiff testing on master branch.
The text was updated successfully, but these errors were encountered: