Intel® C++ Compiler 16.0 User and Reference Guide

Use of C++ Classes for SIMD Operations on Intel® 64 Architecture Targeting the Intel® Xeon Phi™ Coprocessor x100 Product Family

This topic only applies to Intel® 64 architecture targeting the Intel® Xeon Phi™ coprocessor x100 product family (formerly code name Knights Corner).

The use of C++ classes for SIMD operations on Intel® 64 architecture targeting the Intel® Xeon Phi™ coprocessor x100 product family (formerly code name Knights Corner) is based on the concept of operating on arrays, or vectors of data, in parallel.

Consider the addition of two vectors, A and B, where each vector contains sixteen elements. Using integer vector class, the elements A[i] and B[i] from each array are summed as shown in the following example.

Typical Method of Adding Elements Using a Loop


int a[16], b[16], c[16];
for (i=0; i<16; i++) /* needs sixteen iterations */
c[i] = a[i] + b[i]; /* returns c[0], c[1], c[2], c[3], …, c[15] */

SIMD Method of Adding Elements Using Ivec Classes

The following example shows the same results using one operation with integer vector Classes.


Is32vec16 ivecA, ivecB, ivec C; /*needs one iteration */
ivecC = ivecA + ivecB; /*returns 16 elements inside ivecC  */ 

Available Classes

These C++ classes provide parallelism, which is not easily implemented using typical mechanisms of C++. The following table provides details of these class libraries.

Instruction Set Class Signedness Data Type Size Elements Header File

Intel® Initial Many Core Instructions (Intel® IMCI)

F64vec8

unspecified

double 64 8 micvec.h
F32vec16

unspecified

float 32 16 micvec.h
M512

unspecified

__m512 512 1 micvec.h
I64vec8

unspecified

long int 64 8 micvec.h
I32vec16

unspecified

int 32 16 micvec.h
Is32vec16

signed

int 32 16 micvec.h
Iu32vec16

unsigned

int 32 16 micvec.h

Most classes contain similar functionality for all data types and are represented by all available intrinsics. However, some capabilities do not translate from one data type to another without suffering from poor performance, and are therefore excluded from individual classes. The I64vec8 class currently supports logical and data manipulation operations but not arithmetic operations.

Note

Intrinsics that take immediate values and cannot be expressed easily in classes are not implemented.

Accessing the Classes Using a Header File

The required class header files are installed in the include directory with the compiler. To enable the classes, use the #include directive in your program file as shown below:

 #include <micvec.h>

Note

You can enable these classes within native code or within offloaded code that is written to contain target-specific code typically protected by the __MIC__ macro.

See Also