Hi,

I have a kernel and in this kernel I am accessing 3 arrays(a,b,T) stored in global memory:

do I have coalescing access in array a, b, T?

T[5], b[15], a[30], col =5, and I have 6 thread.

thread 0,1 --> idx =0, so these thread will access:
thread 0: b[0] to b[4] , T[0] to T[4] , a[0] to a[4]
thread 1: b[0] to b[4] , T[0] to T[4] , a[5] to a[9]

thread 2,3 --> idx =5, so these thread will access:
thread 2: b[5] to b[9] , T[0] to T[4] , a[10] to a[14]
thread 3: b[5] to b[9] , T[0] to T[4] , a[15] to a[19]

thread 4,5 --> idx =10, so these thread will access:
thread 4: b[10] to b[14] , T[0] to T[4] , a[20] to a[24]
thread 5: b[10] to b[14] , T[0] to T[4] , a[25] to a[29]


Hopefully this is clear, do I have coalescing access for all of these array? and is it possible to have coalescing access to some of them and not to others?




Code :
{
    const int i = get_global_id(0);
 
        float result = 1;
        for (int j = 0; j < col; ++j)
        {
            result *=  b[j + idx] * a[i*col + j]) + T[j];
        }      
}