Stream Kernel to Kernel

This is a simple kernel to kernel streaming Vector Add and Vector Multiply C Kernel that demonstrates on how to process a stream of data for computation between two kernels.

KEY CONCEPTS: Read/Write Stream, Create/Release Stream

KEYWORDS: cl_stream, CL_STREAM_EOT, CL_STREAM_NONBLOCKING

This example demonstrates how two kernels kernel_stream_vadd and kernel_stream_vmult can communicate through a stream interface. Rather than loading the results from producer kernel kernel_stream_vadd to global memory and then to consumer kernel kernel_stream_vmult we can use stream to transfer this data directly. It reduces the latency of the application and also reduces the memory utilization.

For kernel to kernel streaming transfer, kernel to kernel data transfer ports do not need clSetKernelArg from host code.

Producer kernel krnl_stream_vadd streaming output port needs to be connected to consumer kernel krnl_stream_vmult stream input port during v++ using krnl_stream_vadd_vmult.ini file as below:

[connectivity]
stream_connect=krnl_stream_vadd_1.output:krnl_stream_vmult_1.b

This stream connection specify that output streaming port of krnl_stream_vadd_1 will be connected to b streaming port of krnl_stream_vmult during system linker run. This connectivity file is provided to v++ command as below:

--config krnl_stream_vadd_vmult.ini

EXCLUDED PLATFORMS

Platforms containing following strings in their names are not supported for this example :

zc
xdma
xilinx_u250_qep
aws
samsung

DESIGN FILES

Application code is located in the src directory. Accelerator binary files will be compiled to the xclbin directory. The xclbin directory is required by the Makefile and its contents will be filled during compilation. A listing of all the files in this example is shown below

src/host.cpp
src/krnl_stream_vadd.cpp
src/krnl_stream_vmult.cpp

COMMAND LINE ARGUMENTS

Once the environment has been configured, the application can be executed by

./vadd_stream <krnl_stream_vadd_vmult XCLBIN>