Run PS application on x86 process - 2022.2 English

Vitis Tutorials: AI Engine Development

Document ID
XD100
Release Date
2022-12-01
Version
2022.2 English

This step demonstrates how software emulation can run the PS application on x86 process instead of ARM process for an AIE Design. Software emulation is an abstract model and does not use any of the petalinux drivers like Zynq OpenCL (ZOCL), interrupt controller or Device Tree Binary (DTB). Hence, the overhead of creating sd_card.img, booting petalinux on full QEMU machine is too heavy weight for software emulation and can be avoided.

There are no changes required in the AIE graph compilation for x86sim target, V++ compile and link steps. For the rest of the stages like, host compilation, package and launch emulation, follow these steps.

a. Remove the host compilation outputs(.o) and executable(host.exe) generated during Run PS application on ARM process (QEMU) step.

cd ..
make clean_for_x86

Note: XRT needs to be installed on the host and $XILINX_XRT variable should be set by sourcing the /opt/xilinx/xrt/setup.sh.

b. Unset CXX variable that points to aarch64-linux-gnu-g++ compiler. Run the following command to set g++ for x86 process.

setenv CXX g++

c. Use the tutorial’s Makefile.sw_x86 that configures the right GCC_FLAGS, GCC_LIB, GCC_INCLUDE options and package commands that corresponds to running PS application on x86 process.

cp -rf Makefile.sw_x86 Makefile

d. Open the Makefile and observe the linking option -ladf_api_xrt in GCC_LIB which is used for x86 process. Compile the host application by running the following command

make host

or

cd ./sw
 
g++ -Wall -c -std=c++14 -D__SYNCBO_ENABLE__ -D__PS_ENABLE_AIE__ -Wno-int-to-pointer-cast -I$XILINX_XRT/include -I./ -I../aie -I$XILINX_VITIS/aietools/include  -o aie_control_xrt.o ../Work/ps/c_rts/aie_control_xrt.cpp
 
g++ -Wall -c -std=c++14 -D__SYNCBO_ENABLE__ -D__PS_ENABLE_AIE__ -Wno-int-to-pointer-cast -I$XILINX_XRT/include -I./ -I../aie -I$XILINX_VITIS/aietools/include  -o host.o host.cpp
 
g++ *.o -ladf_api_xrt -lxrt_coreutil -L$XILINX_VITIS/aietools/lib/lnx64.o -L$XILINX_XRT/lib -o ./host_ps_on_x86

e. This step packages the design. In addition to package, the emconfigutil command is used to generate the device, board and device tree details(emconfig.json) and those details are required by XRT before loading the xclbin.

make package

or

emconfigutil --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202220_1/xilinx_vck190_base_202220_1.xpfm --nd 1

followed by,

cd ./sw
v++ -p -t sw_emu \
    --package.defer_aie_run \
    --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202220_1/xilinx_vck190_base_202220_1.xpfm \
    --package.sd_dir $PLATFORM_REPO_PATHS/sw/versal/xrt \
    --package.out_dir ./package.sw_emu \
    --package.ps_on_x86 \
    --package.sd_file ./emconfig.json \
    ../tutorial.xsa ../libadf.a

f. To run the emulation use the following command

cd ./sw
setenv XCL_EMULATION_MODE sw_emu
./host_ps_on_x86 a.xclbin 

Note:

  1. Observe the difference in launching the emulation process. we do not use any launch_sw_emu.sh script as like in QEMU emulator. Instead, the outputs of host compilation and package steps are used to launch the emulation.

  2. You can also observe that, the start up time required to bootup the linux in QEMU process is more and the emulation process is slow. Unlike that, running PS application on x86 is faster.