-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[AutoDiff] Forward-mode support for variables, generics, tuples, structs. #26743
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
[AutoDiff] Forward-mode support for variables, generics, tuples, structs. #26743
Conversation
e58d9c6 to
b3a80a8
Compare
|
@swift-ci please test tensorflow |
1 similar comment
|
@swift-ci please test tensorflow |
|
@rxwei @dan-zheng just so it's easier for you to merge it in once we have time, spent a minute to deal with the merge conflict and verify it still works 😄 |
|
@swift-ci please test tensorflow |
|
@swift-ci Please clean test tensorflow |
…-emitter-generic-support
Follow-up to swiftlang#26928 for reverse-mode. TF-788 tracks re-enabling the warning.
- Handle `copy_value` and `destroy_addr` in "should differentiate" logic. These should be visited if they have an active operand. - Add differential visitors for `destroy_value` and `destroy_addr`.
Remove precondition that argument must be tuple-typed to simplify call sites. Clean up call site code and doc comments.
36a1083 to
b86bfd4
Compare
TF-800 tracks special-case activity analysis and "should differentiate" logic regarding tuple-typed `apply` results.
b86bfd4 to
d3155ed
Compare
|
@swift-ci Please clean test tensorflow |
|
Merging to unblock high priority patch #26709. |
Differentiation conditions were inconsistent between JVP and VJP. Originally, `shouldDifferentiateInstruction` blindly differentiated any side-effecting instruction that has active operands. This worked well with VJP but not with JVP, so swiftlang#26743 added more specific conditions for JVP, but they did not work well with VJP because activity analysis was not yet unified. Now that activity analysis has been unified by swiftlang#27358, `shouldDifferentiateInstruction` no longer needs to distinguish between JVP and VJP, and the JVP differentiation conditions now apply to VJP as well. This PR makes both JVP and VJP use the same differentiation conditions. All existing tests pass. Fixes [TF-800](https://bugs.swift.org/browse/TF-800).
#27421) Differentiation conditions were inconsistent between JVP and VJP. Originally, `shouldDifferentiateInstruction` blindly differentiated any side-effecting instruction that has active operands. This worked well with VJP but not with JVP, so #26743 added more specific conditions for JVP, but they did not work well with VJP because activity analysis was not yet unified. Now that activity analysis has been unified by #27358, `shouldDifferentiateInstruction` no longer needs to distinguish between JVP and VJP, and the JVP differentiation conditions now apply to VJP as well. This PR makes both JVP and VJP use the same differentiation conditions. All existing tests pass. Fixes [TF-800](https://bugs.swift.org/browse/TF-800).
This PR will support everything other than control flow (coming in a PR later next week 🚀) and arrays for forward mode differentiation that was initially supported in #26057.
Commit history is completely messed up due to having to work off separate branches due to some progress blocking bug problems unfortunately 😄