mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-08 11:29:02 +00:00
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.
This commit is contained in:
parent
6f612107d0
commit
d1dba170e8
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user