To define AI Engine partitions and link with PL region, follow the guidelines in Compiling AI Engine Graph for Independent Partitions. This process allows you to compile independent AI Engine graphs into partitions and integrate them into a fixed design.
You must use the v++ packager to generate AI Engine-only and PL-only XCLBIN files that support runtime reloading:
- AI Engine-only XCLBIN
-
- Contains AI Engine metadata and the AI Engine Programmable Device Image (PDI) for a single partition.
- Enables XRT to reload AI Engine partitions at runtime.
- You can create separate AI Engine-only XCLBIN files for each partition if multiple AI Engine partitions exist.
- PL-only XCLBIN
-
- Contains PL metadata, allowing XRT to reload PL components.
- For Dynamic Function eXchange (DFX) platforms, the PL-only XCLBIN also includes the PL partial PDI. This can be reloaded at runtime.
Generating AI Engine-Only XCLBIN
To generate an AI Engine-only XCLBIN for a specific partition, use the following command:
v++ -p -s -t hw --platform <Extensible platform> \
--package.defer_aie_run \
--package.aie_overlay ./pr0/libadf.a \
--output pr0.xclbin
The --package.aie_overlay option
accepts libadf.a corresponding to the AI Engine partition. If multiple AI Engine partitions exist, you can
generate multiple AI Engine-only XCLBIN
files using the same v++ packager command.
You can reload the generatedpr0.xclbin
multiple times using XRT. During a reload of an AI Engine partition, the partition is reset
and reconfigured with the data corresponding to the XCLBIN.
Generating PL-Only XCLBIN
- Add the following constraints to a configuration file (for
example.,
package_pl_only.cfg):[advanced] param=package.generateFlatPlVersalXclbin=1 - Run the v++ packager, specifying the configuration file as
input:
v++ -p -t hw --platform <Fixed xsa by v++ linker> \ --config package_pl_only.cfg \ --output pl_only.xclbin
Generating AI Engine-Only XCLBIN for Different Graphs targeting the same Partition
If different graphs need to be reloaded at different times for the same AI Engine partition, use the AI Engine incremental compilation flow:
- Compile the second (or additional) graph using the previously
generated XSA as the
platform:
v++ -c --mode aie --platform=<Fixed xsa by v++ linker> --config aie.cfg \ --aie.output-archive=./pr0/libadf2.a - Generate the AI Engine-only XCLBIN for the second graph (
libadf2.a):v++ -p -s -t hw --platform <Extensible platform> \ --package.aie_overlay ./pr0/libadf2.a \
At runtime, XRT can use pr0_2.xclbin
to replace the AI Engine partition with the
second AI Engine graph.
Packaging XCLBIN Files into the SD Card
After generating all PL-only and AI Engine-only XCLBIN files, package them into an SD card using the v++ packager:
v++ -p -s -t hw --platform <Extensible platform> \
--package.rootfs ${ROOTFS} \
--package.kernel_image ${IMAGE} \
--package.boot_mode=sd \
--package.image_format=ext4 \
--package.defer_aie_run \
--package.sd_file ${HOST_EXE} \
--package.sd_file pl.xclbin \
--package.sd_file pr0.xclbin \
--package.sd_file pr0_2.xclbin \
......
<Fixed xsa by v++ linker> \
./pr0/libadf.a ./pr1/libadf.a ...
libadf.a corresponding to each partition.