Forum Discussion
Ordering of channel operations
Hi,
This is expected behavior. Within a kernel, multiple channel calls (to different channels) are considered independent. This can be a problem if channels form a cycle between kernels.
When I compile your code, the compiler generates a warning as follows: (check your log files)
- Compiler Warning: Kernels comp and generator may form a cycle due to connectivity of channels channels[0] and channels[1]. Use mem_fence if you require source code-based ordering of channel operations. Channel depths cannot be optimized.
Ideally, you want to avoid forming a cycle between kernels with channels.
https://www.intel.com/content/www/us/en/programmable/documentation/mwh1391807965224.html#mwh1391806067772
@douglas.prinn The "receive" kernel has a clear Write-after-Read hazard/dependency on "status->m". The two operations involving the variable, regardless of what those operations are, should not be reordered (by any sane compiler). The existence of a cycle a channels in this case, or channel operations for that matter, is irrelevant. Are you implying that aoc ignores data dependencies when channel operations are involved?