• 10/30/2018
  • Public Content

Prefer (32-bit) Signed Integer Data Types

Many image-processing kernels operate on
input. To avoid overflows, those eight-bit input values are typically converted and processed as 16- or 32-bit
values. Use signed data types (
) in both cases to enable the compiler to utilize a larger set of SIMD instructions.
, which is another unsigned type for indices, makes the vectorization of indexing arithmetic less efficient. To improve performance, use the
data type for work-item parameters and loop counter, when your index fits the 32-bit integer range. Consider the following example:
__kernel void foo(__constant int* data, const uint workPerItem) {   int tid = get_global_id(0);   int gridSize = get_global_size(0);   for (int i = myStart; i <mystart += workperitem; ++i) …
Also when the compiler generates the scatter or gather instructions on non-consecutive memory accesses, it needs to safely cast to the
since gather and scatter instructions use the
indices. Explicit casting of the indices to the
in a kernel simplifies the compiler job.

See Also

Product and Performance Information


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