cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Observer
Observer
6,029 Views
Registered: ‎04-02-2015

OpenCL pipes equivalent for HLS kernels

Jump to solution

Hi 

 

I need to pass data between two C/C++ - HLS kernel. I am aware of pipes concept which can be used to to pass between two OpenCL kernels. What is the OpenCL pipes equivalent for C/C++-HLS flow. 

 

Thanks

0 Kudos
Reply
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
10,204 Views
Registered: ‎08-17-2011

Hi @kaliuday

 

you can put the 2 kernels inside the same (new) top function and have an hls::stream<> which will implement the fifo / pipe AND the top level needs to be in dataflow mode. DON'T forget to set the stream depth for the fifo which will tell the depth implemented in HW (otherwise defaults to 1).

 

something like this :

kernel NEWTOPKERNEL (.. args..)

#pragma HLS DATAFLOW

hls::stream<type> internalstreamimplementedasfifo;

#pragma HLS STREAM variable=internalstreamimplementedasfifo depth=42

kernelwriter(args, internalstreamimplementedasfifo);

kernelreader(internalstreamimplementedasfifo,args);

}

 

with kernelXXX(hls::stream<type> & fifo, ...args) using .read() or .write() methods for blocking reads (recommended) or read_nb/write_nb (less recommended).

 

i hope this helps

- Hervé

SIGNATURE:
* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

4 Replies
Xilinx Employee
Xilinx Employee
10,205 Views
Registered: ‎08-17-2011

Hi @kaliuday

 

you can put the 2 kernels inside the same (new) top function and have an hls::stream<> which will implement the fifo / pipe AND the top level needs to be in dataflow mode. DON'T forget to set the stream depth for the fifo which will tell the depth implemented in HW (otherwise defaults to 1).

 

something like this :

kernel NEWTOPKERNEL (.. args..)

#pragma HLS DATAFLOW

hls::stream<type> internalstreamimplementedasfifo;

#pragma HLS STREAM variable=internalstreamimplementedasfifo depth=42

kernelwriter(args, internalstreamimplementedasfifo);

kernelreader(internalstreamimplementedasfifo,args);

}

 

with kernelXXX(hls::stream<type> & fifo, ...args) using .read() or .write() methods for blocking reads (recommended) or read_nb/write_nb (less recommended).

 

i hope this helps

- Hervé

SIGNATURE:
* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

Observer
Observer
6,010 Views
Registered: ‎04-02-2015

hi @herver

 

Thanks for your response.

 

Currently I have two kernels (kernel1.cpp, kernel2.cpp) as 2 compute units.

 

I want to pipeline their executions and kernel1's output becomes input for kernel2. I dont want to use "kernel to global memory" transactions for sending input data to kernel2. Further, once the data transfer is done from kernel1 to kernel2, I want kernel1 to work on a different data set which comes from host and at the same time kernel2 works on inputs from kernel1.   

0 Kudos
Reply
Xilinx Employee
Xilinx Employee
5,986 Views
Registered: ‎08-17-2011

hi @kaliuday 

 

yes what you describe is what dataflow does - please read UG902 on dataflow function pipelining. any/all VHLS concept are applicable here.

the only thing to look for is the execution / wait times of the kernels and host synchronization.

 

cheers

- Hervé

SIGNATURE:
* New Dedicated Vivado HLS forums* http://forums.xilinx.com/t5/High-Level-Synthesis-HLS/bd-p/hls
* Readme/Guidance* http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

* Please mark the Answer as "Accept as solution" if information provided is helpful.
* Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Reply
Observer
Observer
5,257 Views
Registered: ‎04-02-2015

Hi @herver

 

Thanks for your answer, It worked as expected.

0 Kudos
Reply