atom_add with float

According to the OpenCl spec there should be a function:
T atom_add (Q T *p, T val)

The following line works properly
__local int z=1;
int w = 5;
atom_add(&z, w);

But switching from int to float
__local float z=1;
float w = 5;
atom_add(&z, w);

results in the following error
<program source>:45:2:{45:2-45:10}: error: no matching overload found for arguments of type ‘float attribute((address_space(3)))*, float’
atom_add(&z, w);
/System/Library/Frameworks/OpenCL.framework/Resources/cl_kernel.h:2531:23: note: instantiated from:
#define atom_add(X,Y) __CLFN_A2(X, Y, add)
/System/Library/Frameworks/OpenCL.framework/Resources/cl_kernel.h:2525:26: note: instantiated from:
#define __CLFN_A2(x,y,R) __builtin_overload(2, x, y,

Any ideas? I’m running a new MacbookPro i5 with OS X 10.6.

According to the specification there is a function

int atom_add (__local int *p, int val)

atomic operations are only supported on integer data (not floating-point data). This is why you are getting the compile error.

I see that now. I assumed T was any native type (float/int/long/char…). Thanks for clearing this up!