Support `@differentiable` function conversion for `init` references, in
addition to `func` references and literal closures. Minor usability improvement.
Resolves SR-12562.
Add `Differentiable.withDerivative(_:)`, a "derivative surgery" API.
`Differentiable.withDerivative(_:)` is an identity function returning `self`.
It takes a closure and applies it to the derivative of the return value, in
contexts where the return value is differentiated with respect to.
`-lm` is not portable, it is only needed on certain platforms (e.g.
Linux, not BSD). Remove the explicit link.
Avoid using a static library as that is not supported on all platforms
(e.g. Windows). Use the helper macros to generate the library.
Repairs the Windows tests.
The name of the module is encoded into the type name. The module name
is not `null` on Windows, which would fail to match the name. It is
possible to make the test less overly-constricted, but setting the
module name to null is simpler and avoids more regex matching.
Fix `@derivative` attribute type-checking crash, so far reproducible only via
`-parse-stdlib`.
The crash occurs because it is not sufficient for type-checking to check for
`Differentiable` conformances. We must also check for invalid `TangentVector`
associated types.
Resolves SR-12559.
Support `@differentiable` function conversion for `init` references, in
addition to `func` references and literal closures. Minor usability improvement.
Resolves SR-12562.
- Remove unnecessary imports from test/AutoDiff/stdlib/simd.swift.
- Use platform-correct `Builtin` integer type in
`PullbackEmitter::getArrayAdjointElementBuffer`.
JVP functions are forward-mode derivative functions. They take original
arguments and return original results and a differential function. Differential
functions take derivatives wrt arguments and return derivatives wrt results.
`JVPEmitter` is a cloner that emits JVP and differential functions at the same
time. In JVP functions, function applications are replaced with JVP function
applications. In differential functions, function applications are replaced
with differential function applications.
In JVP functions, each basic block takes a differential struct containing callee
differentials. These structs are consumed by differential functions.
Disable `SILCombiner::visitPartialApplyInst` from rewriting `partial_apply` with
with `@convention(method)` callee to `thin_to_thick_function`.
This fixes SIL verification errors: `thin_to_thick_function` only supports
`@convention(thin)` operands.
Resolves SR-12548.
Test SR-12548: `SILCombiner::visitPartialApplyInst` rewrites `partial_apply`
with `@convention(method)` callee to `thin_to_thick_function`.
This produces a SIL verification error: `thin_to_thick_function` only supports
`@convention(thin)` operands.
Add implicit declarations generated by the differentiation transform to a
`SynthesizedFileUnit` instead of an ad-hoc pre-existing `SourceFile`.
Resolves TF-1232: type reconstruction for AutoDiff-generated declarations.
Previously, type reconstruction failed because retroactively adding declarations
to a `SourceFile` did not update name lookup caches.