Refeed in OpenCL?

Hello,

I don’t know the right name for what I want to do, so the better way do explain is with an example:

So imagine that:

I've a kernel that will run over an array of lenght of 1000, so for that I enqueue my NDRange with a global work size of 1000 right? But just after it finishes the first iteration, I want to start a new one over the array, without returning to the host to enqueue a new kernel, is that possible right? And how?

So, in practice, each thread will run the kernel X times, where X is the number of times that I refeed my system, without back to host.

In traditional host code I’d write it:

While(numberOfRepetitions < X) {

for (int i=0; i<1000; i++) {

   //Do stuff on Array[i]

}

}

Thank you:)