Skip to content

Commit b136846

Browse files
Amogh Akshintalafacebook-github-bot
authored andcommitted
Replace THError() check in THCTensorMathReduce.cu with
Summary: Standardization FTW Test Plan: Checked that the code still builds with ``` buck build //caffe2/aten:ATen-cu ``` Also ran basic aten tests ``` buck test //caffe2/aten:atest ``` Differential Revision: D25567863 fbshipit-source-id: 4afdc468ada83e753b46ecf06487c16b1e83f44a
1 parent 5912316 commit b136846

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

aten/src/THC/generic/THCTensorMathReduce.cu

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define THC_GENERIC_FILE "THC/generic/THCTensorMathReduce.cu"
33
#else
44

5+
#include <c10/cuda/CUDAException.h>
6+
57
#if !defined(THC_REAL_IS_BOOL)
68

79
void THCTensor_(prod)(THCState* state, THCTensor *self, THCTensor *src, int dimension, int keepdim) {
@@ -43,12 +45,7 @@ void THCTensor_(renorm)(THCState *state, THCTensor* self, THCTensor* src, scalar
4345
THCTensor_kernel_renorm<scalar_t, accreal>
4446
<<<grid, threads, 0, c10::cuda::getCurrentCUDAStream()>>>(THCTensor_(data)(state, data),
4547
scalar_cast<accreal>(value), size, scalar_cast<accreal>(maxnorm));
46-
47-
// Do not replace with C10_CUDA_KERNEL_LAUNCH_CHECK() yet as it exhibits different behaviour from THError().
48-
// THError() calls the an error handler, or throws std::runtime_error if a custom handler hasn't been registered.
49-
cudaError_t errcode = cudaGetLastError();
50-
if(errcode != cudaSuccess)
51-
THError(cudaGetErrorString(errcode));
48+
C10_CUDA_KERNEL_LAUNCH_CHECK();
5249
}
5350

5451
THCTensor_(free)(state, src_);

0 commit comments

Comments
 (0)