Linking the Kernels - 2022.1 English

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

Document ID
UG1393
Release Date
2022-05-25
Version
2022.1 English
Tip: Set up the command shell or window as described in Setting Up the Vitis Environment prior to running the tools.
The kernel compilation process results in a Xilinx object (.xo) file whether the kernel is written in C/C++, OpenCL C, or RTL. During the linking stage, XO files from different kernels are linked with the platform to create the FPGA binary container file (.xclbin), or the hardware definition file (.xsa) used by the Vitis packaging process as described in Packaging the System.
Important: In the 2022.1 release, the v++ --link command generates a hardware definition file (.xsa) for Versal® device platforms (i.e. vck190, vck5000), for use by the v++ --package command to generate the .xclbin file. For Alveo™ data center accelerator cards, and embedded processor cards the v++ --link command generates an .xclbin file directly, though the v++ --package command might still be needed.

Similar to compiling, linking requires several options. The following is an example command line to link the vadd kernel:

v++ -t hw_emu --platform xilinx_u200_gen3x16_xdma_2_202110_1 --link vadd.xo -o'vadd.sw_emu.xclbin' \
--config ./system.cfg

This command contains the following arguments:

-t <arg>
Specifies the build target. Software emulation (sw_emu) is used as an example. When linking, you must use the same -t and --platform arguments as specified when the input (XO) file was compiled.
--platform <arg>
Specifies the platform to link the kernels with. To link the kernels for an embedded processor application, you simply specify an embedded processor platform: --platform $PLATFORM_REPO_PATHS/zcu102_base/zcu102_base.xpfm.
--link
Link the kernels and platform into an FPGA binary file (xclbin).
<input>.xo
Input object file. Multiple object files can be specified to build into the .xclbin.
-o'<output>.xclbin'
Specify the output file name. The output file in the link stage will be an .xsa file. The default output name is a.xsa.
--config ./system.cfg
Specify a configuration file that is used to provide v++ command options for a variety of uses. Refer to Vitis Compiler Command for more information on the --config option.
The following is an example linking command line for Versal device platforms, specifying the .xsa file as the output:
v++ -t hw_emu --platform xilinx_vck190_base_202210_1 --link vadd.xo -o"binary_container_1.xsa" \
--config ./system.cfg

After the linking step is complete, any reports generated during this process are collected into the <kernel_name>.link_summary. This collection of reports can be viewed by opening the link_summary in Vitis analyzer, and includes a Summary report, System and Platform Diagrams to illustrate the hardware design, System Estimate providing timing and resources estimates, System Guidance offering any suggestions for improving linking and the performance of the system, and the Vivado Automation Summary providing design details such as interface connections, clocks, resets, and interrupts. Refer to Using the Vitis Analyzer for additional information.

Tip: Refer to Output Directories of the v++ Command to get an understanding of the location of various output files.

Beyond simply linking the Xilinx object (XO) files, the linking process is also where important architectural details of the design are specified. In particular, this is where the design is enabled for profiling or debug, where you specify the number of compute unit (CUs) to instantiate into hardware, where CUs are assigned to SLRs, and where you define connections from kernel ports to global memory or between streaming ports. The following sections discuss some of these build options.