KEMBAR78
Add query and synchronize to c10::Stream by lw · Pull Request #59560 · pytorch/pytorch · GitHub
Skip to content

Conversation

@lw
Copy link
Contributor

@lw lw commented Jun 7, 2021

Stack from ghstack:

at::cuda::CUDAStream has the query and synchronize methods, but c10::Stream does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on c10::Stream. (I had to do it out-of-line to circumvent a circular dependency).

Differential Revision: D28931377

`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jun 7, 2021

💊 CI failures summary and remediations

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


  • 4/4 failures possibly* introduced in this PR
    • 1/4 non-scanned failure(s)

🕵️ 2 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See GitHub Actions build Linux CI (pytorch-linux-xenial-py3.6-gcc5.4) / pytorch_python_doc_build (1/2)

Step: "Build Python Doc in Docker" (full log | diagnosis details | 🔁 rerun)

2021-06-09T09:39:04.0253015Z error: could not l...modules/third_party/zstd/config: Permission denied
2021-06-09T09:39:04.0120402Z http.https://github.com/.extraheader
2021-06-09T09:39:04.0130972Z error: could not lock config file /home/ec2-user/actions-runner/_work/pytorch/pytorch/.git/modules/third_party/tensorpipe/modules/third_party/libuv/config: Permission denied
2021-06-09T09:39:04.0144485Z Entering 'third_party/tensorpipe/third_party/pybind11'
2021-06-09T09:39:04.0160904Z http.https://github.com/.extraheader
2021-06-09T09:39:04.0171689Z error: could not lock config file /home/ec2-user/actions-runner/_work/pytorch/pytorch/.git/modules/third_party/tensorpipe/modules/third_party/pybind11/config: Permission denied
2021-06-09T09:39:04.0183671Z Entering 'third_party/tensorpipe/third_party/pybind11/tools/clang'
2021-06-09T09:39:04.0200368Z http.https://github.com/.extraheader
2021-06-09T09:39:04.0210629Z error: could not lock config file /home/ec2-user/actions-runner/_work/pytorch/pytorch/.git/modules/third_party/tensorpipe/modules/third_party/pybind11/modules/tools/clang/config: Permission denied
2021-06-09T09:39:04.0225826Z Entering 'third_party/zstd'
2021-06-09T09:39:04.0242791Z http.https://github.com/.extraheader
2021-06-09T09:39:04.0253015Z error: could not lock config file /home/ec2-user/actions-runner/_work/pytorch/pytorch/.git/modules/third_party/zstd/config: Permission denied
2021-06-09T09:39:04.0317271Z Cleaning up orphan processes

See CircleCI build pytorch_python_doc_build (2/2)

Step: "Doc Build and Push" (full log | diagnosis details | 🔁 rerun)

Jun 09 09:55:50 Makefile:38: recipe for target 'html' failed
Jun 09 09:55:48 
Jun 09 09:55:48 copying static files... ... done
Jun 09 09:55:48 copying extra files... done
Jun 09 09:55:49 dumping search index in English (code: en)... done
Jun 09 09:55:49 dumping object inventory... done
Jun 09 09:55:49 build finished with problems, 1 warning.
Jun 09 09:55:49 /var/lib/jenkins/workspace/docs/src/pytorch-sphinx-theme/pytorch_sphinx_theme/search.html:21: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
Jun 09 09:55:49   <p class="last">
Jun 09 09:55:49 /var/lib/jenkins/workspace/docs/src/pytorch-sphinx-theme/pytorch_sphinx_theme/search.html:24: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
Jun 09 09:55:49   </p>
Jun 09 09:55:50 Makefile:38: recipe for target 'html' failed
Jun 09 09:55:50 make: *** [html] Error 1
Jun 09 09:55:50 ++ code=2
Jun 09 09:55:50 ++ '[' 2 -ne 0 ']'
Jun 09 09:55:50 ++ set +x
Jun 09 09:55:50 =========================
Jun 09 09:55:50 /var/lib/jenkins/workspace/docs/source/distributed.rst:792: WARNING: Unexpected indentation.
Jun 09 09:55:50 =========================
Jun 09 09:55:50 Docs build failed. If the failure is not clear, scan back in the log
Jun 09 09:55:50 for any WARNINGS or for the line build finished with problems
Jun 09 09:55:50 ++ return 2

1 failure not recognized by patterns:

Job Step Action
CircleCI pytorch_doc_test Doc test 🔁 rerun

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.

lw added 9 commits June 7, 2021 09:55
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
@lw lw requested a review from ezyang June 8, 2021 20:55
}

return false;
return stream_.query();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is backwards: the true implementation should live here, and the DeviceGuard impl should construct a CUDAStream and call into this implementation. This way, users of CUDAStream bypass dynamic dispatch on the virtual method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, and it leaves CUDAStream untouched, which is reassuring. It also fixes a weird HIP issue later in the stack, so that's neat too.

@ezyang
Copy link
Contributor

ezyang commented Jun 8, 2021

Seems reasonable enough to me.

`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
`at::cuda::CUDAStream` has the `query` and `synchronize` methods, but `c10::Stream` does not, and I couldn't find any generic way to accomplish this. Hence I added helpers to do this to the DeviceGuardImpl interface, and then defined these methods on `c10::Stream`. (I had to do it out-of-line to circumvent a circular dependency).

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

[ghstack-poisoned]
Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

okey dokey

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e7cccc2.

@facebook-github-bot facebook-github-bot deleted the gh/lw/208/head branch June 13, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants