From d91faf2997754bd8beed4529d6b680a796e24fad Mon Sep 17 00:00:00 2001 From: furnace <34057289+windstamp@users.noreply.github.com> Date: Wed, 7 Apr 2021 19:25:32 +0800 Subject: [PATCH] bugfix for unit test test_segment_ops (#32116) --- paddle/fluid/platform/cuda_primitives.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paddle/fluid/platform/cuda_primitives.h b/paddle/fluid/platform/cuda_primitives.h index 340372007a7..94f64d158af 100644 --- a/paddle/fluid/platform/cuda_primitives.h +++ b/paddle/fluid/platform/cuda_primitives.h @@ -200,6 +200,8 @@ CUDA_ATOMIC_WRAPPER(Max, float) { old = atomicCAS(address_as_i, assumed, __float_as_int(val)); } while (assumed != old); + + return __int_as_float(old); } CUDA_ATOMIC_WRAPPER(Max, double) { @@ -219,6 +221,8 @@ CUDA_ATOMIC_WRAPPER(Max, double) { old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val)); } while (assumed != old); + + return __longlong_as_double(old); } // For atomicMin @@ -272,6 +276,8 @@ CUDA_ATOMIC_WRAPPER(Min, float) { old = atomicCAS(address_as_i, assumed, __float_as_int(val)); } while (assumed != old); + + return __int_as_float(old); } CUDA_ATOMIC_WRAPPER(Min, double) { @@ -291,6 +297,8 @@ CUDA_ATOMIC_WRAPPER(Min, double) { old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val)); } while (assumed != old); + + return __longlong_as_double(old); } } // namespace platform -- GitLab