Developing PL Kernels using C++ - 2024.1 English

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

Document ID
UG1393
Release Date
2024-07-03
Version
2024.1 English

The PL kernel code is generally a compute-intensive part of the system intended to run on the programmable logic (PL) region of an AMD device. The Vitis development environment supports PL kernels written in C or C++, and also written in RTL.

For C/C++ based kernels the HLS compiler (v++) is available as a standalone command, or as part of the Vitis unified IDE. The IDE provides a language sensitive editor, simulation and code analysis tools, high-level synthesis of RTL from the C or C++ code, and C-RTL co-simulation for an in-depth examination of the resulting hardware design. The HLS compiler is the recommended tool for developing PL kernels for use in the AMD Vivado™ traditional design flow, or in the Vitis heterogeneous design flow.

Generally, off-the-shelf software cannot be efficiently converted into hardware running on programmable logic. Even if the software program can be automatically converted (or synthesized) into hardware, achieving acceptable quality of results (QoR) will require additional work such as structuring the algorithm to help the HLS compiler achieve the desired performance goals. To help, you need to understand the best practices for writing good software for execution on programmable logic as discussed in Design Principles in the Vitis High-Level Synthesis User Guide (UG1399).

The code for C++ kernels written and optimized in an HLS component can be compiled in the Vitis tools either from the v++ command line as explained in Compiling C/C++ PL Kernels, or from a System project in the Vitis unified IDE as explained in Using the Vitis Unified IDE.

Important: The kernel function declaration must be wrapped with the extern "C" linkage in the header file, or the whole function in the kernel source code must be wrapped.
extern "C" {
           void kernel_function(int *in, int *out, int size);
        }