distribute_point

 

指定された位置でループ分配を行うようコンパイラーに指示します。

構文

#pragma distribute_point

引数

なし

説明

この distribute_point プラグマは、大きなループを小さなループに分割するようにコンパイラーに指示します。レジスターの使用率が高いためにソフトウェアのパイプライン化 (SWP) やベクトル化のような最適化を実行できない場合に役立ちます。

ループ分配手法に distribute_point プラグマを使用すると、IA-64 アーキテクチャーの新しく、より小さなループでソフトウェアのパイプライン化が可能になります。ループをより小さなセグメントに分割することによって、より小さな各ループ、またはその少なくとも 1 つをソフトウェアのパイプライン化またはベクトル化できる可能性があります。

例 1: ループ外での distribute_point プラグマの使用

次の例では、ループ外で distribute_point プラグマが使用されています。

#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;

  }

}

例 2: ループ外での distribute_point プラグマの使用

次の例では、ループ内で distribute_point プラグマが使用されています。

#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;

  }

}

例 3: ループの内部と外部での distribute_point プラグマの使用

次の例は、最初にループの外部、次にループの内部で distribute point プラグマを使用する方法を示しています。

void dist1(int a[], int b[], int c[], int d[])

{

#pragma distribute_point  

// Compiler will automatically decide where to

// distribute. Data dependency is observed.

  for (int i=1; i<1000; i++) {

    b[i] = a[i] + 1;

    c[i] = a[i] + b[i];

    d[i] = c[i] + 1;

  }

}

 

void dist2(int a[], int b[], int c[], int d[])

{

  for (int i=1; i<1000; i++) {

    b[i] = a[i] + 1;

#pragma distribute_point    

// Distribution will start here,

// ignoring all loop-carried dependency.

    c[i] = a[i] + b[i];

    d[i] = c[i] + 1;

  }

}