JPH054712B2 - - Google Patents
Info
- Publication number
- JPH054712B2 JPH054712B2 JP61011577A JP1157786A JPH054712B2 JP H054712 B2 JPH054712 B2 JP H054712B2 JP 61011577 A JP61011577 A JP 61011577A JP 1157786 A JP1157786 A JP 1157786A JP H054712 B2 JPH054712 B2 JP H054712B2
- Authority
- JP
- Japan
- Prior art keywords
- unrolling
- loop
- program
- operation sequence
- vector operation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/76—Architectures of general purpose stored program computers
- G06F15/80—Architectures of general purpose stored program computers comprising an array of processing units with common control, e.g. single instruction multiple data processors
- G06F15/8053—Vector processors
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Complex Calculations (AREA)
- Devices For Executing Special Programs (AREA)
Description
【発明の詳細な説明】
〔概要〕
自動ベクトル化対象プログラムのコンパイルに
あたつて、ベクトル化後のベクトル演算列に関す
る外側ループ中のデータ依存関係を把握し、その
結果に従つて、外側ループの回転数を1/Nと
し、ベクトル演算列をN倍に展開することによ
り、コンパイルされたプログラムの実行性能を向
上させる。[Detailed Description of the Invention] [Summary] When compiling a program to be automatically vectorized, data dependencies in the outer loop regarding vector operation sequences after vectorization are grasped, and according to the results, data dependencies in the outer loop are By setting the rotation speed to 1/N and expanding the vector operation sequence N times, the execution performance of the compiled program is improved.
本発明は、ベクトル計算機を持つデータ処理装
置によつて実行されるプログラムをコンパイルす
る処理方式に係り、特にループ中のベクトル演算
列をアンローリングするベクトル演算列ループア
ンローリング処理方式に関するものである。
The present invention relates to a processing method for compiling a program executed by a data processing device having a vector computer, and more particularly to a vector operation string loop unrolling processing method for unrolling a vector operation string in a loop.
例えばFORTRAN言語等により作成されたプ
ログラムを、ベクトル計算機を用いて実行させる
ために、DOループの配列等について、自動的に
ベクトル演算列を生成するコンパイラが用いられ
ている。このコンパイラが生成するオプジエクト
について、ベクトル化率を上げることは、ベクト
ル計算機による実行性能を向上させるために重要
な課題とされている。しかしながら、ハードウエ
ア資源であるベクトル計算機を最大限有効に使う
には、ベクトル化後のベクトル演算列を最適にス
ケジユーリングすることも必要である。
For example, in order to execute a program written in the FORTRAN language or the like using a vector computer, a compiler is used that automatically generates vector operation sequences for DO loop arrays and the like. Increasing the vectorization rate of objects generated by this compiler is considered an important issue in order to improve the execution performance of vector computers. However, in order to make the most effective use of a vector computer, which is a hardware resource, it is also necessary to optimally schedule the vector operation sequence after vectorization.
この最適スケジユーリングとは、ベクトル計算
機におけるロード・ストアパイプライン、加算パ
イプライン、乗算パイプライン等を流れるデータ
の密度を濃くし、実行の待ち時間が少なくなるよ
うに、ベクトル演算列を並べることである。 Optimal scheduling refers to arranging vector operation sequences in a way that increases the density of data flowing through the load/store pipeline, addition pipeline, multiplication pipeline, etc. in a vector computer, and reduces the waiting time for execution. It is.
この最適スケジユーリングのため、従来、ソー
スレベルのスカライメージで、ユーザの手作業に
より、プログラムをチユーニングすることが行わ
れていた。 In order to achieve this optimal scheduling, programs have conventionally been manually tuned by users using source-level scalar images.
しかし、ユーザが手作業により、ソースプログ
ラムをチユーニングした場合、次のような問題が
発生する。
However, when a user manually tunes a source program, the following problems occur.
スカライメージでベクトル版にチユーニング
したソースプログラムは、ベクトル処理機能を
持たない汎用計算機上では、実行性能が低下す
る可能性がある。 A source program tuned to a vector version using a scalar image may have lower execution performance on a general-purpose computer that does not have vector processing capabilities.
チユーニングするために多大な労力および時
間を要する。 Tuning requires a great deal of effort and time.
ソースプログラムの記述性が損なわれる。 The descriptive nature of the source program is impaired.
ユーザのチユーニングにより性能が低下し、
逆効果となることがある。 Performance decreases due to user tuning,
It may have the opposite effect.
本発明は上記問題点を解決するため、ベクトル
演算列をループアンローリングすることにより、
ソースプログラムから自動的に最適化されたオブ
ジエクトを生成する1方式を提供することを目的
としている。 In order to solve the above problems, the present invention performs loop unrolling on a vector operation sequence.
The purpose is to provide a method for automatically generating optimized objects from a source program.
第1図は本発明の基本構成例ブロツク図を示
す。
FIG. 1 shows a block diagram of an example of the basic configuration of the present invention.
第1図において、10は高級言語により記述さ
れたソースプログラム、11はCPUおよびメモ
リ等からなる処理装置、12はソースプログラム
10を機械語のオブジエクトに翻訳するコンパイ
ラ、13はプログラム入力部、14はベクトル化
処理部、15はデータ依存関係解析部、16はア
ンローリング実施条件判定部、17はアンローリ
ング処理部、18はオブジエクト生成部、19は
ソースプログラム10に対応する機械語コード列
からなるオブジエクトプログラムを表す。 In FIG. 1, 10 is a source program written in a high-level language, 11 is a processing unit consisting of a CPU, memory, etc., 12 is a compiler that translates the source program 10 into machine language objects, 13 is a program input unit, and 14 is a 15 is a data dependency analysis unit; 16 is an unrolling execution condition determination unit; 17 is an unrolling processing unit; 18 is an object generation unit; 19 is an object consisting of a machine code string corresponding to the source program 10; represents an actual program.
プログラム入力部13は、ソースプログラム1
0から処理すべきソースステートメントを入力す
る。この入力プログラムを解析することにより、
中間テキストが生成される。コンパイラ12は、
自動ベクトル化機能を備えており、ベクトル化処
理部14によつて、中間テキストを解読し、ベク
トル化可能なものを検出して、ベクトル演算列を
生成する。 The program input section 13 includes a source program 1
Enter the source statement to be processed starting from 0. By parsing this input program,
Intermediate text is generated. The compiler 12 is
It has an automatic vectorization function, and the vectorization processing unit 14 decodes the intermediate text, detects what can be vectorized, and generates a vector operation sequence.
データ依存関係解析部15は、多重ループにお
ける内側のループが、ベクトル化処理部14によ
つて、ベクトル化されている場合に、そのベクト
ル化されたベクトル演算列の外側ループにおける
データ依存関係を解析するものである。 When the inner loop in the multiple loop is vectorized by the vectorization processing section 14, the data dependence analysis section 15 analyzes the data dependence relation in the outer loop of the vectorized vector operation sequence. It is something to do.
アンローリング実施条件判定部16は、データ
依存関係解析部15による解析結果により、予め
各データ依存関係に対応してアンローリングの可
否情報が登録されたテーブルを検索することによ
り、アンローリングの可否を判定する。ループの
アンローリングとは、外側ループの回転数を1/
N(Nは2以上の整数)とし、ベクトル演算列を
N倍に展開する処理である。 The unrolling execution condition determining unit 16 determines whether or not unrolling is possible by searching a table in which unrolling permission information is registered in advance for each data dependency relationship based on the analysis result by the data dependency relationship analysis unit 15. judge. Unrolling the loop means reducing the number of rotations of the outer loop by 1/
N (N is an integer of 2 or more), and the vector operation sequence is expanded N times.
アンローリング処理部17は、アンローリング
実施条件判定部16により、アンローリング可と
判定された場合に、ベクトル演算列を分解して、
ループアンローリングを行う。外側ループの回転
数は、1/Nに削減されるが、端数が出る場合に
は、その残りのベクトル演算列による処理命令列
を、ループの外側に付加する。 When the unrolling execution condition determining unit 16 determines that unrolling is possible, the unrolling processing unit 17 decomposes the vector operation sequence,
Perform loop unrolling. The number of rotations in the outer loop is reduced to 1/N, but if a fraction occurs, a processing instruction sequence based on the remaining vector operation sequence is added to the outside of the loop.
ベクトル化され、アンローリングされた中間テ
キストは、必要に応じてさらに他の手段により最
適化される。オブジエクト生成部18は、最終的
にオブジエクトプログラム19を生成する。 The vectorized and unrolled intermediate text is further optimized by other means as necessary. The object generation unit 18 finally generates an object program 19.
以下、FORTRANプログラムのループアンロ
ーリングを例にして、本発明の作用を説明する。
The operation of the present invention will be explained below using loop unrolling of a FORTRAN program as an example.
例えば、
DO 10 J=1,100
DO 10 I=1,10000
A(I,J)=B(I,J)+C(I,J)*
D(I,J)
10 CONTINUE
という二重ループのプログラムは、ベクトル化処
理部14により、内側ループについて、次のよう
にベクトル化が行われる。 For example, DO 10 J=1,100 DO 10 I=1,10000 A(I,J)=B(I,J)+C(I,J)*
In the double-loop program D(I,J) 10 CONTINUE, the vectorization processing unit 14 vectorizes the inner loop as follows.
DO 10 J=1,100
A(*,J)=B(*,J)+C(*,J)*
D(*,J)
10 CONTINUE
ここで、配列中の「*」は、1から10000まで
の値をとるベクトル・パラメータであつて、ベク
トル長は10000である。 DO 10 J=1,100 A(*,J)=B(*,J)+C(*,J)*
D(*,J) 10 CONTINUE Here, "*" in the array is a vector parameter that takes a value from 1 to 10,000, and the vector length is 10,000.
アンローリング処理部17は、これについて、
次のようにループアンローリングを行う。 Regarding this, the unrolling processing unit 17
Perform loop unrolling as follows.
DO 10 J=1,100,2
A(*,J)=B(*,J)+C(*,J)*
D(*,J)
A(*,J+1)=B(*,J+1)+C(*,
J+1)*D(*,J+1)
10 CONTINUE
即ち、ループ制御変数の増分値を2倍にするこ
とにより、外側ループのループ回転数を1/2とし、
内部のベクトル演算列を分解して2倍にする。3
重展開以上についても同様である。展開されたベ
クトル演算列は、個別にベクトル計算機における
パイプラインによつて処理されるので、パイプラ
インの処理密度を高密度化することが可能にな
り、パイプライン・スケジユーリングが最適化さ
れる。 DO 10 J=1,100,2 A(*,J)=B(*,J)+C(*,J)*
D(*,J) A(*,J+1)=B(*,J+1)+C(*,
J+1)*D(*,J+1) 10 CONTINUE In other words, by doubling the increment value of the loop control variable, the loop rotation speed of the outer loop is halved,
Decomposes the internal vector operation sequence and doubles it. 3
The same applies to double expansion and above. The expanded vector operation sequence is individually processed by the pipeline in the vector calculator, making it possible to increase the processing density of the pipeline and optimizing pipeline scheduling. .
また、次のような場合には、ベクトル演算にお
ける共通式の最適化によるベクトルテキスト最適
化が可能になる。例えば、ベクトル化後のベクト
ル演算列が、
DO 10 J=1,100
A(*,J+1)=B(*,J)+A(*,J)
10 CONTINUE
であるとする。ここで、配列中の「*」は、前例
と同様に、1から10000までの値をとるベクト
ル・パラメータである。 Furthermore, in the following cases, vector text optimization becomes possible by optimizing common expressions in vector operations. For example, assume that the vector operation sequence after vectorization is DO 10 J=1,100 A(*, J+1)=B(*, J)+A(*, J) 10 CONTINUE. Here, "*" in the array is a vector parameter that takes values from 1 to 10,000, as in the previous example.
アンローリング処理部17は、これについて、
次のようにループアンローリングを行う。 Regarding this, the unrolling processing unit 17
Perform loop unrolling as follows.
DO 10 J=1,100,2
A(*,J+1)=B(*,J)+A(*,J)
……
A(*,J+2)=B(*,J+1)+A(*,
J+1) ……
10 CONTINUE
このベクトル演算列における右辺第2項は、
ベクトル演算列の左辺と同じ値をとる。ベクト
ル計算機により、ベクトル演算列を実行する
と、ベクトルレジスタにA(*,J+1)が得ら
れるので、次のベクトル演算列の実行におい
て、A(*,J+1)をロードする必要がない。
これにより、高速実行が可能になり、ベクトルテ
キストの最適化が可能になる。 DO 10 J=1,100,2 A(*,J+1)=B(*,J)+A(*,J)
... A(*, J+2)=B(*, J+1)+A(*,
J+1) ... 10 CONTINUE The second term on the right side of this vector operation sequence is
Takes the same value as the left side of the vector operation sequence. When the vector calculation sequence is executed by the vector computer, A(*, J+1) is obtained in the vector register, so there is no need to load A(*, J+1) when executing the next vector calculation sequence.
This enables fast execution and optimization of vector text.
第2図は本発明の一実施例処理説明図、第3図
はアンローリング可否テーブルの例、第4図はデ
ータ依存関係値とアンローリング展開数との関連
を説明する図を示す。
FIG. 2 is a diagram illustrating a process of an embodiment of the present invention, FIG. 3 is an example of an unrolling availability table, and FIG. 4 is a diagram illustrating the relationship between data dependency values and the number of unrolling expansions.
本発明によるループアンローリング処理は、例
えば第2図に示すように行われる。なお、この処
理は、処理対象ループ内にベクトル化された演算
列が存在するときに呼び出される。以下の説明に
おける処理番号〜は、第2図に示す番号〜
に対応する。 The loop unrolling process according to the present invention is performed, for example, as shown in FIG. Note that this process is called when a vectorized operation sequence exists in the loop to be processed. Processing numbers ~ in the following explanation are numbers shown in Figure 2 ~
corresponds to
データ依存関係値をもとに、第3図に示すよ
うなアンローリング可否テーブルを検索する。 Based on the data dependency value, an unrolling possibility table as shown in FIG. 3 is searched.
なお、データ依存関係値およびアンローリン
グ可否テーブルについては、後に詳述する。 Note that the data dependency value and the unrolling possibility table will be described in detail later.
アンローリング可否テーブルを検索した結果
により、アンローリングの可/不可を判定し、
アンローリングが不可である場合には、アンロ
ーリングによる最適化処理を行わずに、次の最
適化処理へ進む。 Based on the result of searching the unrolling possibility table, it is determined whether unrolling is possible or not.
If unrolling is not possible, the process proceeds to the next optimization process without performing the optimization process by unrolling.
他のアンローリング実施条件についても判定
する。この条件として、例えばループの回転数
が2以上(陽に判明している場合)であるこ
と、ループの出口が1つであること、ループ内
でベクトル長の変化がないことなどがある。ま
た、アンローリングにより、実行効率がよくな
るかどうかの条件についても判定する。これら
の各条件が満足されない場合、次の最適化処理
へ進む。 Other unrolling execution conditions are also determined. These conditions include, for example, that the number of rotations of the loop is 2 or more (if it is explicitly known), that the loop has one exit, that there is no change in the vector length within the loop, etc. It also determines the conditions as to whether or not unrolling improves execution efficiency. If each of these conditions is not satisfied, proceed to the next optimization process.
ループアンローリングのために、外側ループ
の回転数を1/Nにする。なお、説明を簡単に
するために、以下、N=2の場合について説明
する。 For loop unrolling, the rotation speed of the outer loop is set to 1/N. Note that to simplify the explanation, the case where N=2 will be explained below.
ベクトル演算列を2倍にする。即ち、元のベ
クトル演算列に対して、配列の添字式の値を歩
進したベクトル演算列を生成して付加する。 Double the vector operation sequence. That is, a vector operation sequence is generated and added by incrementing the value of the subscript expression of the array to the original vector operation sequence.
ループ回転数が定数であるかどうかを判定す
る。定数でない場合には、処理へ制御を移
す。 Determine whether the loop rotation speed is constant. If it is not a constant, control is transferred to processing.
元のループ回転数が偶数であるか奇数である
かを判定する。偶数である場合、次の最適化処
理へ進み、奇数である場合には、処理を実行
する。 Determine whether the original loop rotation number is even or odd. If the number is even, proceed to the next optimization process; if the number is odd, execute the process.
元のループにおいて最後に実行されるベクト
ル演算列の部分を、新しいループの外に付加し
て、次の最適化処理へ進む。 The part of the vector operation sequence that is executed last in the original loop is added to the outside of the new loop, and the process proceeds to the next optimization process.
ループ回転数が変数である場合、ダイナミツ
クに回転数を判定するテキストを生成して、付
加する。 If the loop rotation speed is a variable, a text that dynamically determines the rotation speed is generated and added.
回転数の判定に対応して、1/2にした回転数
の端数となる分のベクトル演算列をループの外
に付加する。その後、次の最適化処理へ進む。 Corresponding to the determination of the number of rotations, a vector operation sequence corresponding to the fraction of the halved number of rotations is added to the outside of the loop. After that, proceed to the next optimization process.
ベクトル演算列をループアンローリングする場
合、アンローリングによつて、配列の定義/参照
に関するベクトル計算機による実行順番が意図し
ないものとなつて、正しい結果が得られなくなる
可能性がある。そのため、本発明では、予め、次
のようなデータ依存関係値を求めておき、これに
よつて、アンローリングの可否を決定する。 When unrolling a vector operation sequence in a loop, the unrolling may cause the vector computer to execute the array definitions/references in an unintended order, making it impossible to obtain correct results. Therefore, in the present invention, the following data dependency relationship value is obtained in advance, and based on this, it is determined whether or not unrolling is possible.
データ依存関係値は、ループ内における前後す
る配列添字式の相対的な値関係を示すものと考え
てよい。例えば、前に現れる配列が、A(I)で
あつて、後に現れる配列が、A(I+2)である
とき、データ依存関係値は、制御変数Iが共通し
ているので、I=0として、次のように求められ
る。 The data dependency value can be considered to indicate the relative value relationship between the preceding and following array subscript expressions within the loop. For example, when the array that appears before is A(I) and the array that appears after is A(I+2), the data dependency value is set as I=0 because the control variable I is common. It is calculated as follows.
(0)−(0+2)=−2
データ依存関係値の種類は、例えば、以下の通
りである。 (0)-(0+2)=-2 Examples of the types of data dependency values are as follows.
(記号) (意味)
φ:重なりなし(データ依存関係なし).
+:順方向のデータ依存関係あり.
−:逆方向のデータ依存関係あり.
*:制御変数が出現していない.
?:データ依存関係が不明である.
+OR−:順方向のデータ依存関係あり.
(スカラとベクトル)
0:同じ位置をアクセスしている.
+の値:順方向にいくつ、ずれているかを表す.
−の値:逆方向にいくつ、ずれているかを表す.
アンローリングの可否は、以上のようなデータ
依存関係値によつて、決められる。そのため、例
えば第3図に示すようなアンローリング可否テー
ブルが用いられる。(Symbol) (Meaning) φ: No overlap (no data dependence). +: There is a forward data dependency. -: There is a data dependency in the opposite direction. *: Control variable does not appear. ? : Data dependencies are unknown. +OR-: There is a forward data dependency. (scalar and vector) 0: Accessing the same location. + value: Indicates the amount of shift in the forward direction. - value: Indicates how much it is shifted in the opposite direction. Whether or not unrolling is possible is determined by the data dependency value as described above. Therefore, for example, an unrolling possibility table as shown in FIG. 3 is used.
第3図図示アンローリング可否テーブルにおい
て、○はアンローリング可能、×はアンローリン
グ不可能、△は値によつて可否が決定されるもの
を表している。縦の列は1次元目のデータ依存関
係値、横の列は2次元目のデータ依存関係値を表
している。 In the unrolling possibility table shown in FIG. 3, ◯ indicates that unrolling is possible, × indicates that unrolling is impossible, and △ indicates whether unrolling is possible or not. The vertical columns represent first-dimensional data dependency relationship values, and the horizontal columns represent second-dimensional data dependency relationship values.
DO 10 J=1,N
DO 10 I=1,M
A(I,J)=……
……
10 CONTINUE
このような場合、Iが1次元目であり、Jが2
次元目である。 DO 10 J=1,N DO 10 I=1,M A(I,J)=…… 10 CONTINUE In this case, I is the first dimension and J is the second dimension.
It is the dimension.
第3図において、×印に該当する場合には、ア
ンローリングすることによつて、従来なかつたデ
ータ依存関係が生じることになるので、アンロー
リング不可能とされる。△印に該当する場合に
は、第4図に示すデータ依存関係値と、アンロー
リング展開数とによつて可否が決められる。例え
ば、データ依存関係値が±2である場合、2重展
開(即ち、N=2)のときにはアンローリング可
能であるが、3重展開以上(N≧3)ではアンロ
ーリングが不可能とされる。 In FIG. 3, in cases corresponding to the x marks, unrolling is considered impossible because unrolling will result in a data dependency relationship that did not exist before. If it falls under the △ mark, whether or not it is possible is determined based on the data dependency relationship value shown in FIG. 4 and the number of unrolling expansions. For example, if the data dependency value is ±2, unrolling is possible when there is double expansion (i.e., N=2), but unrolling is impossible when triple expansion or more (N≧3) occurs. .
次に、FORTRANプログラムの例により、ル
ープアンローリングの具体例を示す。 Next, a concrete example of loop unrolling will be shown using an example FORTRAN program.
(a) ループの回転数が陽に判明している場合であ
つて、回転数が偶数である場合
[ループアンローリング前]
DO 10 J=1,4
A(*,J)=B(*,J)+C(*,J)
10 CONTINUE
[ループアンローリング後]
DO 10 J=1,4,2
A(*,J)=B(*,J)+C(*,J)
A(*,J+1)=B(*,J+1)+C(*,
J+1)
10 CONTINUE
(b) 回転数が奇数である場合
[ループアンローリング前]
DO 10 J=1,5
A(*,J)=B(*,J)+C(*,J)
10 CONTINUE
[ループアンローリング後]
DO 10 J=1,3,2
A(*,J)=B(*,J)+C(*,J)
A(*,J+1)=B(*,J+1)+C(*,
J+1)
10 CONTINUE
A(*,5)=B(*,5)+C(*,5)
最後にJ=5のベクトル演算列が付加されてい
る。(a) When the number of rotations of the loop is explicitly known and the number of rotations is an even number [before loop unrolling] DO 10 J=1,4 A(*, J)=B(*, J)+C(*,J) 10 CONTINUE [After loop unrolling] DO 10 J=1,4,2 A(*,J)=B(*,J)+C(*,J) A(*,J+1) =B(*,J+1)+C(*,
J+1) 10 CONTINUE (b) When the number of rotations is odd [before loop unrolling] DO 10 J=1,5 A(*,J)=B(*,J)+C(*,J) 10 CONTINUE [Loop After unrolling] DO 10 J=1,3,2 A(*,J)=B(*,J)+C(*,J) A(*,J+1)=B(*,J+1)+C(*,
J+1) 10 CONTINUE A(*,5)=B(*,5)+C(*,5) Finally, a vector operation sequence of J=5 is added.
(c) 回転数が不明な場合
[ループアンローリング前]
DO 10 J=1,N
A(*,J)=B(*,J)+C(*,J)
10 CONTINUE
[ループアンローリング後]
IF(N.EQ.1)GOTO 20
DO 10 J=1,N−1,2
A(*,J)=B(*,J)+C(*,J)
A(*,J+1)=B(*,J+1)+C(*,
J+1)
10 CONTINUE
IF(MOD(N,2).EQ.0)GOTO 30
20 CONTINUE
A(*,N)=B(*,N)+C(*,N)
30 CONTINUE
上記実施例では、ループアンローリングの展開
数を2としたが、例えばループの回転数が陽に3
の場合には、3重展開にするというように、多重
展開も可能である。いわゆる最適化制御行によつ
て、ユーザがアンローリングの展開数を外側から
指定できるようにしてもよい。この場合、ユーザ
は、例えば次のような最適化制御行をソースプロ
グラムに記述する。(c) When the rotation speed is unknown [Before loop unrolling] DO 10 J=1,NA A(*,J)=B(*,J)+C(*,J) 10 CONTINUE [After loop unrolling] IF (N.EQ.1) GOTO 20 DO 10 J=1,N-1,2 A(*,J)=B(*,J)+C(*,J) A(*,J+1)=B(*, J+1)+C(*,
J+1) 10 CONTINUE IF (MOD(N,2).EQ.0) GOTO 30 20 CONTINUE A(*,N)=B(*,N)+C(*,N) 30 CONTINUE In the above example, loop unrolling The number of expansions of is set to 2, but for example, if the number of rotations of the loop is explicitly 3
In this case, multiple expansion is also possible, such as triple expansion. The user may be able to specify the number of unrolling expansions from the outside using a so-called optimization control line. In this case, the user writes, for example, the following optimization control line in the source program.
「*VOCL LOOP,UNROL(4)」
ここで、*VOCLは、この行が最適化制御行で
あることを示している。LOOPは、最適化がルー
プに対して有効であることを示す。UNROL(4)
は、4重展開にすべきことを指示している。4重
展開の場合、例えば次のようになる。"*VOCL LOOP, UNROL (4)" Here, *VOCL indicates that this line is an optimization control line. LOOP indicates that optimization is effective for loops. UNROL (4)
indicates that it should be expanded into four layers. In the case of quadruple expansion, for example, it is as follows.
[ループアンローリング前]
*VOCL LOOP,UNROL(4)
DO 10 J=1,N
A(*,J)=B(*,J)+C(*,J)
10 CONTINUE
[ループアンローリング後]
IF(N.LT.4)GOTO 20
DO 10 J=1,N−1,4
A(*,J)=B(*,J)+C(*,J)
A(*,J+1)=B(*,J+1)+C(*,
J+1)
A(*,J+2)=B(*,J+2)+C(*,
J+2)
A(*,J+3)=B(*,J+3)+C(*,
J+3)
10 CONTINUE
20 M=MOD(N,4)
IF(M.EQ.0)GOTO 50
IF(M.EQ.1)GOTO 40
IF(M.EQ.2)GOTO 30
A(*,N−2)=B(*,N−2)+C
(*,N−2)
30 A(*,N−1)=B(*,N−1)+C(*,
N−1)
40 A(*,N)=B(*,N)+C(*,N)
50 CONTINUE
この例では、ユーザが指定した最適化制御行に
より、アンローリングを4重展開で実施するとと
もに、制御変数がNであつて、コンパイル時に
は、ループ回転数が不明であるため、回転数判定
テキストを生成して、ループの後に付加してい
る。[Before loop unrolling] *VOCL LOOP, UNROL (4) DO 10 J=1,NA A(*,J)=B(*,J)+C(*,J) 10 CONTINUE [After loop unrolling] IF( N.LT.4) GOTO 20 DO 10 J=1,N-1,4 A(*,J)=B(*,J)+C(*,J) A(*,J+1)=B(*,J+1 )+C(*,
J+1) A(*, J+2)=B(*, J+2)+C(*,
J+2) A(*, J+3)=B(*, J+3)+C(*,
J + 3) 10 CONTINUE 20 M = MOD (N, 4) IF (M.EQ.0) GOTO 50 IF (M.EQ.1) GOTO 40 IF (M.EQ.2) GOTO 30 A (*, N-2 )=B(*,N-2)+C
(*, N-2) 30 A (*, N-1) = B (*, N-1) + C (*,
N-1) 40 A(*,N)=B(*,N)+C(*,N) 50 CONTINUE In this example, unrolling is performed in quadruple expansion using the optimization control line specified by the user, and , since the control variable is N and the loop rotation speed is unknown at the time of compilation, a rotation speed determination text is generated and added after the loop.
以上説明したように、本発明によれば、データ
依存関係を把握することにより、自動的にベクト
ル演算列のループアンローリングがなされること
になり、これにより、パイプライン・スケジユー
リングの最適化が可能になる。また、ベクトルテ
キストの最適化も可能になる。従つて、実行性能
が向上し、ユーザのチユーニング時間を短縮する
ことができる。また、ソースプログラムについ
て、FORTRANプログラム等の記述性を保持す
ることができ、ソースレベルでの汎用計算機との
互換性を維持することができる。
As explained above, according to the present invention, by understanding data dependencies, loop unrolling of vector operation sequences is automatically performed, thereby optimizing pipeline scheduling. becomes possible. It also allows optimization of vector text. Therefore, execution performance is improved and the user's tuning time can be shortened. Further, the descriptive nature of the FORTRAN program and the like can be maintained for the source program, and compatibility with general-purpose computers at the source level can be maintained.
第1図は本発明の基本構成例ブロツク図、第2
図は本発明の一実施例処理説明図、第3図はアン
ローリング可否テーブルの例、第4図はデータ依
存関係値とアンローリング展開数との関連を説明
する図を示す。
図中、10はソースプログラム、11は処理装
置、12はコンパイラ、13はプログラム入力
部、14はベクトル化処理部、15はデータ依存
関係解析部、16はアンローリング実施条件判定
部、17はアンローリング処理部、18はオブジ
エクト生成部、19はオブジエクトプログラムを
表す。
Fig. 1 is a block diagram of an example of the basic configuration of the present invention;
FIG. 3 shows an example of an unrolling possibility table, and FIG. 4 shows a diagram illustrating the relationship between data dependency values and the number of unrolling expansions. In the figure, 10 is a source program, 11 is a processing device, 12 is a compiler, 13 is a program input section, 14 is a vectorization processing section, 15 is a data dependency analysis section, 16 is an unrolling execution condition determination section, and 17 is an unrolling execution condition determination section. 18 is a rolling processing section, 18 is an object generation section, and 19 is an object program.
Claims (1)
有するデータ処理システムにおいて、 コンパイル対象のソースプログラム10を入力
するプログラム入力部13と、 該プログラム入力部13が入力したコンパイル
対象プログラムを解析した結果の中間テキストを
解読し、ベクトル化可能なものを検出して、ベク
トル演算列を生成するベクトル化処理部14と、 コンパイル対象プログラム中の多重ループにお
ける内側のループが上記ベクトル化処理部14に
よつてベクトル化されている場合に、ベクトル化
されたベクトル演算列の外側ループにおけるアン
ローリングに関連するデータ依存関係を解析する
データ依存関係解析部15と、 少なくとも上記データ依存関係解析部15によ
る解析結果に従つて、アンローリングの可否を判
定するアンローリング実施条件判定部16と、 該アンローリング実施条件判定部16により、
アンローリング可と判定された場合に、上記外側
ループの回転数を1/N(Nは2以上の整数)と
し、ベクトル演算列をN倍に展開するアンローリ
ング処理部17とを備えたことを特徴とするベク
トル演算列ループアンローリング処理方式。[Claims] 1. In a data processing system having a compile processing function that performs automatic vectorization, a program input unit 13 inputs a source program 10 to be compiled, and analyzes the program to be compiled input by the program input unit 13. a vectorization processing unit 14 that decodes the resulting intermediate text, detects vectorizable text, and generates a vector operation sequence; and an inner loop of a multiple loop in a program to be compiled is a data dependency relationship analysis unit 15 that analyzes data dependencies related to unrolling in the outer loop of the vectorized vector operation sequence when the vectorization is vectorized by the data dependency relationship analysis unit 15; An unrolling execution condition determination unit 16 that determines whether or not unrolling is possible according to the analysis result; and the unrolling execution condition determination unit 16,
and an unrolling processing unit 17 that sets the number of rotations of the outer loop to 1/N (N is an integer of 2 or more) and expands the vector operation sequence N times when it is determined that unrolling is possible. Features a vector operation sequence loop unrolling processing method.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP61011577A JPS62169272A (en) | 1986-01-22 | 1986-01-22 | Unrolling processing system for vector arithmetic string loop |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP61011577A JPS62169272A (en) | 1986-01-22 | 1986-01-22 | Unrolling processing system for vector arithmetic string loop |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS62169272A JPS62169272A (en) | 1987-07-25 |
| JPH054712B2 true JPH054712B2 (en) | 1993-01-20 |
Family
ID=11781767
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP61011577A Granted JPS62169272A (en) | 1986-01-22 | 1986-01-22 | Unrolling processing system for vector arithmetic string loop |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPS62169272A (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH03150636A (en) * | 1989-11-08 | 1991-06-27 | Matsushita Electric Ind Co Ltd | How to compile |
| JP2718816B2 (en) * | 1990-10-19 | 1998-02-25 | 富士通株式会社 | Compiler unit |
| JP2009070070A (en) * | 2007-09-12 | 2009-04-02 | Nec Corp | Compiler and compiling method |
-
1986
- 1986-01-22 JP JP61011577A patent/JPS62169272A/en active Granted
Also Published As
| Publication number | Publication date |
|---|---|
| JPS62169272A (en) | 1987-07-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP0735468B1 (en) | Method and apparatus for an optimizing compiler | |
| US5835776A (en) | Method and apparatus for instruction scheduling in an optimizing compiler for minimizing overhead instructions | |
| US10776127B2 (en) | Reducing data hazards in pipelined processors to provide high processor utilization | |
| US6754893B2 (en) | Method for collapsing the prolog and epilog of software pipelined loops | |
| JP3317825B2 (en) | Loop-optimized translation processing method | |
| US5867711A (en) | Method and apparatus for time-reversed instruction scheduling with modulo constraints in an optimizing compiler | |
| JP3896087B2 (en) | Compiler device and compiling method | |
| Ramamoorthy et al. | A high-level language for horizontal microprogramming | |
| US5537620A (en) | Redundant load elimination on optimizing compilers | |
| US5664193A (en) | Method and apparatus for automatic selection of the load latency to be used in modulo scheduling in an optimizing compiler | |
| US5809308A (en) | Method and apparatus for efficient determination of an RMII vector for modulo scheduled loops in an optimizing compiler | |
| US5613121A (en) | Method and system of generating combined storage references | |
| JPH02217926A (en) | Compiler | |
| JPH04330527A (en) | Optimization method for compiler | |
| US6671878B1 (en) | Modulo scheduling via binary search for minimum acceptable initiation interval method and apparatus | |
| JPS63132338A (en) | Code generating method | |
| Krishnaiyer et al. | An advanced optimizer for the IA-64 architecture | |
| US6064820A (en) | Apparatus and method to incrementally update single static assignment (SSA) form | |
| Muthukumar et al. | Software pipelining of nested loops | |
| JP4719415B2 (en) | Information processing system and code generation method | |
| JP3311381B2 (en) | Instruction scheduling method in compiler | |
| JPH054712B2 (en) | ||
| JP3840149B2 (en) | Compiler, arithmetic processing system, and arithmetic processing method | |
| CN118092931A (en) | Function vectorization method and system based on guidance statement | |
| Hong et al. | Rapid prototyping of DSP algorithms on VLIW TMS320C6701 DSP |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |