Hi!
I'm currently using supposedly the latest amdgpu-pro driver to write OpenCL codes on W8100 (Hawaii). Our code uses 64-bit atomic_cmpxchg, and
#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable
was added to the beginning of the cl code. But the compilation suggests atomic_cmpxchg only accept 32-bit integers, but not 64-bit ones. Is this normal?
Yo-Ming Hsieh
Solved! Go to Solution.
For 64bit version, name of the function starts with atom_<> instead of atomic_<>
Please use 64-bit version of this function atom_cmpxchg .
Regards,
That is exactly what we intended to do - 64-bit atomic_cmpxchg (as in the title). The pointer (the first argument) we fed to the atomic_cmpxchg is __global ulong *, but the *.cl built with errors. The error messages seem to try to convert ulong to 32-bit integers as the following:
/tmp/OCL32735T3.cl:99:26: error: no matching function for call to 'atomic_cmpxchg'
prevVal.intVal = atomic_cmpxchg((volatile __global CL_ATOMICINT *)source, assume.intVal, newVal.intVal);
^~~~~~~~~~~~~~
/home/foreman/sources/stream/opencl/compiler/clc2/ocl-headers/build/lnx64a/B_rel/opencl12_builtins.h:4370:35: note: candidate function not viable: no known conversion from 'volatile __global ulong *' (aka 'volatile __global unsigned long *') to 'volatile __global int *' for 1st argument
int __attribute__((overloadable)) atomic_cmpxchg(volatile __global int *p, int cmp, int val);
^
/home/foreman/sources/stream/opencl/compiler/clc2/ocl-headers/build/lnx64a/B_rel/opencl12_builtins.h:4371:44: note: candidate function not viable: no known conversion from 'volatile __global ulong *' (aka 'volatile __global unsigned long *') to 'volatile __global unsigned int *' for 1st argument
unsigned int __attribute__((overloadable)) atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val);
^
/home/foreman/sources/stream/opencl/compiler/clc2/ocl-headers/build/lnx64a/B_rel/opencl12_builtins.h:4372:35: note: candidate function not viable: no known conversion from 'volatile __global ulong *' (aka 'volatile __global unsigned long *') to 'volatile __local int *' for 1st argument
int __attribute__((overloadable)) atomic_cmpxchg(volatile __local int *p, int cmp, int val);
^
/home/foreman/sources/stream/opencl/compiler/clc2/ocl-headers/build/lnx64a/B_rel/opencl12_builtins.h:4373:44: note: candidate function not viable: no known conversion from 'volatile __global ulong *' (aka 'volatile __global unsigned long *') to 'volatile __local unsigned int *' for 1st argument
unsigned int __attribute__((overloadable)) atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val);
For 64bit version, name of the function starts with atom_<> instead of atomic_<>
Thank you!!!