Intel® C++ Compiler XE 13.1 User and Reference Guides

C++ Classes and Intel® Many Integrated Core (Intel® MIC) SIMD Operations

This topic only applies to Intel® MIC Architecture.

The use of C++ classes for Intel® Many Integrated Core (Intel® MIC) SIMD operations 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 four elements. Using the integer vector (Ivec) 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

short 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 Ivec Classes.

sIs32vec16 ivecA, ivecB, ivec C; /*needs one iteration */
ivecC = ivecA + ivecB; /*returns ivecC0, ivecC1, ivecC2, ivecC3 */ 

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® MIC F64vec8 signed double 64 8 micvec.h
F32vec16 signed double 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.

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 offloaded code that is written to contain target-specific code.

See Also


Submit feedback on this help topic