I have an image processing kernel that uses a buffer of flags that is too large to fit into local memory. The flags are accessed in predictable, raster pattern (upper left to lower right hand side).

My idea is to store flags in global memory, and use local memory as a cache for global. So, as I progress along the raster pattern, I want to read flags from global to local, do some processing, then write flags back to global. But, I want to hide the latency involved.

So, suppose I access my image as a series of locations: `a1,a2,a3......`
I want to do the following:

1. fetch `a1` flags
2. fetch `a2` flags
3. while `a2` flags are being fetched, process `a1` location and store back
to global memory
4. fetch `a3` flags
5. while `a3` flags are being fetched, process `a2` location and store back
to global memory
6. etc.

How should I structure my code to ensure that the latency is hidden ?
Do I need to use `vload/vstore` to do this? Or will the GPU hardware 
do the latency hiding automatically ?