From d577f27d1a311d57de4326723acfdcf57e94f75c Mon Sep 17 00:00:00 2001 From: carlushuang Date: Wed, 12 Sep 2018 13:24:56 +0800 Subject: [PATCH] fix __longlong_as_double() problem, return the double value previous version return a long long valus *as* double, hence we may get the wrong result. this also affect atomicAdd(double * ...), which use long long pointer to mimic double pointer. Signed-off-by: carlushuang --- include/hip/hcc_detail/device_functions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hip/hcc_detail/device_functions.h b/include/hip/hcc_detail/device_functions.h index adf631d782..508a301344 100644 --- a/include/hip/hcc_detail/device_functions.h +++ b/include/hip/hcc_detail/device_functions.h @@ -593,7 +593,7 @@ __device__ static inline double __longlong_as_double(long long int x) { double tmp; __builtin_memcpy(&tmp, &x, sizeof(tmp)); - return x; + return tmp; } __device__ static inline double __uint2double_rn(int x) { return (double)x; }