There are four different address space qualifiers supported by OpenCL. The address space qualifier is used in variable declarations to specify the region of memory to allocate the declared object. The following is the list of address qualifiers:
__global or global
__local or local
__constant or constant
__private or private
A data type object in a kernel program is allocated space in the specified address space qualifier. If no specifier is given then a generic address space is considered. For example all kernel function arguments and local variables will take a __private
if no address space qualifier is specified. Image memory objects arguments of type image2d_t
, image3d_t
, image2d_array_t
, image1d_t
, image1d_buffer_t
, and image1d_array_t
refer to the __global
address space. Address space qualifiers for return types are allowed only for pointer types.
The OpenCL memory model specifies the different memory regions. Each of these are categorized into the address space qualifier...