hi all..
The following lines in a kernel:
__local uint count[1] = {0}; // ASSUME no barrier is necessary
if (localId == localSize - 1)
{
count[0] = retval;
}
barrier(CLK_LOCAL_MEM_FENCE);
give the following error using the 2.0 sdk:
error: variable "count" has already been initialized
__local uint count[1] = {0}; // ASSUME no barrier is necessary
From the OpenCL spec i'm not sure what the variable is initialized to or how to override it without requiring a local memory barrier. Can i assume it is initialized to 0?
btw NVidia doesn't complain.. which doesn't necessarily mean it's correct..
thanks
Thanks for your quick response Micah. The code is being called in a loop so i used the workaround in the calling function and passed the count variable in.. not ideal since the added parameter adds to per-thread resource usage, but it works in my case.