Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,179 Views

Can NDRange kernel forward data to other kernels via channels/pipes?

Hi everyone, 

 

I'm writing an OpenCL image segmentation code. The algorithm I chose is mostly parallel, meaning that distances between pixels and cluster centers are calculated in parallel. However, there are three kernels: first and third are pipeline kernels, and second is NDRange. The question is: can NDRange kernel forward data to kernels via channels and how, and how to preserve ordering of the pixels? 

 

Thanks in advance!
0 Kudos
3 Replies
Altera_Forum
Honored Contributor I
17 Views

You can find the answers to your questions in "Intel FPGA SDK for OpenCL Programming Guide, Section 5.4".

Altera_Forum
Honored Contributor I
17 Views

Thank you for your comment. I already read all Altera manuals, however I still do not understand how to maintain ordering of the channels (writing from NDRange to other kernels) since NDRange kernel executes work-items out-of-order. I'm also concerned about the length of the channel. If I have an image of size 300x400, do I need to create 300x400 channel, or I should design shorter channel and execute loop several times? 

 

 

--- Quote Start ---  

You can find the answers to your questions in "Intel FPGA SDK for OpenCL Programming Guide, Section 5.4". 

--- Quote End ---  

Altera_Forum
Honored Contributor I
17 Views

As mentioned in 5.4.3, if certain requirements are met, work-item ordering will be deterministic (i.e. no out-of-order execution); if these conditions are not met, the compiler will warn you about non-deterministic ordering. Furthermore, using channels in NDRange kernels limits number of parallel work-groups per compute unit to one. 

 

Regarding depth of channels, it depends on how fast data is produced and consumed. You are not supposed to make the channel big enough to be able to keep all the data inside of it at once; as long as you make sure data is produced and consumed at a similar rate, you can keep the channel depth small.