Commit Graph

7 Commits

Author SHA1 Message Date
Richard Wei
af8942d940 [AutoDiff] Rename '@differentiable' to '@differentiable(reverse)'.
Compiler:
- Add `Forward` and `Reverse` to `DifferentiabilityKind`.
- Expand `DifferentiabilityMask` in `ExtInfo` to 3 bits so that it now holds all 4 cases of `DifferentiabilityKind`.
- Parse `@differentiable(reverse)` and `@differentiable(_forward)` declaration attributes and type attributes.
- Emit a warning for `@differentiable` without `reverse`.
- Emit an error for `@differentiable(_forward)`.
- Rename `@differentiable(linear)` to `@differentiable(_linear)`.
- Make `@differentiable(reverse)` type lowering go through today's `@differentiable` code path. We will specialize it to reverse-mode in a follow-up patch.

ABI:
- Add `Forward` and `Reverse` to `FunctionMetadataDifferentiabilityKind`.
- Extend `TargetFunctionTypeFlags` by 1 bit to store the highest bit of differentiability kind (linear). Note that there is a 2-bit gap in `DifferentiabilityMask` which is reserved for `AsyncMask` and `ConcurrentMask`; `AsyncMask` is ABI-stable so we cannot change that.

_Differentiation module:
- Replace all occurrences of `@differentiable` with `@differentiable(reverse)`.
- Delete `_transpose(of:)`.

Resolves rdar://69980056.
2021-02-07 14:09:46 -08:00
Anthony Latsis
47ce1529f0 Parse: Only diagnose dollar-prefixed identifiers that are Swift declarations 2020-11-19 20:30:53 +03:00
Dan Zheng
f22d923340 [AutoDiff] Remove obsolete TODO comments. 2020-04-09 01:10:43 -07:00
Dan Zheng
a1c4b68d3c [AutoDiff] Remove @differentiable(jvp:vjp:) parsing logic. (#30604)
Remove logic for parsing and diagnosing `jvp:` and `vjp:` arguments for
`@differentiable` attribute. No logic remains for handling those arguments.

Follow-up to TF-1001.
2020-03-24 11:21:10 -07:00
marcrasi
1be86adbfc [AutoDiff] forbid derivative registration using @differentiable (#30001)
Delete `@differentiable` attribute `jvp:` and `vjp:` arguments for derivative
registration. `@derivative` attribute is now the canonical way to register
derivatives.

Resolves TF-1001.
2020-03-24 00:41:27 -07:00
Dan Zheng
c9c51beda3 [AutoDiff] Attribute gardening. (#29050)
Upstream changes from `tensorflow` branch:
- https://github.com/apple/swift/pull/28932: deprecate `@differentiable(jvp:vjp)` arguments.
- https://github.com/apple/swift/pull/29038: gardening.

Additional gardening included.
2020-01-07 19:24:52 -08:00
Dan Zheng
b530e87737 [AutoDiff upstream] Organize AutoDiff tests.
Move all tests into appropriate subdirectories.
`test/AutoDiff` subdirectory naming matches `test/` subdirectory name.
2019-11-16 14:55:11 -08:00