4.3. Avoid Pointer Aliasing
Add a restrict type-qualifier to pointer types whenever possible. By having restrict-qualified pointers, you prevent the Intel® HLS Compiler Pro Edition from creating unnecessary memory dependencies between nonconflicting read and write operations.
The restrict type-qualifier is __restrict.
Consider a loop where each iteration reads data from one array, and then it writes data to another array in the same physical memory. Without adding the restrict type-qualifier to these pointer arguments, the compiler must assume that the two arrays might overlap. Therefore, the compiler must keep the original order of memory accesses to both arrays, resulting in poor loop optimization or even failure to pipeline the loop that contains the memory accesses.
You can also use the restrict type-qualifier with Avalon® memory-mapped (MM) host interfaces.
Did you find the information on this page useful?