Compilation error when using atomic functions

Hi guys, I know atomic functions are available since a couple of months and that some of you are using them but I can’t figure out a way to compile my and nobody seem’s to have that problem… At least not on web sites indexed by google! It looks like the compiler doesn’t recognize the pragma… If you see something wrong, please tell me !

I’m using 195.39 device driver on a Tesla C1060 with SDK 3.0.

Thanks,

P-O

Source code:

#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable

#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable

__kernel void CCL2ndPass( __global int *pSourceBuffer)

{

	uint lGlobalOffset = mul24((uint)get_global_id(1), (uint)get_global_size(0) ) + get_global_id(0);

	int lInVal = pSourceBuffer[lGlobalOffset];

	atom_add(pSourceBuffer[lInVal], lInVal);

	return;

}

Compiler output:

-----------------------------------------------------------

Build Log:

:91: warning: unknown '#pragma OPENCL EXTENSION' - ignored

#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable

						 ^

:92: warning: unknown '#pragma OPENCL EXTENSION' - ignored

#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable

						 ^

:100: error: no matching overload found for arguments of type 'int __attribute__

((address_space(1))), int'

	atom_add(pSourceBuffer[lInVal], lInVal);

	^~~~~~~~

-----------------------------------------------------------

In your kernel code, replace line:

atom_add(pSourceBuffer[lInVal], lInVal);

with:

atom_add(pSourceBuffer + lInVal, lInVal);

and re-try then.

What a shame !

It obviously works best with the actual pointer… The pragma warning wasn’t relevent I guess.

Thanks anyway!