Create and Build AI Engine Component - 2024.1 English

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

Document ID
Release Date
2024.1 English
The Vitis Unified IDE supports Python APIs to create and build an AI Engine component. You can either create and build the component through the GUI (see Creating an AI Engine Component) or using Python APIs. Some of the Python APIs that are required to create and build AI Engine components are shared in the following table. For details of all Vitis supported Python APIs, refer to the link: <vitis_install_path>cli/api_docs/build/html/vitis.html. Multiple config files are not supported in the Vitis IDE to create the component. If you would like to use a custom config file to create the component, remove the config file generated by the Vitis tool (default) as shown below:
  1. Remove the tool generated configuration file using the Python command: remove_cfg_file('<config_file.cfg>')
  2. Add the custom configuration file using the Python command: add_cfg_file('<custom_config_file.cfg>').
Table 1. Python APIs: AI Engine Component
Python API Description Python API Example
create_aie_component Create an AI Engine Component aie_comp=client.create_aie_component(name=my_component, platfrom=<.xpfm or .xsa>, template="empty")
import_files Import files to the AI Engine component To import files:

aie_comp.import_files(from_loc="<input_folder_path>", files=['file1.cpp','file2.txt'])

To import folders:

add_cfg_file Add configuration file to the AI Engine component aie_comp.add_cfg_file('<.cfg file path'>)
remove_cfg_file Remove configuration file from the component. aie_comp.remove_cfg_file('<.cfg file>')
update_top_level_file Update the top level file of AI Engine component aie_comp.update_top_level_file('<main_graph>.cpp')
build Initiate the build of AI Engine Component for x86 and AIESIM/HW

For x86 simulator (default): target=x86sim

For hardware: target=hw

report Print the component information
clean Clean the AI Engine component for the specified build target aie_comp.clean(target=<hw OR x86sim>)
The Python script to create an AI Engine component and build for target=Hardware is described below:
# Add package: Vitis Python CLI
import vitis

# Create a Vitis client object -
client = vitis.create_client()

# Set Vitis Workspace

# Create aie component.
aie_test_comp = client.create_aie_component(name = comp_name, platform = <absolute path of platform>, template = "empty_aie_component")

# Import source files to the component
aie_test_comp.import_files(from_loc = <absolute path of source folder>, files = ['file1.cpp', 'file2.h', 'file3.h', '', ''])

# Set top file from the imported source
aie_test_comp.update_top_level_file(top_level_file = 'main_graph.cpp')

# Build component on target Hardware"hw")

# Print component information

After the build, the AI Engine component outputs (libadf.a, Work folder etc.) are created at: <workspace>/<comp_name>/build/hw/