Skip to content

Conversation

@bartchr808
Copy link
Contributor

@bartchr808 bartchr808 commented Aug 20, 2019

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 😄

@bartchr808 bartchr808 force-pushed the differential-emitter-generic-support branch from e58d9c6 to b3a80a8 Compare August 22, 2019 00:31
@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

1 similar comment
@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

@bartchr808
Copy link
Contributor Author

@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 😄

@bartchr808
Copy link
Contributor Author

@swift-ci please test tensorflow

@dan-zheng
Copy link
Contributor

@swift-ci Please clean test tensorflow

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.
@dan-zheng dan-zheng force-pushed the differential-emitter-generic-support branch from 36a1083 to b86bfd4 Compare September 19, 2019 08:57
@dan-zheng dan-zheng changed the title [AutoDiff] Forward Mode Generics, Vars, Tuples, Structs Support [AutoDiff] Forward-mode support for variables, generics, tuples, structs. Sep 19, 2019
TF-800 tracks special-case activity analysis and "should differentiate" logic
regarding tuple-typed `apply` results.
@dan-zheng dan-zheng force-pushed the differential-emitter-generic-support branch from b86bfd4 to d3155ed Compare September 19, 2019 09:03
@dan-zheng
Copy link
Contributor

I added:

  • Fixes after merging from tensorflow: 82e9605, 73f1176.
  • Various cleanup.

@dan-zheng
Copy link
Contributor

@swift-ci Please clean test tensorflow

@dan-zheng dan-zheng requested a review from rxwei September 19, 2019 10:40
@dan-zheng
Copy link
Contributor

Merging to unblock high priority patch #26709.
Happy to address feedback in a follow-up. There's more room for cleanup.

@dan-zheng dan-zheng merged commit 29be1e5 into swiftlang:tensorflow Sep 19, 2019
dan-zheng added a commit that referenced this pull request Sep 19, 2019
rxwei added a commit to rxwei/swift that referenced this pull request Sep 29, 2019
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).
rxwei added a commit that referenced this pull request Sep 29, 2019
#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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tensorflow This is for "tensorflow" branch PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants