Intel® FPGA SDK for OpenCL™ Pro Edition: Best Practices Guide

ID 683521
Date 12/19/2022
Document Table of Contents
Give Feedback

10.1.3. Using Non-Blocking Channels

If you must implement channels in your Intel® Stratix® 10 OpenCL designs, consider using non-blocking channels. This may reduce area overhead in some cases.

The example code below has a blocking channel read:

while (cond) {
   val = read_channel_intel (my_ch);
   <do_compute (val)>

To switch to a non-blocking channel read that is functionally equivalent to the blocking channel read, modify the code in the following manner:

bool have_data = true;
while (cond) {
   val = read_channel_nb_intel (my_ch, &have_data);
   if (have_data) <do_compute (val)>

For this example, the downside of changing from a blocking channel read to a non-blocking channel read is that the loop control logic becomes more complex. If you transform multiple channel accesses this way, the loop control logic might limit your performance or actually increase area overhead.