-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff] Add '@differentiable(reverse)'. #35811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
TODO: Update all the call sites. |
96e4059
to
283b3d2
Compare
283b3d2
to
f8ba991
Compare
f8ba991
to
d457cb7
Compare
@swift-ci please test |
Build failed |
Build failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
624a6d4
to
f2baf57
Compare
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.
f2baf57
to
af8942d
Compare
@swift-ci please smoke test |
@swift-ci please test source compatibility |
Build failed |
Build failed |
@swift-ci please test and merge |
@swift-ci please test macOS |
…bute. Reflects changes in swiftlang/swift#35811 (rdar://69980056).
swiftlang/swift-syntax#258 |
Compiler:
Forward
andReverse
toDifferentiabilityKind
.DifferentiabilityMask
inExtInfo
to 3 bits so that it now holds all 4 cases ofDifferentiabilityKind
.@differentiable(reverse)
and@differentiable(_forward)
declaration attributes and type attributes.@differentiable
withoutreverse
.@differentiable(_forward)
.@differentiable(linear)
to@differentiable(_linear)
.@differentiable(reverse)
type lowering go through today's@differentiable
code path. We will specialize it to reverse-mode in a follow-up patch.ABI:
Forward
andReverse
toFunctionMetadataDifferentiabilityKind
.TargetFunctionTypeFlags
by 1 bit to store the highest bit of differentiability kind (linear). Note that there is a 2-bit gap inDifferentiabilityMask
which is reserved forAsyncMask
andConcurrentMask
;AsyncMask
is ABI-stable so we cannot change that._Differentiation module:
@differentiable
with@differentiable(reverse)
._transpose(of:)
.Resolves rdar://69980056.