Compiling C/C++ PL Kernels - 2024.1 English

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

Document ID
UG1393
Release Date
2024-05-30
Version
2024.1 English
Important: Set up the command shell or window as described in Setting Up the Vitis Environment prior to running the tools.

The techniques of programming, simulating, and synthesizing the PL kernel objects are described in the Vitis High-Level Synthesis User Guide (UG1399). The kernel object file (.xo) can be compiled by the HLS compiler (v++ -c --mode hls) as described below. The compiled object file can be linked with the AI Engine graph application, and the target platform, and used with the v++ --link command as described in Linking the System.

Tip: The PL kernel must be compiled (-c) and linked (-l) in two separate steps.
To compile the PL kernel use the following command line as an example:
v++ -c --mode hls --config ./src/hls_config.cfg --work_dir vadd

The various arguments used are described below:

  • -c: Specifies the compilation mode of the v++ command. This can be specified using -c or --compile
  • --mode hls: Launches the HLS compiler form of the Vitis compiler
  • --config <config_filename>: Specify a Configuration file for use with the HLS compiler. The configuration file has HLS compiler options as described in v++ Mode HLS. Refer to Creating an HLS Component in the Vitis High-Level Synthesis User Guide (UG1399) for additional details. The Configuration file will specify:
    • The target platform or part for the build. The platform specified in the v++ --link command must match the target platform or part used for the HLS compile command
    • The source C++ file or files for the PL kernel
    • The Configuration file will also specify an output name if one is needed. The default output name is the same as the top-level function with the .xo extension
  • --work_dir: Specifies the location of the HLS component created by the v++ compiler
Tip: The HLS compiler mode does not require a target. The compiled object file (.xo) is suitable for both the hardware emulation build and the hardware build. However, the v++ -c --mode hls command does not produce a PL kernel for use in software emulation. To generate the software emulation target you must use the method explained in Compiling PL Kernels for Software Emulation.

Refer to Output Directories of the v++ Command to get an understanding of the location of various output files generated by the HLS compiler.

After the compilation step is complete, any reports generated during this process are collected into the <kernel_name>.compile_summary. This collection of reports can be viewed by opening the compile_summary in the Analysis view of Vitis unified IDE, and includes a Summary report, Kernel Estimate for timing and resource estimates, Kernel Guidance offering any suggestions for compilation, and the HLS Synthesis log. Refer to Working with the Analysis View (Vitis Analyzer) for additional information.