diff --git a/tensorflow/core/kernels/random_op.cc b/tensorflow/core/kernels/random_op.cc index e39e5f2eb3b..2fa93fb529c 100644 --- a/tensorflow/core/kernels/random_op.cc +++ b/tensorflow/core/kernels/random_op.cc @@ -384,7 +384,7 @@ TF_CALL_int64(REGISTER_INT); #undef REGISTER #undef REGISTER_INT -#if GOOGLE_CUDA +#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM #define REGISTER(TYPE) \ REGISTER_KERNEL_BUILDER( \ @@ -435,7 +435,7 @@ TF_CALL_int64(REGISTER_INT); #undef REGISTER #undef REGISTER_INT -#endif // GOOGLE_CUDA +#endif // GOOGLE_CUDA || TENSORFLOW_USE_ROCM #ifdef TENSORFLOW_USE_SYCL diff --git a/tensorflow/core/kernels/random_op.h b/tensorflow/core/kernels/random_op.h index d313a021dd2..c3f138a87f6 100644 --- a/tensorflow/core/kernels/random_op.h +++ b/tensorflow/core/kernels/random_op.h @@ -42,7 +42,7 @@ struct FillPhiloxRandom { Distribution dist); }; -#if GOOGLE_CUDA +#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM typedef Eigen::GpuDevice GPUDevice; // Declares the partially GPU-specialized functor struct. template @@ -52,7 +52,7 @@ struct FillPhiloxRandom { typename Distribution::ResultElementType* data, int64 size, Distribution dist); }; -#endif // GOOGLE_CUDA +#endif // GOOGLE_CUDA || TENSORFLOW_USE_ROCM #if TENSORFLOW_USE_SYCL typedef Eigen::SyclDevice SYCLDevice; diff --git a/tensorflow/core/kernels/random_op_gpu.cu.cc b/tensorflow/core/kernels/random_op_gpu.cu.cc index 9c3db8742ba..3e8413da8fd 100644 --- a/tensorflow/core/kernels/random_op_gpu.cu.cc +++ b/tensorflow/core/kernels/random_op_gpu.cu.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#if GOOGLE_CUDA +#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM #define EIGEN_USE_GPU @@ -68,4 +68,4 @@ template struct FillPhiloxRandom< } // namespace functor } // namespace tensorflow -#endif // GOOGLE_CUDA +#endif // GOOGLE_CUDA || TENSORFLOW_USE_ROCM diff --git a/tensorflow/core/kernels/random_op_gpu.h b/tensorflow/core/kernels/random_op_gpu.h index bb7a0723800..4a0d11ea0fa 100644 --- a/tensorflow/core/kernels/random_op_gpu.h +++ b/tensorflow/core/kernels/random_op_gpu.h @@ -16,7 +16,7 @@ limitations under the License. #ifndef TENSORFLOW_CORE_KERNELS_RANDOM_OP_GPU_H_ #define TENSORFLOW_CORE_KERNELS_RANDOM_OP_GPU_H_ -#if defined(__CUDACC__) +#if defined(__CUDACC__) || TENSORFLOW_USE_ROCM #include "tensorflow/core/kernels/random_op.h" #include "tensorflow/core/lib/random/philox_random.h" @@ -222,14 +222,14 @@ void FillPhiloxRandom::operator()( (d.getNumGpuMultiProcessors() * d.maxGpuThreadsPerMultiProcessor()) / block_size; - TF_CHECK_OK(CudaLaunchKernel(FillPhiloxRandomKernelLaunch, - num_blocks, block_size, 0, d.stream(), gen, data, - size, dist)); + TF_CHECK_OK(GpuLaunchKernel(FillPhiloxRandomKernelLaunch, + num_blocks, block_size, 0, d.stream(), gen, data, + size, dist)); } } // namespace functor } // namespace tensorflow -#endif // defined(__CUDACC__) +#endif // defined(__CUDACC__) || TENSORFLOW_USE_ROCM #endif // TENSORFLOW_CORE_KERNELS_RANDOM_OP_GPU_H_