I'm working on generate hadware modules (Descriptions on Verilog) from kernels of openCL. I was reading an article about this, and the authors do some pre processing to the kernels, the first step of the pre processing is : Serialization of work items inside a kernel function, they explained like this:
"Work-items inside a work-group can be executed in any sequence, provided that no synchronization operation is present inside a kernel function. Based on this observation, we serialize the execution of work-items by enclosing the instructions in the body of a kernel function into a triple nested loop, given that the maximum number of dimensions in the abstract index space within a workgroup is three. Each loop nest enumerates the work-items in the corresponding dimension, thus serializing their execution."
And they provide an example like this:
int __kernel_indices[3];
__kernel_indices[2] = 0;
while (__kernel_indices[2]< __local_size[2]){
__kernel_indices[1] = 0;
while (__kernel_indices[1]< __local_size[1]){
__kernel_indices[0] = 0;
while (__kernel_indices[0]< __local_size[0]){
//Kernel Body
}
__kernel_indices[0]++;
}
__kernel_indices[]++;
}
__kernel_indices[2]++;
I don't understand the meaning of serialization, does one work item is executed at the time? or the work items from only 1 work gruop will be in execution at the time?
Thanks for reading the post and sorry for my bad english.