FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5741 Discussions

Intel Opencl FPGA blocking channel

ADua0
Beginner
678 Views

For Opencl FPGA blocking channel , if there are two independent read/write channel operation, are they actually happening in parallel. In the system viewer of report it appears there are no dependencies so I believe they should happen in parallel but how do you verify?

 

 

 

 

In code sample below what should happen is that b1 and a should happen in parallel with b2 and a2. 

 

 

 

Here is example code,

 

int b1= read_channel_intel(c1);

int b2 = read_channel_intel(c2);

 

a = b1 *100 ;

a2 = b2 * 200;

 

write_channel_intel(c1,a);

write_channel_intel(c2,a2);

 

0 Kudos
1 Solution
HRZ
Valued Contributor II
108 Views

No, independent channel operations happen sequentially and at an order decided by the compiler. This is why mem_fence(CLK_CHANNEL_MEM_FENCE) is provided to avoid potential deadlocks resulting from channel operation re-ordering by the compiler. In your example it is very much possible that the channel operations might result in a deadlock if they are re-ordered by the compiler. You should make sure to use a mem_fence(CLK_CHANNEL_MEM_FENCE) both between the two channel read operations and the two channel write operations to avoid this.

View solution in original post

4 Replies
HRZ
Valued Contributor II
109 Views

No, independent channel operations happen sequentially and at an order decided by the compiler. This is why mem_fence(CLK_CHANNEL_MEM_FENCE) is provided to avoid potential deadlocks resulting from channel operation re-ordering by the compiler. In your example it is very much possible that the channel operations might result in a deadlock if they are re-ordered by the compiler. You should make sure to use a mem_fence(CLK_CHANNEL_MEM_FENCE) both between the two channel read operations and the two channel write operations to avoid this.

View solution in original post

ADua0
Beginner
108 Views

Okay, so would you recommend adding this memory fence for all the channels I have in my design ?

HRZ
Valued Contributor II
108 Views

Certainly not; if a certain channel order is required to avoid deadlocks, then you should use a mem_fence to enforce the ordering. If not (i.e. channel operations can be safely re-ordered), then let the compiler decide the order of the operations.

ADua0
Beginner
108 Views

By deadlock you meant which channel operations are stalling maximum amount of time?

Reply