Application 2: Run an AIE + PL Acceleration Application Project - 2024.1 English

Vitis Tutorials: Vitis Platform Creation (XD101)

Document ID
XD101
Release Date
2024-06-19
Version
2024.1 English

To verify the platform functionality, you will create a project with AIE + PL kernel and PS application, and run it on this custom-VCK190 board.

  1. Creating AIE + PL Application

    • Go to WorkSpace directory created in step1

    • Run Vitis by typing vitis -w . in the console. -w is to specify the workspace. . means the current workspace directory. Close the welcome tab after Vitis launches.

    • Go to example view by clicking the example button and click AI Engine, PL and PS System Design. example.PNG

    • Click Create Application from Template. The project creation wizard would pop up.

      • Use the default setting for System project name and System project location. Then click Next.

      • Select custom_platform platform, click Next.

        Note If the platform component is not in the current workspace user could click + button to add the platform component.

      • Set Kernel Image to xilinx-versal-common-v2024.1/Image.

      • Set Root FS to xilinx-versal-common-v2024.1/rootfs.ext4.

      • Set Sysroot to xilinx-versal-common-v2024.1/sysroots/cortexa72-cortexa53-xilinx-linux. Then click Next.

      • Review the summary of your vadd system project and click Finish.

      Note: In the platform selecting page if the platform you want to use is not in the current list, you can click + button to add the platform to the list.

    After seconds the vadd system project, vadd host component and vadd kernel component will be ready in the component view.

  2. Building AIE + PL Application

    Vadd system project supports three targets: Software emulation, Hardware emulation and Hardware. User could select the target accordingly following steps below.

    • Go to flow navigator and select vadd system project.

      build_application.PNG

    • Click Build All under the target

    • In the Build Component setup dialog please enable all the components. Then click OK.

      build_application.PNG

    After compilation is finished. Users can locate the sd_card.img by expanding the Output directory. This provides a logical view of the output. The actual path of sd_card.img file is located in WrokSpace/aie_sys_design/build/<TARGET>/package/package/ directory. For example, if user targets hardware emulation, the sd_card.img file is in located in WrokSpace/aie_sys_design/build/hw_emu/package/package/. Users can also view the complete path of the sd_card.img file by simply hovering the mouse pointer over the image file.

  3. Running Hardware Emulation

    After the compilation for hardware emulation is finished, please follow steps below to run hardware emulation.

    • Click Start Emulator under HARDWARE EMULATION target. The Start Emulator setup page would be popped up. Then click Start. build_application.PNG

    • Click Run after the emulator boots up to terminal build_application.PNG

    • Click Stop emulator to stop emulation after emulation is finished. build_application.PNG

    What Just Happened?

    Vitis runs PS emulation in QEMU, PL and AIE emulation in XSIM. They can communicate with each other. When running the emulation, Vitis downloads executable and xclbin to Remote Working Directory and launch it.

  4. Running the Application on Hardware After the compilation for hardware is finished, please follow steps below to run on hardware.

    1. Copy the sd_card.img from WrokSpace/aie_sys_design/build/hw/package/package/ directory to local, if the project is run on a server or virtual machine.

      NOTE: Vitis will generate images with aie_debug enabled and disabled. The image with aie_debug disabled will run freely; the image with aie_debug enabled will halt AI Engine and wait for the debugger to connect to it.

    2. Program sd_card.img to the SD card. Refer to AR#73711 for detailed steps.

      NOTE: The programmed SD card has two partitions: the FAT32 partition with boot components and the EXT4 partition with Linux root file system. By default, the Windows system cannot see the contents of EXT4 partition.

      NOTE: Eject the SD card properly from the system after programming it.

    3. Insert the SD card, and boot the VCK190 board with SD boot mode (SW1[4:1] = “1110”: OFF, OFF, OFF, ON) and power on.

      NOTE: Refer to VCK190 Evaluation Board User Guide for details about boot mode.

    4. Launch test application from the UART console.

      Use the following steps to run the application

      You will need to login with user petalinux first, and set up a new password (it is then also the sudo password):

      • Log into the system.

        ```bash
        petalinux login:petalinux
        You are required to change your password immediately (administrator enforced).
        New password:
        Retype new password:
        petalinux:~$ sudo su
        We trust you have received the usual lecture from the local System
        Administrator. It usually boils down to these three things:
              #1) Respect the privacy of others.
              #2) Think before you type.
              #3) With great power comes great responsibility.
        Password:
        petalinux:/home/petalinux#
        ```
        
      • Go to the auto mounted FAT32 partition and run the application :

        ```
        petalinux:/home/petalinux# cd /run/media/sd-mmcblk0p1
        petalinux:/home/petalinux# ./plaie binary_container_1.xclbin
        ```
        
    5. Expected print on UART console.

    Show Log
    root@petalinux:/mnt/sd-mmcblk0p1# ./plaie binary_container_1.xclbin
    Initializing ADF API...
    [   39.786629] zocl-drm axi:zyxclmm_drm: zocl_create_client: created KDS client for pid(697), ret: 0
    [   39.795569] zocl-drm axi:zyxclmm_drm: zocl_destroy_client: client exits pid(697)
    [   39.813998] zocl-drm axi:zyxclmm_drm: zocl_create_client: created KDS client for pid(697), ret: 0
    [   40.245746] [drm] found kind 29(AIE_RESOURCES)
    [   40.245765] [drm] found kind 8(IP_LAYOUT)
    [   40.250535] [drm] found kind 9(DEBUG_IP_LAYOUT)
    [   40.254738] [drm] found kind 25(AIE_METADATA)
    [   40.259429] [drm] found kind 7(CONNECTIVITY)
    [   40.263937] [drm] found kind 6(MEM_TOPOLOGY)
    [   40.268417] [drm] Memory 0 is not reserved in device tree. Will allocate memory from CMA
    [   40.280809] [drm] Memory 1 is not reserved in device tree. Will allocate memory from CMA
    [   40.296964] cu_drv CU.2.auto: cu_probe: CU[0] created
    [   40.302294] cu_drv CU.3.auto: cu_probe: CU[1] created
    [   40.307630] cu_drv CU.4.auto: cu_probe: CU[2] created
    [   40.312842] cu_drv CU.2.auto:  ffff000804e4ac10 xrt_cu_intr_thread: CU[0] start
    [   40.320432] cu_drv CU.3.auto:  ffff00080271e810 xrt_cu_intr_thread: CU[1] start
    [   40.321470] [drm] zocl_xclbin_read_axlf 8e1f87ed-725e-07da-c6b3-6786f6df2f1f ret: 0
    [   40.327753] cu_drv CU.4.auto:  ffff000802696410 xrt_cu_intr_thread: CU[2] start
    XAIEFAL: INFO: Resource group Avail is created.
    XAIEFAL: INFO: Resource group Static is created.
    XAIEFAL: INFO: Resource group Generic is created.
    [   40.390527] [drm] bitstream 8e1f87ed-725e-07da-c6b3-6786f6df2f1f locked, ref=1
    [   40.390547] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_add_context: Client pid(697) add context Domain(0) CU(0xffffffff) shared(true)
    [   40.410331] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_del_context: Client pid(697) del context Domain(0) CU(0xffffffff)
    Input memory virtual addr 0x0xffffb91ea000x
    Input memory virtual addr 0x0xffffb91e9000x
    in_bohdl0 in_bohdl1 sync[   40.421650] [drm] bitstream 8e1f87ed-725e-07da-c6b3-6786f6df2f1f unlocked, ref=0
    started
    in_bohdl0 in_bohdl1 sy[   40.429988] [drm] bitstream 8e1f87ed-725e-07da-c6b3-6786f6df2f1f locked, ref=1
    nc done
    Output memory virtual a[   40.439461] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_add_context: Client pid(697) add context Domain(0) CU(0xffffffff) shared(true)
    ddr 0x0xffffb91e8000x
    [   40.464816] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_add_context: Client pid(697) add context Domain(0) CU(0x1) shared(true)
    run pl_mm2s_1
    [   40.478710] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_add_context: Client pid(697) add context Domain(0) CU(0x0) shared(true)
    run pl_mm2s_2
    [   40.492018] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_add_context: Client pid(697) add context Domain(0) CU(0x2) shared(true)
    run pl_s2mm
    graph init. This does nothing be[   40.506280] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_del_context: Client pid(697) del context Domain(0) CU(0x1)
    cause CDO in boot PDI already con[   40.519845] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_del_context: Client pid(697) del context Domain(0) CU(0x0)
    figures AIE.
    graph run
    graph end[   40.533494] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_del_context: Client pid(697) del context Domain(0) CU(0xffffffff)
    
    mm2s_1 completed with status(4[   40.547611] zocl-drm axi:zyxclmm_drm:  ffff00080085d410 kds_del_context: Client pid(697) del context Domain(0) CU(0x2)
    )
    mm2s_2 completed with status(4)
    s2mm completed with status(4)
    TEST PASSED
    Releasing host Buffers...
    Releasing remaining XRT objects...
    [   40.561044] [drm] bitstream 8e1f87ed-725e-07da-c6b3-6786f6df2f1f unlocked, ref=0
    [   40.578375] zocl-drm axi:zyxclmm_drm: zocl_destroy_client: client exits pid(697)
    

Congratulations now you’ve created a custom platform that PL acceleration kernel and AIE applications can work on it.