The Vitis Unified IDE supports Python APIs for creating and building an AI Engine component.
You can either create and build the component through the GUI or use Python APIs. The following table contains Python APIs AI Engine for creating and building AI Engine components. For details of all Vitis supported Python APIs, refer to <vitis_install_path>cli/api_docs/build/html/vitis.html.
- Remove the configuration file using the Python
command.
remove_cfg_file('<config_file.cfg>') - Add the custom configuration file using the Python
command.
add_cfg_file('<custom_config_file.cfg>')
| Python API | Description | Python API Example |
|---|---|---|
create_aie_component
|
Creates an AI Engine component |
aie_comp=client.create_aie_component(name=my_component,
platfrom=<.xpfm or .xsa>,
template="empty")
|
import_files
|
Imports files to the AI Engine component | To import files:
To import folders: aie_comp.import_files(from_loc="<input_folder_path>)
|
add_cfg_file
|
Adds configuration file to the AI Engine component |
aie_comp.add_cfg_file('<.cfg file
path'>)
|
remove_cfg_file
|
Removes configuration file from the component. |
aie_comp.remove_cfg_file('<.cfg file>')
|
update_top_level_file
|
Updates the top level file of AI Engine component |
aie_comp.update_top_level_file('<main_graph>.cpp')
|
build
|
Initiates the build of AI Engine component for x86 and AIESIM/HW |
For x86 simulator (default): For hardware: |
report
|
Prints the component information |
aie_comp.report()
|
clean
|
Cleans the AI Engine component for the specified build target |
aie_comp.clean(target=<hw OR x86sim>)
|
target=Hardware is described
below:# Add package: Vitis Python CLI
import vitis
# Create a Vitis client object -
client = vitis.create_client()
# Set Vitis Workspace
client.set_workspace(path=<workspace_location>)
# 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', 'kernel1.cc', 'kernel2.cc'])
# 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
aie_test_comp.build(target="hw")
# Print component information
aie_test_comp.report()
After the build, you can find the AI Engine component outputs (libadf.a, Work folder etc) at: <workspace>/<comp_name>/build/hw/