Intel® High Level Synthesis Compiler Pro Edition: Best Practices Guide

ID 683152
Date 3/28/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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.

For more details, review the parameter aliasing tutorial in the following location:
<quartus_installdir>/hls/examples/tutorials/best_practices/parameter_aliasing