Consider using restrict
type qualifier (defined by the
C99) for kernel arguments (pointers) in the kernel signature. You can
use the restrict
qualifier only with kernel arguments. The
qualifier is a hint to the compiler that helps to limit the effects of
pointer aliasing, while also aiding caching optimizations. In the example
below, it enables the compiler to assume that pointers a
,
b
, and c
point to the different locations. You
must ensure that the pointers do not point to overlapping locations.
__kernel void foo( const float i, __global const float* restrict a, __global const float* restrict b, __global float* restrict result) { //… }