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

ID 683259
Date 12/18/2019
Document Table of Contents

3.2. Avoid Pointer Aliasing

Add a restrict type qualifier to pointer types whenever possible. By having restrict-qualified pointers, you prevent the Intel® HLS Compiler Standard 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 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.

For more details, review the parameter aliasing tutorial in the following location: