AnsweredAssumed Answered

Question about global pointers

Question asked by boxerab on Dec 28, 2014
Latest reply on Dec 29, 2014 by boxerab

The AMD optimization guide states:

 

--------------------------------------------------------------------------------------------------------

Avoid writing code with dynamic pointer assignment on the GPU. For

example:

kernel void dyn_assign(global int* a, global int* b, global int* c)

{

global int* d;

size_t idx = get_global_id(0);

if (idx & 1) {

d = b;

} else {

d = c;

}

a[idx] = d[idx];

}

------------------------------------------------------------------------------------------------------

 

Now, in my case, I have the following code:

 

 

void KERNEL run(GLOBAL const uint* restrict idata, GLOBAL uchar* restrict odata) {

   ....

 

    idata +=  get_local_id(0);

    odata += get_local_id(0)

 

   .....

}

 

Is this a case of dynamic pointer assignment, since I am modifying the global pointers idata and odata?

 

i.e. should I use an index into idata, instead of modifying it?

 

Thanks.

Outcomes