Intel® FPGA SDK for OpenCL™ Standard Edition: Programming Guide
Visible to Intel only — GUID: gjj1521227843923
Ixiasoft
Visible to Intel only — GUID: gjj1521227843923
Ixiasoft
5.4.5.2.1. Implementing Nonblocking Channel Writes
Consider a scenario where your application has one data producer with two identical workers. Assume the time each worker takes to process a message varies depending on the contents of the data. In this case, there might be situations where one worker is busy while the other is free. A nonblocking write can facilitate work distribution such that both workers are busy.
channel long worker0, worker1; __kernel void producer( __global const long * src ) { for(int i = 0; i < N; i++) { bool success = false; do { success = write_channel_nb_intel(worker0, src[i]); if(!success) { success = write_channel_nb_intel(worker1, src[i]); } } while(!success); } }