If you read that section carefully, it says that compiler must be aware of the base pointer of the data buffer (see bold line below) in order to perform certain optimizations.
This is inefficient because the GPU compiler must know the base pointer that every load comes from and in this situation, the compiler cannot determine what ‘d’ points to. So, both B and C are assigned to the same GPU resource, removing the ability to do certain optimizations.
I guess, in your case, it is not the same as above.
Hmmm, I don't see much of a difference though. Both idata & odata are unknown to the compiler. Furthermore, idata is declared constant pointer and then changed :-(. Referencing through indexes, would at least cure constant aspect.
PS: Haven't read optimization guide, yet.
Thanks, guys. @nibal: the const modifier in this case indicates that what
is pointed to is constant, i.e. read only. The pointer itself can change.
The following incantation:
global uchar* const idata
would indicate that the pointer itself is constant.