Skip to content

Commit

Permalink
Create a macro for OptionalCUDAGuard (#2265)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2265

As title

Reviewed By: jspark1105

Differential Revision: D52770256

fbshipit-source-id: 94ca1c549da6de99e0cc894dbb0b3f9838a99cf3
  • Loading branch information
sryap authored and facebook-github-bot committed Jan 15, 2024
1 parent 7e50cd9 commit 5782e7e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fbgemm_gpu/include/fbgemm_gpu/fbgemm_cuda_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ namespace cub = hipcub;

#define DEVICE_INLINE __device__ inline __attribute__((always_inline))

#define CUDA_DEVICE_GUARD(TENSOR) \
at::cuda::OptionalCUDAGuard device_guard; \
device_guard.set_index(TENSOR.get_device())

// Warp size
#ifdef USE_ROCM
static constexpr int32_t kWarpSize = 64;
Expand Down

0 comments on commit 5782e7e

Please sign in to comment.