From d1dba170e8193815ba625f3b89c468145211e3ea Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Thu, 25 Mar 2021 10:11:44 -0600 Subject: [PATCH] Do not use volatile when calling CUDA atomicCAS Although it makes sense to assume a pointer is `volatile` when doing an atomic operation, the arguments to the `atomicCAS` overloads take regular pointers. The overload resolution can fail if you use the `volatile` keyword. --- vtkm/Atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vtkm/Atomic.h b/vtkm/Atomic.h index 04cbe8b06..8f5327962 100644 --- a/vtkm/Atomic.h +++ b/vtkm/Atomic.h @@ -236,7 +236,7 @@ VTKM_EXEC_CONT inline vtkm::Float32 vtkmAtomicAddImpl(vtkm::Float32* address, do { assumed = old; - old = atomicCAS(reinterpret_cast(address), + old = atomicCAS(reinterpret_cast(address), assumed, __float_as_int(__int_as_float(assumed) + value)); } while (assumed != old); @@ -255,7 +255,7 @@ VTKM_EXEC_CONT inline vtkm::Float64 vtkmAtomicAdd(vtkm::Float64* address, do { assumed = old; - old = atomicCAS(reinterpret_cast(address), + old = atomicCAS(reinterpret_cast(address), assumed, __double_as_longlong(__longlong_as_double(assumed) + value)); } while (assumed != old);