Commit Graph

2 Commits

Author SHA1 Message Date
Saleem Abdulrasool
0a292fdaf9 Differentiation: correct the storage annotation for runtime functions
The runtime support functions are currently vended by
swiftCore.{dll,dylib,so} rather than
swift_Differentiation.{dll,dylib,so}.  This corrects the annotations to
indicate that reality.  This never could have worked as declared in the
first place.  swift_Differentiation never links against swiftRuntime
and swiftCore effectively whole-archives swiftRuntime into itself.  This
change is now reflecting that reality.  If the desire is to move this
(even on Darwin, where this may have already shipped and thus would
break ABI), we could split up the swiftRuntime into swiftRuntime and
swiftDifferentiationRuntime and link that as we do with the runtime into
swiftCore.
2021-08-24 14:24:18 -07:00
Richard Wei
de2dbe57ed [AutoDiff] Bump-pointer allocate pullback structs in loops. (#34886)
In derivatives of loops, no longer allocate boxes for indirect case payloads. Instead, use a custom pullback context in the runtime which contains a bump-pointer allocator.

When a function contains a differentiated loop, the closure context is a `Builtin.NativeObject`, which contains a `swift::AutoDiffLinearMapContext` and a tail-allocated top-level linear map struct (which represents the linear map struct that was previously directly partial-applied into the pullback). In branching trace enums, the payloads of previously indirect cases will be allocated by `swift::AutoDiffLinearMapContext::allocate` and stored as a `Builtin.RawPointer`.
2020-11-30 15:49:38 -08:00