I am actually looping an openCL call to kernel several times.
In my openCL kernel the current value at a particular location in a given workgroup is updated according to the neighboring values from the previous iteration in the loop, but when the neighbor is from a previous workgroup then that value is not considered at all while updating the current location value in the current workgroup.
However the values from previous iteration from the neighbours which are in the current workgroup or in the next workgroup are considered.
As far as I understand, the values from previous workgroup have been updated before the current workgroup and hence these values cannot be considered as they are not the previous iteration values but current iteration values(as I use memory barriers which is necessary for synchronization).
I tried to use another buffer for storing the previous iteration values but the same issue is still present.
Is there anyway to solve this issue in openCL?
I have also attached the openCL kernel for reference.