cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AI Engine Series 4 - First run of the AI Engine compiler and x86simulator

florentw
Moderator
Moderator
4 0 490

Introduction

 

In the first 3 articles of the AI Engine Series, we went through the different files needed for an AI Engine application. In this entry we will run the AI Engine compiler for an X86 target and have a look at the different output it produces.

 

Requirements

 

The following article requires you to have gone through the previous AI Engine Series articles.

 

First run of the AI Engine compiler

 

In the project created in the previous articles, open the simple_application.prj project file to view the Application Project Settings.

In the top right corner we can see that there are 3 available build configurations:

01.jpg

 

  • Emulation-SW: Compiles for the X86 processor. This is used for functional simulation only (not cycle accurate).
  • Emulation-AIE: Compiles for the AI Engine. The code will be simulated using a System-C model for the AI Engine. This provides a cycle accurate and functional simulation.
  • Hardware: Compiles for the Hardware target.

Select Emulation-SW. The Target changes to “x86 Simulation”

02.JPG

Select the AI Engine Application (simple_application) and click on the hammer in the toolbar to build the project

03.JPG

 

We can see the aiecompiler command run in the console window

04.JPG

This is the full command launched:

 

aiecompiler -v -dataflow -include="<Xilinx Installation Path>/Vitis/2020.2/aietools/include" -include="<Xilinx Installation Path>/Vitis_HLS/2020.2/include" -include="../" -include="../src" -include="../data" -include="../src/kernels" -target=x86sim   --xlopt=0  -platform=<Platform Installation Path>/xilinx_vck190_base_202020_1/xilinx_vck190_base_202020_1.xpfm -workdir=./Work ../src/project.cpp

 

 

The different options are:

-v:  enables the verbose mode for the aiecompiler

-include: Used to include necessary header, source and data files.

-dataflow: This option instructs the compiler that the input spec is a dataflow graph. This is optional and soon to be deprecated.

-target=x86sim: This option sets x86 Simulation as the target.

--xlopt=0: Optimization level. Level 0 (default) enables debug only at the kernel level.

-platform: defines the path to the platform (here the VCK190 base platform)

-workdir: This option specifies the output folder of the aiecompiler

The last parameter (../src/project.cpp) is the top level file that contains the instantiation of the top level graph.

Once the build is complete, we can see in the Explorer window that the compiler has generated a folder called Emulation-SW with the output of the compilation in the Work directory

05.jpg

We can now run the X86 simulation. Select the AI Engine Application (simple_application) and click on the arrow next to the Run As icon and click Run As > Launch SW Emulator

06.jpg

 

Note: In the 2020.2 release, debugging using "Debug As" is not available for an x86 target. Simulation is only available with a full run ("Run As")

When the simulation completes, the Console in Vitis should report “Simulation completed successfully returning zero”.

07.jpg

Under the folder Emulation-SW we can see that the simulator has generated the directory data which contains the output from the simulator in output.txt as specified in the top level file project.cpp

 

simulation::platform<1,1> platform("data/input.txt", "data/output.txt");

 

The template example comes with a golden reference file (data/golden.txt) we can compare the output file with. Select the golden.txt file and the newly created output.txt, right click on one of them and click Compare With > Each Other.

08.jpg

If you compare the 2 files you can see that they match which means that the code is functional (it matches the model).

Next Step

In the next article we will run the AI Engine compiler targeting the AIE model.