Forum Discussion
Altera_Forum
Honored Contributor
12 years agoFrom the Altera SDK for OpenCL Optimization Guide:
"If you update one element of a vector type, update all the elements of the vector, as shown in Example 17.
__kernel void update (__global const float4 * restrict in,
__global const float4 * restrict out)
{
size_t gid = get_global_id(0);
out.x = process(in.x);
out.y = process(in.y);
out.z = process(in.z);
out.w = 0; //Update w even if that variable is not required.
}