• 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

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804