Developer Guide and Reference

Contents

distribute_point

Instructs the compiler to prefer loop distribution at the location indicated.

Syntax

#pragma distribute_point
Arguments
None
Description
The
distribute_point
pragma is used to suggest to the compiler to split large loops into smaller ones; this is particularly useful in cases where optimizations like vectorization cannot take place due to excessive register usage.
The following rules apply to this pragma:
  • When the pragma is placed inside a loop, the compiler distributes the loop at that point. All loop-carried dependencies are ignored.
  • When inside the loop, pragmas cannot be placed within an
    if
    statement.
  • When the pragma is placed outside the loop, the compiler distributes the loop based on an internal heuristic. The compiler determines where to distribute the loops and observes data dependency. If the pragmas are placed inside the loop, the compiler supports multiple instances of the pragma.
Example: Using the
distribute_point
pragma outside the loop
#define NUM 1024 void loop_distribution_pragma1(        double a[NUM], double b[NUM], double c[NUM],        double x[NUM], double y[NUM], double z[NUM] ) {   int i;   // Before distribution or splitting the loop   #pragma distribute_point   for (i=0; i< NUM; i++) {     a[i] = a[i] + i;     b[i] = b[i] + i;     c[i] = c[i] + i;     x[i] = x[i] + i;     y[i] = y[i] + i;     z[i] = z[i] + i;   } }
Example: Using the
distribute_point
pragma inside the loop
#define NUM 1024 void loop_distribution_pragma2(        double a[NUM], double b[NUM], double c[NUM],        double x[NUM], double y[NUM], double z[NUM] ) {   int i;   // After distribution or splitting the loop.   for (i=0; i< NUM; i++) {     a[i] = a[i] +i;     b[i] = b[i] +i;     c[i] = c[i] +i;     #pragma distribute_point     x[i] = x[i] +i;     y[i] = y[i] +i;     z[i] = z[i] +i;   } }