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] forbid derivative registration using @differentiable #30001

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

marcrasi
Copy link

Forbids the jvp: and vjp: arguments to @differentiable, deletes all the logic that handles them, and updates tests to use @derivative(of:) instead.

I left an error message saying that jvp: and vjp: are deprecated, so that there is a good explanation for anyone who missed the deprecation warning and whose code stops working. I think we should wait until next release to remove this.

I have preemptively merged this into tensorflow because it causes quite a few problems there (more tests need to be updated). PR for that coming soon.

@marcrasi marcrasi requested review from rxwei and dan-zheng February 21, 2020 21:26
@marcrasi
Copy link
Author

@swift-ci please test

Copy link
Contributor

@rxwei rxwei left a comment

Choose a reason for hiding this comment

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

🎉 the moment has come!

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.

Yay!


When syntax definitions are changed, I believe apple/swift-syntax needs to be updated with newly generated syntax files. This is necessary to pass --swiftsyntax-verify-generated-files.

Here's an example. I think you can regenerate swift-syntax files with utils/build-script --llbuild --swiftpm --swiftsyntax.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 47b7543be057c34271fea88b767ae96f9d07600b

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 47b7543be057c34271fea88b767ae96f9d07600b

@marcrasi
Copy link
Author

For the swift-syntax changes, do I need to simultaneously merge this PR with the swift-syntax update? Is there some way I can run CI on the two PRs together so that I can see if they work together? @rintaro?

If I do need to do it atomically, I'll split the swift-syntax changes out of this PR and do it separately so that I don't need to do the simultaneous merge thing with such a massive PR.

@dan-zheng
Copy link
Contributor

For the swift-syntax changes, do I need to simultaneously merge this PR with the swift-syntax update? Is there some way I can run CI on the two PRs together so that I can see if they work together? @rintaro?

Yes, you can run CI on the two PRs together.
Provide friend PR links above the @swift-ci invocation. Here's an example.

@marcrasi marcrasi force-pushed the remove-differentiable-jvp-vjp branch from 47b7543 to b9feb3d Compare March 3, 2020 02:04
@marcrasi
Copy link
Author

marcrasi commented Mar 3, 2020

Ok, I have rebased this and removed the syntax changes (will make them in a subsequent PR after merging this one). Running tests now.

@marcrasi
Copy link
Author

marcrasi commented Mar 3, 2020

@swift-ci please test

@marcrasi marcrasi force-pushed the remove-differentiable-jvp-vjp branch from b9feb3d to 1d2faf6 Compare March 23, 2020 19:08
@marcrasi
Copy link
Author

Rebased again. We're actually ready to merge this now. Running tests one more time.

@marcrasi
Copy link
Author

@swift-ci please test

@dan-zheng
Copy link
Contributor

Merging to unblock progress (on TF-836 @differentiable attribute serialization, which involves overlapping changes).

@dan-zheng dan-zheng merged commit 1be86ad into swiftlang:master Mar 24, 2020
allevato added a commit to allevato/swift-format that referenced this pull request Apr 8, 2020
swiftlang/swift#30001 removed the logic
from the parser to handle the `jvp:` and `vjp:` arguments of
the attribute (but left the syntax definitions in place for
the time being). Since this causes an attribute with those
arguments to fail to parse, I've removed them from the tests
so that those tests continue to pass under the new behavior.
(The arguments were always optional, so they pass under the
old behavior as well.)

This also caught and fixed a bug where an attribute with
only a `wrt:` and a `where` clause wasn't getting formatted
correctly.
allevato added a commit to allevato/swift-format that referenced this pull request Apr 30, 2020
swiftlang/swift#30001 removed the logic
from the parser to handle the `jvp:` and `vjp:` arguments of
the attribute (but left the syntax definitions in place for
the time being). Since this causes an attribute with those
arguments to fail to parse, I've removed them from the tests
so that those tests continue to pass under the new behavior.
(The arguments were always optional, so they pass under the
old behavior as well.)

This also caught and fixed a bug where an attribute with
only a `wrt:` and a `where` clause wasn't getting formatted
correctly.
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.

5 participants