Restrict Keyword - 2022.1 English

AI Engine Kernel Coding Best Practices Guide (UG1079)

Document ID
Release Date
2022.1 English

The C standard provides a specific pointer qualifier __restrict, intended to allow more aggressive compiler optimization, by explicitly stating independence between data. The compiler, by default, does not distinguish between different access of the same array. Thus, if an array is accessed in the pipeline, it can hinder the pipeline from achieving higher interval between loops with conservative assumption. This makes it is essential in some situations to use a __restrict keyword to help guide the tool to achieve better performance. Care must be taken in using the __restrict keyword because if the __restrict keyword is assigned to pointers in the same scope, undefined behavior may be observed when the pointers are used. For detailed information about the concept of the __restrict keyword, see Using the Restrict Keyword in AI Engine Kernels in the Versal ACAP AI Engine Programming Environment User Guide (UG1076).