The `differentiability_witness_function` instruction looks up a
differentiability witness function (JVP, VJP, or transpose) for a referenced
function via SIL differentiability witnesses.
Add round-trip parsing/serialization and IRGen tests.
Notes:
- Differentiability witnesses for linear functions require more support.
`differentiability_witness_function [transpose]` instructions do not yet
have IRGen.
- Nothing currently generates `differentiability_witness_function` instructions.
The differentiation transform does, but it hasn't been upstreamed yet.
Resolves TF-1141.
* Increase heading levels
* Update the introduction
* Use `Int` in `qsort` examples
* Use `CInt` in anonymous structs
* Use `CUnsignedInt` in enums
* De-dupe `HomeworkExcuse` enum
SIL differentiability witnesses are a new top-level SIL construct mapping
"original" SIL functions to derivative SIL functions.
SIL differentiability witnesses have the following components:
- "Original" `SILFunction`.
- SIL linkage.
- Differentiability parameter indices (`IndexSubset`).
- Differentiability result indices (`IndexSubset`).
- Derivative `GenericSignature` representing differentiability generic
requirements (optional).
- JVP derivative `SILFunction` (optional).
- VJP derivative `SILFunction` (optional).
- "Is serialized?" bit.
This patch adds the `SILDifferentiabilityWitness` data structure, with
documentation, parsing, and printing.
Resolves TF-911.
Todos:
- TF-1136: upstream `SILDifferentiabilityWitness` serialization.
- TF-1137: upstream `SILDifferentiabilityWitness` verification.
- TF-1138: upstream `SILDifferentiabilityWitness` SILGen from
`@differentiable` and `@derivative` attributes.
- TF-20: robust mangling for `SILDifferentiabilityWitness` names.
Currently, when a conforming type implements a `@differentiable` protocol requirement, the corresponding conforming implemnetation is required to have at least a `@differentiable` that covers all differentiability parameters in the protocol requirement. However, this is not a great design for usability because developers almost always start with missing `@differentiable` and getting an compilation error. This also makes ML models built with libraries that use differentiable programming more verbose than those built with other ML frameworks.
We agreed during this Friday's design review to allow `@differentiable` to be implicitly inherited from protocols when the conforming implementation is non-public.
The Swift project has entirely migrated to GitHub for development. This
document covering the migration aspects of subversion are no longer
really relevant. Prune the obsoleted documentation.
While reading up I realized there is a typo in: `how to use utils/process-stats-dir.py`. The example asks to use OLD and NEW compiler but the documentation uses only ${OLD} compiler in example
* `Builtin.autodiffApply*` has been renamed to `Builtin.applyDerivative*`.
* The reason I'm not adding `_jvp` is because there will no longer be `_vjp`, which will make this suffix entirely unnecessary.
* The transpose application builtin is named `Builtin.applyTranspose*`.