Writing the Software Application - 2023.2 English

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

Document ID
Release Date
2023.2 English

In the AMD Vitis™ environment the software application component can be written in native C++ using the Xilinx Runtime (XRT) native API. The XRT native API is described here in brief, with additional details available under XRT Native API on the XRT documentation site. The Application component is generally referred to as the host application for Data Center acceleration as it runs on an x86 server, and simply as the application for embedded processor-based systems in the same device as the PL kernel and the AI Engine graph.

Tip: For examples of software application programming using the XRT native API refer to host_xrt in the Vitis_Accel_Examples.

In general, the structure of the host application can be divided into the following steps:

  1. Specifying the platform device ID and loading the .xclbin
  2. Setting up the PL kernel and kernel arguments
  3. Transferring data between the software application and PL kernels
  4. Loading and launching the AI Engine graph application
  5. Running the system and returning results

For AMD Versal™ adaptive SoC devices, the PS application manages the whole heterogeneous system, including the PL hardware and the AI Engine graph application. Refer to Programming the PS Host Application in the AI Engine Tools and Flows User Guide (UG1076) for more information.

To use the native XRT APIs, the host application must link with the xrt_coreutil library. For example:
g++ -g -std=c++17 -I$XILINX_XRT/include -L$XILINX_XRT/lib -lxrt_coreutil -pthread

Compiling host code with XRT native C++ API requires C++ standard with -std=c++17. On GCC version older than 4.9.0, use -std=c++1y instead because -std=c++17 is introduced to GCC from 4.9.0.

Important: For multithreading the host application, exercise caution when calling a fork() system call. The fork() does not duplicate all the runtime threads. Hence, the child process cannot run as a complete application in the Vitis core development kit. It is advisable to use the posix_spawn() system call to launch another process from the Vitis software platform application.