Intel® FPGA SDK for OpenCL™ Standard Edition: Best Practices Guide

ID 683176
Date 9/24/2018
Document Table of Contents

3.7. Avoiding Pointer Aliasing

Insert the restrict keyword in pointer arguments whenever possible. Including the restrict keyword in pointer arguments prevents the from creating unnecessary memory dependencies between non-conflicting load and store operations.

The restrict keyword informs the offline compiler that the pointer does not alias other pointers. For example, if your kernel has two pointers to global memory, A and B, that never overlap each other, declare the kernel in the following manner:

__kernel void myKernel (__global int * restrict A,
                        __global int * restrict B)
Warning: Inserting the restrict keyword on a pointer that aliases other pointers might result in incorrect results.

Did you find the information on this page useful?

Characters remaining:

Feedback Message