-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff upstream] Add the _Differentiation module. #27511
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
3d6bb24
to
154ab48
Compare
Rename the `Differentiable` protocol to `_Differentiable`. This matches upstreaming PR #27511, which adds `protocol _Differentiable` in a new `Differentiable.swift` file. `tensorflow` branch defines `typealias Differentiable = _Differentiable` for usability. There should be no user-facing changes, except that some error messages now show '_Differentiable' instead of 'Differentiable'.
154ab48
to
36214fd
Compare
Hi @DougGregor: could you please help review this patch (or forward to appropriate reviewers)? Compilation of the |
Why is this going into the standard library vs. an auto-diff support library? Is it truly the only library piece for auto-diff? |
@DougGregor It is because we don't yet support retroactive derivative registration, and we will need to define derivatives for That said, we now aim to finish support for retroactive derivative registration this week with SIL differentiability witnesses. So we can check everything into the |
@dan-zheng Could you update the PR to add the @DougGregor We'll ping you when it's ready for review again in an hour or so. |
36214fd
to
5dc37c3
Compare
@DougGregor: a separate experimental |
5dc37c3
to
35edb18
Compare
Hi @DougGregor (and others): could you please help re-review this patch? It adds a flag-gated experimental |
@swift-ci Please smoke test |
@DougGregor: ping in case you have time for review. |
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
@swift-ci Please smoke test |
There appears to be an orthogonal SourceKit-LSP test failure (https://ci.swift.org/job/swift-PR-Linux-smoke-test/18001):
I'll rebase on top of master and rerun tests. |
5aecece
to
5191338
Compare
@swift-ci Please smoke test |
Move differentiable-programming-related stdlib sources to `stdlib/public/core/Differentiation`. Related master branch PR: swiftlang#27511. master branch will have a `_Differentiation` support library containing the `Differentiable` protocol and related APIs. On tensorflow branch, the Swift source files in `stdlib/public/core/Differentiation` will be directly built as part of swiftCore for simplicity. Swift for TensorFlow users can continue to use the `Differentiable` protocol and related APIs without adding `import _Differentiation`. Rename `protocol _Differentiable` back to `protocol Differentiable`.
c2d8e98
to
f02f008
Compare
The `_Differentiation` module is the experimental support library for differentiable programming. It is built when the build-script flag `--enable-experimental-differentiable-programming` is enabled. The `Differentiable` protocol generalizes all types that work with differentiation. It is a core piece of the differentiable programming project. Other parts depending on the `Differentiable` protocol will be upstreamed piece by piece. The `Differentiable` protocol is compiler-known and will be used during type-checking, SILGen, and the SIL differentiation transform.
f02f008
to
f2b6365
Compare
Note since last review: the |
@swift-ci Please smoke test |
…#28089) Move differentiable-programming-related stdlib sources to `stdlib/public/core/Differentiation`. Related master branch PR: #27511. master branch will have a `_Differentiation` support library containing the `Differentiable` protocol and related APIs. On tensorflow branch, the Swift source files in `stdlib/public/core/Differentiation` will be directly built as part of swiftCore for simplicity. Swift for TensorFlow users can continue to use the `Differentiable` protocol and related APIs without adding `import _Differentiation`. - Create empty `_Differentiation` module on tensorflow branch to avoid `#if canImport(_Differentiation)` checks in upstreamed AutoDiff tests. - Rename `protocol _Differentiable` back to `protocol Differentiable`. - Expose SR-11723. Workaround applied to fix validation-test/ParseableInterface/verify_stdlib.swift.
The
_Differentiation
module is the experimental support library fordifferentiable programming. It is built when the build-script flag
--enable-experimental-differentiable-programming
is enabled.The
Differentiable
protocol generalizes all types that work withdifferentiation. It is a core piece of the differentiable programming
project. Other parts depending on the
Differentiable
protocol willbe upstreamed piece by piece.
The
Differentiable
protocol is compiler-known and will be used duringtype-checking, SILGen, and the SIL differentiation transform.
Forum discussion on upstreaming differentiable programming.