Skip to content
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 upstream] @differentiable function type sema #30648

Merged

Conversation

marcrasi
Copy link

@marcrasi marcrasi commented Mar 26, 2020

Type checking for the @differentiable function type:

  • Check that parameters and results conform to Differentiable.
  • Add implicit conformances of parameters and results to Differentiable when they are generic parameters.
  • Import most of the differentiable_func_type_type_checking.swift test from the tensorflow branch. (There are a few function conversion tests that I haven't imported because they depend on the function conversion pipeline.)

Note: I needed to make a small logic change for this to work properly in master. In the tensorflow branch, we assume that the Differentiable protocol is always available. In the master branch, it is only available if you import _Differentiation. So I changed all the places where we assert/segfault when the Differentiable protocol is missing to fail gracefully with a diagnostic. And I added a test for this.

This resolves TF-823 and TF-1219.

@marcrasi marcrasi requested review from rxwei and dan-zheng March 26, 2020 00:04
@marcrasi marcrasi force-pushed the differentiable-function-type-sema branch from c5ad526 to e319d45 Compare March 26, 2020 00:04
@marcrasi
Copy link
Author

@swift-ci please test

Copy link
Contributor

@dan-zheng dan-zheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@marcrasi marcrasi force-pushed the differentiable-function-type-sema branch from e319d45 to b1b856b Compare March 26, 2020 18:13
@marcrasi
Copy link
Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e319d45b08221d2eb1f572960c945c57f61e26a3

@marcrasi
Copy link
Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e319d45b08221d2eb1f572960c945c57f61e26a3

@marcrasi
Copy link
Author

@swift-ci please test osx

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b1b856b

@dan-zheng
Copy link
Contributor

@swift-ci Please smoke test macOS

@dan-zheng
Copy link
Contributor

Merging to unblock progress. Smoke tests pass, full tests failed only due to CI outages earlier today.

@dan-zheng dan-zheng merged commit eae4c5e into swiftlang:master Mar 27, 2020
@marcrasi marcrasi deleted the differentiable-function-type-sema branch March 27, 2020 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants