• 10/30/2018
  • Public Content
Contents

Use Restrict Qualifier for Kernel Arguments

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) { //… }

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.