Did you declare grads at program scope or at function scope? That is, does it look like “foo” or like “bar” in the code below:
// Program scope. This is valid and should compile.
__constant float2 foo[2] = {(float2)(1.0f,0.0f), (float2)(0.0f,1.0f)};
__kernel void fubar()
{
// Function scope. This is not valid and should not compile.
__constant float2 foo[2] = {(float2)(1.0f,0.0f), (float2)(0.0f,1.0f)};
}
Section 6.5.3. of the spec says:
Variables allocated in the __constant address space can only be defined as program scope variables and are required to be initialized.