CaptainN

kernel input paramters: const or non-const?

Discussion created by CaptainN on Nov 17, 2010
Latest reply on Nov 18, 2010 by MicahVillmow
__constant int * given worse estimate then __global const int*

 

Through the sample code in SDK and posted messages I see that input parameters declared usually as:

__global TYPE * or __global const TYPE *, where TYPE could be any of valid types, int, for example.

 

However, there is a recommendation (or at least way) to declare input buffer with __constant address space qualifier to take advantage of const buffers/caches in Radeon.

__constant qualifier allows to refer to global memory as well.

 

Just having very simple kernel SKA shows that performance when input array declared as

__constant int * worse comparing to __global const int *. Whether const caches are that small and ineffective, and only good for a non-mem object parameters?

 

Whether any difference exists between declaration of input as

__global int * or __global const int * performance wise, or it is just cl language protection from writing into the input array?

Outcomes