-
Notifications
You must be signed in to change notification settings - Fork 689
introduce CudaGuard and cudastreamguard #14901
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
### Introduce CudaGuard and CudaStreamGuard This diff introduces `CudaGuard` and `CudaStreamGuard` in the Executorch CUDA runtime. These classes provide a convenient way to manage CUDA device and stream selection. #### Changes * Added `CudaGuard` and `CudaStreamGuard` classes in `fbcode/executorch/backends/cuda/runtime/guard.h`. * Implemented `CudaGuard` and `CudaStreamGuard` in `fbcode/executorch/backends/cuda/runtime/guard.cpp`. * Added unit tests for `CudaStreamGuard` in `fbcode/executorch/backends/cuda/runtime/tests/test_cuda_stream_guard.cpp`. * Updated `TARGETS` file to include the new files. #### Purpose The `CudaGuard` class provides a way to select a CUDA device and ensure that it is properly released when the guard goes out of scope. The `CudaStreamGuard` class provides a way to select a CUDA stream and ensure that it is properly synchronized when the guard goes out of scope. #### Usage They will be further used and controled by their shim layer functions. Differential Revision: [D84126481](https://our.internmc.facebook.com/intern/diff/D84126481/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/14901
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a0077ff with merge base fb87fa6 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
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.
Thank you for adding tests
7f63c1e
into
gh/gasoonjia/46/base
This PR was created by the merge bot to help merge the original PR into the main branch. ghstack PR number: #14901 by @Gasoonjia ^ Please use this as the source of truth for the PR details, comments, and reviews ghstack PR base: https://github.com/pytorch/executorch/tree/gh/gasoonjia/46/base ghstack PR head: https://github.com/pytorch/executorch/tree/gh/gasoonjia/46/head Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/gasoonjia/45/orig Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/gasoonjia/46/orig Differential Revision: [D84126481](https://our.internmc.facebook.com/intern/diff/D84126481/) @diff-train-skip-merge --------- Co-authored-by: gasoonjia <gasoonjia@icloud.com>
Stack from ghstack (oldest at bottom):
Introduce CudaGuard and CudaStreamGuard
This diff introduces
CudaGuard
andCudaStreamGuard
in the Executorch CUDA runtime. These classes provide a convenient way to manage CUDA device and stream selection.Changes
CudaGuard
andCudaStreamGuard
classes infbcode/executorch/backends/cuda/runtime/guard.h
.CudaGuard
andCudaStreamGuard
infbcode/executorch/backends/cuda/runtime/guard.cpp
.CudaStreamGuard
infbcode/executorch/backends/cuda/runtime/tests/test_cuda_stream_guard.cpp
.TARGETS
file to include the new files.Purpose
The
CudaGuard
class provides a way to select a CUDA device and ensure that it is properly released when the guard goes out of scope. TheCudaStreamGuard
class provides a way to select a CUDA stream and ensure that it is properly synchronized when the guard goes out of scope.Usage
They will be further used and controled by their shim layer functions.
Differential Revision: D84126481