(David Garcia from Qualcomm here)
User ljbade in the public forum has pointed out an inconsistency in the spec. See http://www.khronos.org/message_boards/viewtopic.php?f=28&t=3371
Page 184 of the OpenCL 1.1. spec says that:
<<There is no generic address space name for program scope variables. All program scope variables must be declared in the __constant address space.
However, page 236 contradicts it with an example:
<<Samplers can also be declared as global constants in the program source using the following syntax.
const sampler_t <sampler name> = <value>
Should the example declare the sampler in __constant space instead?
According to the experiments done by user ljbade, NVidia's implementation accepts both "const" and "__constant" sampler declarations, whereas AMD's implementation only accepts "__constant".
This problem also exists in the OpenCL 1.0 spec.
A very similar bug exists in the internal system.
Actually, multiple bugs.
The reason samplers declared as program scope variables do not use the __constant qualifier but use the const qualifier is because in section 6.5.3 we have "The __constant or constant address space name is used to describe variables allocated in global memory and which are accessed inside a kernel(s) as read-only variables...."
Samplers are not variables allocated in global memory. This is why the program scope example that describes sampler uses const instead of __constant.
IMO the const usage is the correct way to describe sampler as a program scope variable. We should add a clarification to make this explicitly clear.
Affie, do you think it's appropriate to update this external bug now that we reached a resolution on #6747 in the internal bugzilla?