-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Support record_shapes in RPC profiling #44419
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
Conversation
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! ghstack-source-id: 111702390 Pull Request resolved: #44419
💊 CI failures summary and remediationsAs of commit 8772f81 (more details on the Dr. CI page): ✅ None of the CI failures appear to be your fault 💚
🚧 2 ongoing upstream failures:These were probably caused by upstream breakages that are not fixed 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 on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 40 times. |
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 111932779 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 111996895 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 112200516 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 112320646 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
Codecov Report
@@ Coverage Diff @@
## gh/rohan-varma/166/base #44419 +/- ##
==========================================================
Coverage ? 68.04%
==========================================================
Files ? 393
Lines ? 50937
Branches ? 0
==========================================================
Hits ? 34659
Misses ? 16278
Partials ? 0 Continue to review full report at Codecov.
|
|
Could you paste the before and after autograd profiler results to the PR summary so its easy to see the appropriate changes in the profiler output? |
pritamdamania87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test looks good to me, will let @ilia-cher sign off on the profiler.cpp changes.
@pritamdamania87 The before/after of the RPC remote events are in the summary now. |
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Remote ops profiler output before (run with `group_by_input_shapes=True`): ``` rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::add 0.18% 67.229us 0.21% 76.449us 76.449us 1 2 [] rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::empty 0.03% 9.220us 0.03% 9.220us 9.220us 1 2 [] ``` After: ``` rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::add 0.14% 91.001us 0.16% 102.094us 102.094us 1 2 [[100], [100], []] rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::empty 0.02% 11.093us 0.02% 11.093us 11.093us 1 2 [[], [], [], [], [], []] ``` Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 112390206 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
torch/csrc/autograd/profiler.cpp
Outdated
| shapesFromServer.reserve(shapeList.size()); | ||
| for (size_t i = 0 ; i < shapeList.size(); ++i) { | ||
| std::vector<int64_t> s; | ||
| auto curShapesList = shapeList.get(i).toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also check isList here?
torch/csrc/autograd/profiler.cpp
Outdated
| " elements to reconstruct Event."); | ||
|
|
||
| // Reconstruct input shapes from ivalues. | ||
| auto shapeListFromServer = ivalues.get(EventIValueIdx::SHAPES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you remove mentions of server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all of the mentions.
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Remote ops profiler output before (run with `group_by_input_shapes=True`): ``` rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::add 0.18% 67.229us 0.21% 76.449us 76.449us 1 2 [] rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::empty 0.03% 9.220us 0.03% 9.220us 9.220us 1 2 [] ``` After: ``` rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::add 0.14% 91.001us 0.16% 102.094us 102.094us 1 2 [[100], [100], []] rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::empty 0.02% 11.093us 0.02% 11.093us 11.093us 1 2 [[], [], [], [], [], []] ``` Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 112822760 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
ilia-cher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG!
Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. Remote ops profiler output before (run with `group_by_input_shapes=True`): ``` rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::add 0.18% 67.229us 0.21% 76.449us 76.449us 1 2 [] rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::empty 0.03% 9.220us 0.03% 9.220us 9.220us 1 2 [] ``` After: ``` rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::add 0.14% 91.001us 0.16% 102.094us 102.094us 1 2 [[100], [100], []] rpc_sync#aten::add(worker1 -> worker2)#remote_op: aten::empty 0.02% 11.093us 0.02% 11.093us 11.093us 1 2 [[], [], [], [], [], []] ``` Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)! [ghstack-poisoned]
Pull Request resolved: #44419 Closes #39969 This PR adds support for propagation of input shapes over the wire when the profiler is invoked with `record_shapes=True` over RPC. Previously, we did not respect this argument. This is done by saving the shapes as an ivalue list and recovering it as the type expected (`std::vector<std::vector<int>>` on the client). Test is added to ensure that remote ops have the same `input_shapes` as if the op were run locally. ghstack-source-id: 112977899 Differential Revision: [D23591274](https://our.internmc.facebook.com/intern/diff/D23591274/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D23591274/)!
|
This pull request has been merged in 23dfca8. |
Stack from ghstack:
Closes #39969
This PR adds support for propagation of input shapes over the wire when the profiler is invoked with
record_shapes=Trueover RPC. Previously, we did not respect this argument.This is done by saving the shapes as an ivalue list and recovering it as the type expected (
std::vector<std::vector<int>>on the client). Test is added to ensure that remote ops have the sameinput_shapesas if the op were run locally.Remote ops profiler output before (run with
group_by_input_shapes=True):After:
Differential Revision: D23591274
NOTE FOR REVIEWERS: This PR has internal Facebook specific changes or comments, please review them on Phabricator!