Nothing Special   »   [go: up one dir, main page]

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

Fix issue re: DDP and create_graph=True #63831

Closed
wants to merge 3 commits into from

Conversation

rohan-varma
Copy link
Member
@rohan-varma rohan-varma commented Aug 24, 2021

Stack from ghstack:

Closes #63812

at::mul_out is not supported when grad itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.

Note that DDP doesn't really work well with higher order grads. Will add appropriate warning messaging.

Differential Revision: D30505573

NOTE FOR REVIEWERS: This PR has internal Facebook specific changes or comments, please review them on Phabricator!

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23

Closes #63812

`at::mul_out` is not supported when `grad` itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.

Differential Revision: [D30505573](https://our.internmc.facebook.com/intern/diff/D30505573/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D30505573/)!

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor
facebook-github-bot commented Aug 24, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 074b89c (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@facebook-github-bot facebook-github-bot added oncall: distributed Add this issue/PR to distributed oncall triage queue cla signed labels Aug 24, 2021
rohan-varma added a commit that referenced this pull request Aug 24, 2021
Closes #63812

`at::mul_out` is not supported when `grad` itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.

Differential Revision: [D30505573](https://our.internmc.facebook.com/intern/diff/D30505573/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D30505573/)!

ghstack-source-id: 136505319
Pull Request resolved: #63831
@rohan-varma rohan-varma requested a review from mcarilli August 24, 2021 04:24
@rohan-varma
Copy link
Member Author

cc @mcarilli

@codecov
Copy link
codecov bot commented Aug 24, 2021

Codecov Report

Merging #63831 (074b89c) into gh/rohan-varma/388/base (f1d8653) will decrease coverage by 0.00%.
The diff coverage is 28.57%.

@@                     Coverage Diff                     @@
##           gh/rohan-varma/388/base   #63831      +/-   ##
===========================================================
- Coverage                    75.53%   75.53%   -0.01%     
===========================================================
  Files                         2122     2122              
  Lines                       212881   212895      +14     
===========================================================
+ Hits                        160805   160807       +2     
- Misses                       52076    52088      +12     

Closes #63812

`at::mul_out` is not supported when `grad` itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.

Differential Revision: [D30505573](https://our.internmc.facebook.com/intern/diff/D30505573/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D30505573/)!

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Aug 24, 2021
Pull Request resolved: #63831

Closes #63812

`at::mul_out` is not supported when `grad` itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.
ghstack-source-id: 136514879

Differential Revision: [D30505573](https://our.internmc.facebook.com/intern/diff/D30505573/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D30505573/)!
@zhaojuanmao
Copy link
Contributor

I thought DDP does not support grad's gradients, e.g., the grad's gradients are not synced in current DDP. possibly we should be careful to support this new feature

@rohan-varma
Copy link
Member Author

I thought DDP does not support grad's gradients, e.g., the grad's gradients are not synced in current DDP. possibly we should be careful to support this new feature

Yes, grad of grads will not be synced and I don't think that is a supported feature of DDP. Although, it seems like we do not intend to crash here so possibly we should fix that. Maybe we can clarify in the documentation that grads resulting from higher-order differentiation won't be synced.

// all the input parameters.
at::mul_out(bucket_view, grad, wrapped);
} else {
// If DDP is running with create_graph=True, gradients require_grad
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, you mean codes will crash here if grad.requires_grad()? if so, makes sense to fix that here, but would you please also add a warning here saying it is not supported by DDP to sync up its gradients

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, will add it

Closes #63812

`at::mul_out` is not supported when `grad` itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.

Note that DDP doesn't really work well with higher order grads. Will add appropriate warning messaging.

Differential Revision: [D30505573](https://our.internmc.facebook.com/intern/diff/D30505573/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D30505573/)!

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Aug 25, 2021
Pull Request resolved: #63831

Closes #63812

`at::mul_out` is not supported when `grad` itself requires grad, which is useful for computing higher order derivatives.

In this case, fall back to a mul + copy instead of mul_out.
ghstack-source-id: 136614644

Differential Revision: [D30505573](https://our.internmc.facebook.com/intern/diff/D30505573/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D30505573/)!
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in a6f767e.

rohan-varma added a commit that referenced this pull request Aug 27, 2021
Previous PR #63831 did not actually test the error in #63812. Introduce a test
directly from the repro that simulates it.

Differential Revision: [D30569719](https://our.internmc.facebook.com/intern/diff/D30569719/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Aug 27, 2021
Previous PR #63831 did not actually test the error in #63812. Introduce a test
directly from the repro that simulates it.

Differential Revision: [D30569719](https://our.internmc.facebook.com/intern/diff/D30569719/)

ghstack-source-id: 136824065
Pull Request resolved: #64074
@facebook-github-bot facebook-github-bot deleted the gh/rohan-varma/388/head branch August 29, 2021 14:21
rohan-varma added a commit that referenced this pull request Sep 1, 2021
Previous PR #63831 did not actually test the error in #63812. Introduce a test
directly from the repro that simulates it.

Differential Revision: [D30569719](https://our.internmc.facebook.com/intern/diff/D30569719/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Sep 1, 2021
Previous PR #63831 did not actually test the error in #63812. Introduce a test
directly from the repro that simulates it.

Differential Revision: [D30569719](https://our.internmc.facebook.com/intern/diff/D30569719/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Sep 1, 2021
Pull Request resolved: #64074

Previous PR #63831 did not actually test the error in #63812. Introduce a test
directly from the repro that simulates it.
ghstack-source-id: 137171460

Differential Revision: [D30569719](https://our.internmc.facebook.com/intern/diff/D30569719/)
facebook-github-bot pushed a commit that referenced this pull request Sep 1, 2021
Summary:
Pull Request resolved: #64074

Previous PR #63831 did not actually test the error in #63812. Introduce a test
directly from the repro that simulates it.
ghstack-source-id: 137171460

Test Plan: CI

Reviewed By: SciPioneer

Differential Revision: D30569719

fbshipit-source-id: fd61250ef6d291c093607663d91d6d2cb5574eb7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged oncall: distributed Add this issue/PR to distributed oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants