HPMC User Guide v 1.00
© 2026 Bassem W. Jamaleddine


3-2

   MIC Superscalar Vector Processor - A Programmer View


In this section, we will take a look at the MIC internal processing from a programmer point of view by disassembling a program and address some of the instructions executed by the MIC to prove that the MIC is a superscalar processor, as well a vector processor. Whether the program is written in C, CPP, or FORTRAN, our focus is to look at its MIC native code. We will write four simple shell scripts to filter the output of the gdb command when run on some compiled MIC native code.

The discussion will procede from bottom to top: first we will run the gdb to reveal the vector registers and the masking registers as reported by the debugger, second we will disassemble the program mic-gigaflops.cpp and look into its corresponding assembly code. By explaining some of these assembly instructions, the reader will gain some understanding of the MIC internal vector processor units. Each core on the MIC can execute instructions to operate sequentially on large 512-bit wide one-dimensional arrays of data called vectors. The vector processor is integrated as a hardware component called a vector processing unit (VPU). This is in contrast to scalar processors, whose instructions operate on single data items only, and in contrast to some of those same scalar processors having additional single instruction, multiple data (SIMD).

Since each core on the MIC has a vector processing unit (VPU), therefore, for the 61 cores on the MIC there are 61 VPUs. The VPU has two independent pipelines (known as the U and V pipelines) allowing the core to have two independent instructions started in the execution stage at the same clock cycle. Since each core has four threads, then two or more of these threads can fill the VPU pipelines for the maximum performance. Therefore the cores on the MIC are superscalar processors that can execute multiple operations in a single cycle.

In general we say that the MIC instructions can be pipelined at a throughput rate of one vector instructions per cycle. Having two pipelines per core; therefore, each core is a 2-wide processor that can execute two instructions per cycle, one on the U-pipe and the other on the V-pipe. It also contains an x87 unit to perform floating-point instructions when needed. The cores execute vector instructions, as each core has vector units that consist of 32x 512-bit vector registers and 8 mask registers to allow predicated execution on the vector elements. Support for Scatter/Gather vector memory instructions, floating-point operations per IEEE 745, support for transcendental instructions for exp, log, recip, and sqrt functions in hardware.





■ GDB Scripts for the MIC


We are only concerned with the architecture of the MIC that is reflected by writing a piece of code to be executed on it. Rather then to look into the MIC hardware organization and its instruction set, we will look into few of its intructions to do the basic arithmetics and system I/O.

Let's look into the assembly code of the program mic-gigaflops.cpp from Chapter "Performance-Programming-for-MIC" section "Measuring Practical Gigaflops to the MIC Specification Gigaflops". To do that, we will simply compile the program, then disassemble it using gdb. Once disassembled, we will look into the instructions. It is simpler and more exciting to approach this discussion from the bottom up: from the assembly source code, to how it is executed on the MIC. So our approach is to understand to MIC architecture from the instruction set.



 Tab. 3.2.1   [gdb MIC Scripts]
Command script Example Output file
gdbmic-disas  gdbmic-disas mic-gigaflops  mic-gigaflops_xphi_Gg.MIC-ASM 
gdbmic-reg  gdbmic-reg mic-gigaflops  mic-gigaflops_xphi_Gg.MIC-REG 
gdbmic-run  gdbmic-run mic-gigaflops  mic-gigaflops_xphi_Gg.MIC-RUN 
gdbmic-step  gdbmic-step mic-gigaflops 300  mic-gigaflops_xphi_Gg.MIC-STEP 
objdump-mic  objdump-mic mic-gigaflops  mic-gigaflops_xphi_Gg.ASMi 
(H)HPMC 2026



Looking at table 3.2.1, each of the commands in the first column is the name of simple shell scripts that takes a CPP program, compiles it, runs it through the MIC's gdb, then collect the output file, copying it to the host computer for futher analysis. So what a 💡 idea!

 

■ REGISTERS AND 512-bit VECTOR REGISTERS


Before looking at the assembly code and explain some instructions, let's look at the registers of the MIC. Listing 3.2.1 shows the script gdbmic-reg that dumps all registers of the MIC. This is simply done by starting the command gdbmic-reg on the host computer. The command will ssh to the host's MIC, mic0, and issue the gdb command "info all-registers".

 -LIS- Listing. 3.2.1   [Shell script to print the registers of Xeon Phi on the MIC]
(raw text)
1.     #!/bin/ksh 
2.     
3.     PROG=$1
4.     CPPc=$1
5.     CPPc+=".cpp"
6.     PHIg=$1
7.     PHIg+="_xphi_Gg"
8.     MICreg=$PHIg
9.     MICreg+=".MIC-REG"
10.    echo $PROG
11.    echo $CPPc
12.    echo $PHIg
13.    echo $MICreg
14.    
15.    icpc -openmp -O3 -g -opt-threads-per-core=4 -mmic $CPPc  gettime.cpp -o 
      $PHIg 
16.    scp $PHIg mic0:/tmp
17.    
18.    ssh mic0 "rm /tmp/$MICreg"
19.    
20.    ssh mic0 "gdb --batch-silent -ex 'set trace-commands on' \
21.     -ex 'set pagination off' -ex 'set logging on /tmp/$MICreg' \
22.     -ex 'set environment LD_LIBRARY_PATH=/miclib17' \
23.     -ex 'start' -ex 'info all-registers' -ex 'quit'  /tmp/$PHIg"
24.    
25.    scp mic0:/tmp/$MICreg .

HPMC 2026


We issue the command gdbmic-reg on the program mic-gigaflops.ccp.

13:09 root@HPMC: /MIC_PROG/GIGAFLOPS #  gdbmic-reg mic-gigaflops


mic-gigaflops 
mic-gigaflops.cpp 
mic-gigaflops_xphi_Gg 
mic-gigaflops_xphi_Gg.MIC-REG 
mic-gigaflops_xphi_Gg                100%   24KB   6.3MB/s   00:00     
mic-gigaflops_xphi_Gg.MIC-REG        100%   32KB   6.9MB/s   00:00 

Notice that we didn't include the file extension .cpp, and the file generated mic-gigaflops_xphi_Gg.MIC-REG contains all registers known to the MIC. You can edit the file and see that there are 81 registers.

Figure 3.2.1 shows how we run the command, and 26 lines of the resulting output file are being displayed.
full view

Image File

 Fig. 3.2.1   [Registers of the MIC]
HPMC 2026 by Bassem Jamaleddine
The MIC is a true vector processor. Traditionally, a vector processor, such as the ILLIAC IV array processor or the CRAY-1 vector processor, has instruction sets to execute a single operation across one-dimensional arrays (or grids) of data called vectors. Your Xeon Phi executes a single instruction across packed one-dimensional data vectors simultaneously using its 512-bit SIMD vector processing units.

Let's take a look at the VPU register names that start with the letters: z, k, and m. These are shown in the following figure.
full view

Image File

 Fig. 3.2.2   [Registers of the MIC's VPU]
HPMC 2026 by Bassem Jamaleddine
This section is not included in the SAMPLE PREVIEW.

 

■ VECTOR INSTRUCTIONS


The following shell script takes the name of a program as an argument and return its assembly code.

This section is not included in the SAMPLE PREVIEW.

 

■ RUNNING THREADS


The script gdbmic-run when invoked on the name of a program, it compiles the program for the MIC, and run it on the MIC via the GDB to reveal the threads during run-time.
For example, to get the threads created to run the program mic-gigaflops on the MIC

#  gdbmic-run mic-gigaflops

The command generates the output file mic-gigaflops_xphi_Gg.MIC-RUN that shows the threads created and exited when running the program mic-gigaflops.

13:09 root@HPMC: /MIC_PROG/GIGAFLOPS #  gdbmic-run mic-gigaflops


mic-gigaflops 
mic-gigaflops.cpp 
mic-gigaflops_xphi_Gg 
mic-gigaflops_xphi_Gg.MIC-RUN 
mic-gigaflops_xphi_Gg                        100%   24KB   6.2MB/s   00:00     
Running 244 openmp threads  
SP floats 3.2 gigaflops in  0.00137711 elapsed seconds 
DP floats 1.6 gigaflops in  0.00166106 elapsed seconds 
SP GFlops = 2323.714127 
DP GFlops = 963.239041 
mic-gigaflops_xphi_Gg.MIC-RUN                 



This section is not included in the SAMPLE PREVIEW.

 

■ STEPPING


Finally, here is the stepping script gdbmic-step to run a program on GDB by steps.
The command gdbmic-step is the shell script shown below.
This section is not included in the SAMPLE PREVIEW.