Commit d1dba170 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

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.
parent 6f612107
......@@ -236,7 +236,7 @@ VTKM_EXEC_CONT inline vtkm::Float32 vtkmAtomicAddImpl(vtkm::Float32* address,
do
{
assumed = old;
old = atomicCAS(reinterpret_cast<volatile vtkm::UInt32*>(address),
old = atomicCAS(reinterpret_cast<vtkm::UInt32*>(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<volatile vtkm::UInt64*>(address),
old = atomicCAS(reinterpret_cast<vtkm::UInt64*>(address),
assumed,
__double_as_longlong(__longlong_as_double(assumed) + value));
} while (assumed != old);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment