AnsweredAssumed Answered

Using local memory for compact kernel OpenCL

Question asked by shunyo on Sep 19, 2013
Latest reply on Sep 26, 2013 by shunyo

I am trying to implement compact operation in OpenCL. I also want to get the number of keys which fall in a particular bin. I am using atomic_inc. But I read that the global memory is very expensive for atomic_inc and that local memory can be used for it. Is there a way to use local memory better to update the keys?


__kernel void compact(__global int* inCode, __global int* isValid, __global int* Scan, __global int* outCode,__global int* numPoints, __global int* index) 
  int ig = get_global_id(0);
  int m = isvalid[ig];
  int j=  Scan[ig];
  int code = inCode[ig];
  if(m == true)

       outCode[j] = code;
       index[j] = ig;
  int num = numPoints[j-1];