Compiling AI Engine Graph Applications - 2023.2 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
Release Date
2023.2 English
Important: Set up the command shell or window as described in Setting Up the Vitis Environment prior to running the tools.

The techniques of programming, simulating, and compiling an AI Engine component are described in AI Engine Tools and Flows User Guide (UG1076). Versal AI Engine graph applications are written in C++ and compiled using the v++ -c --mode aie command, as shown below. The command uses a configuration file command language as described in v++ Mode AI Engine.

The compiled graph application can be linked with PL kernel object files (.xo), and the target platform as described in Linking the System.

Compiling for x86simulator

To build the AI Engine component for simulation with the x86simulator, the command-line is as follows:

v++ -c --mode aie --target x86sim --platform xilinx_vck190_base_202310_1 \
--config ./aiecompiler.cfg --work_dir ./aie_sys_design_aie/Work ./src/graph.cpp

The various arguments used are described below.

  • -c: Specifies the compilation mode of the v++ command. This can be specified using -c or --compile
  • --mode aie: Launches the AI Engine compiler form of the Vitis compiler
  • -target=x86sim: Specifies the build target as either for simulation purposes (x86) or for running on the physical device (hw). The default is hw.
  • --platform=xilinx_vck190_base_202320_1: Specifies the platform to use when compiling the graph application.
    Tip: AI Engine components require platforms using Versal AI Engine devices.
  • --config <config_filename>: Specify a Configuration file for use with the AI Engine compiler. An example config file is shown below.
  • --work_dir: Specifies the location of the output files created by the v++ compiler
  • <source_file>: Specify source files for the kernel and graph. Multiple source files can be specified.

The contents of a configuration file can vary, but the example uses the following commands in the aiecompiler.cfg file:



After compilation the AI Engine component can then be run through the x86simulator using the following command:

x86simulator --pkg-dir=./Work --i=../../ 

Where --pkg-dir specifies the Work directory where compilation occurs, and the --i specifies the input directory path for the simulator

Compiling for AI Engine Simulator / Hardware

To build the AI Engine component for simulation with the aiesimulator, the command-line is as follows:

v++ -c --mode aie --target hw --platform xilinx_vck190_base_202310_1  
--config ./aiecompiler.cfg --work_dir ./aie_sys_design_aie/Work ./src/graph.cpp
Tip: Notice only the target has changed between the x86simulator and aiesimulator builds.

The AI Engine component can then be run through the aiesimulator using the following command:

aiesimulator --pkg-dir=./Work --i=../..

The default output is an archive of the AI Engine graph application called libadf.a. Refer to the chapter on Compiling an AI Engine Graph Application in AI Engine Tools and Flows User Guide (UG1076) for additional information. The archive file can be used by the v++ --link command to build a fixed platform of the integrated system design as described in the next section.

Refer to Output Directories of the v++ Command to get an understanding of the location of various output files generated by the AI Engine compiler.