Kernel Signature - 2021.2 English

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

Document ID
UG1393
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 English

In C/C++ kernels, the kernel is identified on the Vitis compiler command line using the v++ --kernel option. However, in OpenCL code, the __kernel keyword identifies a kernel in the code. You can have multiple kernels defined in a single .cl file, and the Vitis compiler will compile all of the kernels, unless you specify the --kernel option to identify which kernel to compile.

__kernel __attribute__ ((reqd_work_group_size(1, 1, 1)))
void apply_watermark(__global const TYPE * __restrict input, 
   __global TYPE * __restrict output, int width, int height) {
{
   ...
}
Tip: The complete code for the kernel function above, apply_watermark, can be found in the Global Memory Two Banks (CL) example in the Vitis Accel Examples GitHub repository.

In the example above, you can see the watermark kernel has two pointer type arguments: input and output, and has two scalar type int arguments: width and height.

In C/C++ kernels, these arguments would need to be identified with the HLS INTERFACE pragmas. However, in the OpenCL kernel, the Vitis compiler, and Vitis HLS recognize the kernel arguments, and compile them as needed: pointer arguments into m_axi interfaces, and scalar arguments into s_axilite interfaces.