Stream Memory Map Mixed

This is a simple streaming Vector Addition C Kernel design with 1 Stream input, 1 memory mapped input to the kernel, and 1 stream output that demonstrates on how to process a stream of data along with memory mapped interface.

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

KEYWORDS: cl_stream, CL_STREAM_EOT

This example demonstrate how to process an input stream of data from host for computation along with memory mapped OpenCL buffer inputs. krnl_stream_vadd has 1 stream input, one memory mapped buffer input and 1 stream output.

Following is the kernel definition along with Interface pragma:

typedef qdma_axis<DWIDTH, 0, 0, 0> pkt;
void krnl_stream_vadd(hls::stream<pkt> &out, // Write-Only output Stream
                      hls::stream<pkt> &in1, // Input Stream 1
                      int *in2,              // Memory mapped Input Vector 2
                      int size               // Size in integer
) {
#pragma HLS INTERFACE axis port = out
#pragma HLS INTERFACE axis port = in1
#pragma HLS INTERFACE m_axi port = in2 offset = slave bundle = gmem
#pragma HLS INTERFACE s_axilite port = in2 bundle = control
#pragma HLS INTERFACE s_axilite port = size bundle = control
#pragma HLS INTERFACE s_axilite port = return bundle = control
...
}

Here kernel has two input argument in1 and in2. in1 is axis (AXI Streaming) type and in2 is m_axi (memory Master AXI) Interface type.

Inside host code, user has to set argument only for non-streaming interface as shown below:

cl::Kernel krnl_vadd = cl::Kernel(program, "krnl_stream_vadd", &err));
krnl_vadd.setArg(2, buffer_in2);
krnl_vadd.setArg(3, size);

For axis streaming interface type argument, host needs to creates streaming objects as below:

cl_int ret;
cl_mem_ext_ptr_t ext;
ext.param = krnl_vadd.get(); //specifying the kernel object on which stream connection will be established
ext.obj = NULL;

ext.flags = 0; //Create read stream for argument 0 of kernel
cl_stream read_stream = xcl::Stream::createStream(device.get(), XCL_STREAM_WRITE_ONLY, CL_STREAM, &ext, &ret));
ext.flags = 1; //Create write stream for argument 1
cl_stream write_stream_a = xcl::Stream::createStream(device.get(), XCL_STREAM_READ_ONLY, CL_STREAM, &ext, &ret));

Please refer streaming_simple example to more about Streaming kernel usage.

EXCLUDED PLATFORMS

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

u250
zc
vck
xdma
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

COMMAND LINE ARGUMENTS

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

./streaming_mm_mixed <krnl_stream_vadd XCLBIN>