JPH03220669A - Multiple loop vectorization compilation method - Google Patents

Multiple loop vectorization compilation method

Info

Publication number
JPH03220669A
JPH03220669A JP2016700A JP1670090A JPH03220669A JP H03220669 A JPH03220669 A JP H03220669A JP 2016700 A JP2016700 A JP 2016700A JP 1670090 A JP1670090 A JP 1670090A JP H03220669 A JPH03220669 A JP H03220669A
Authority
JP
Japan
Prior art keywords
loop
text
intermediate text
source program
vectorization
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.)
Pending
Application number
JP2016700A
Other languages
Japanese (ja)
Inventor
Takayuki Nakatomi
中富 孝幸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Solution Innovators Ltd
Original Assignee
NEC Solution Innovators Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by NEC Solution Innovators Ltd filed Critical NEC Solution Innovators Ltd
Priority to JP2016700A priority Critical patent/JPH03220669A/en
Publication of JPH03220669A publication Critical patent/JPH03220669A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。
(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は電子計算機システムのコンパイラにおける多重
ループベクトル化コンパイル方式に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a multi-loop vectorization compilation method in a compiler for an electronic computer system.

〔従来の技術〕[Conventional technology]

記憶域上に規則的に並んでいるデータに対して一度に演
算を行うベクトル命令をもつベクトル処理プロセッザに
おいては、−船釣に目的プログラムのうちのベクトル命
令によって実行される部分の割合を大きくすればするほ
ど、プログラムの実行時間を短縮することができる。こ
れは、通常の命令(スカラ命令)を何回も繰り返さなけ
れば行えない演算を1個のベクトル命令で実行すること
ができるからである。従って、このようなヘクI・ル処
理プロセソザに対するコンパイラでは、与えられた原始
プログラムを可能な限りベクトル命令による並列実行可
能な形で目的プログラムに変換することが望まれる。
In vector processing processors that have vector instructions that perform operations on data arranged regularly in a storage area at once, it is useful to increase the proportion of the part of the target program that is executed by vector instructions. The more you do this, the faster the program execution time can be. This is because a single vector instruction can perform an operation that cannot be performed without repeating a normal instruction (scalar instruction) many times. Therefore, it is desirable for a compiler for such a hexagonal processor to convert a given source program into a target program in a form that can be executed in parallel using vector instructions as much as possible.

ところで、ベクトル命令をもつベクI・ル処理プロセッ
サに対する従来のコンパイラは、一般に、高級言語で記
述された原始プログラムを読み込み構文解析を行って第
1中間テキストを生成する構文解析部と、第1中間テキ
ストから原始プログラム中のループ構造を検出してベク
トル化可能部分の認識を行いムク1〜ル処理用のテキス
トを含む第2中間テキストを生威するベクトル化処理部
と、第2中間テキストから目的プログラムを生成して出
力するコード生成部とから、その主要部が構成されてい
る。
By the way, conventional compilers for vector I/L processors with vector instructions generally include a syntax analysis unit that reads a source program written in a high-level language and performs syntax analysis to generate a first intermediate text; A vectorization processing unit that detects a loop structure in a source program from text, recognizes a vectorizable part, and generates a second intermediate text containing text for Muk1-L processing; The main part consists of a code generation section that generates and outputs a program.

このような従来のコンパイラは、例えば第10図に示す
ようなFORTRAN言語によって記述されたDOルー
プを含む原始プログラムが与えられた場合、構文解析部
がこの原始プログラムを読み込んで第11図に示すよう
な構成の第1中間テキスト(ステップ31〜34)を生
威し、次いで、ベクトル化処理部が第1中間テキストを
変形して第12図に示すような構成の第2中間テキスト
(ステップS11.312)を生威し、コード生成部が
第2中間テキストを読み込んで実際のコードから構成さ
れる目的プログラムを生成し出ノ〕するようにしていた
For example, when such a conventional compiler is given a source program including a DO loop written in the FORTRAN language as shown in FIG. Next, the vectorization processing unit transforms the first intermediate text to produce a second intermediate text (steps S11 to S34) having the structure as shown in FIG. 312), and the code generation unit reads the second intermediate text and generates a target program consisting of actual code.

また、上記のような単一のループに限らず、多重ループ
であっても所定の条件が満たされれば一重化によるベク
トル化が可能であった。例えば、第13図に示すような
多重DOループ含む原始プログラムが与えられた場合、
第14図に示すように、配列A、 B、  C,Dと要
素数を同しにした1次元の配列AA、BB、CC,DD
を新たに宣言し、EQU I VALENCE文により
配列A。
Further, vectorization by unifying is possible not only in a single loop as described above but also in multiple loops as long as a predetermined condition is satisfied. For example, if a source program including multiple DO loops as shown in Fig. 13 is given,
As shown in Figure 14, one-dimensional arrays AA, BB, CC, and DD have the same number of elements as arrays A, B, C, and D.
Newly declare array A using the EQU I VALENCE statement.

B、C,Dと配列AA、BB、CC,DDとをそれぞれ
一致させることにより、多重DOループ単一のDOルー
プ置き換え、この単一のDOループ対して第10図〜第
12図と同様な手法でベクトル化を行うものである。
By matching B, C, and D with the arrays AA, BB, CC, and DD, respectively, the multiple DO loop can be replaced with a single DO loop, and the same steps as in FIGS. 10 to 12 can be performed for this single DO loop. This method performs vectorization.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

上述したように、従来のコンパイラでは所定の条件のも
と、単一のループに限らず、多重ループであってもベク
トル化が可能であったが、−重化によってベクトル化で
きるための条件が厳しく、それを満たさないような場合
はベクトル化による実行時間短縮の効果が得られないと
いう欠点があった。
As mentioned above, under certain conditions, conventional compilers can vectorize not only a single loop but also multiple loops. This is very strict, and if the conditions are not met, the shortcoming is that the effect of reducing execution time through vectorization cannot be obtained.

すなわち、多重ループについて一重化によるベクトル化
が行える条件としては、 ■ループ中に並列実行に矛盾するデータ依存関係がない
こと ■ループ中の配列要素の定義引用が記憶域上で等間隔で
あること ■ループ中の配列要素の定義引用が記憶域上で一方向で
あること である。なお、■は当然のこととして、■、■は1次元
化した配列(第14図の例でばAA、 BBCC,DD
)の要素を順次増減させて行くことから要求される条件
である。
In other words, the conditions for vectorization by unification of multiple loops are: ■ There is no data dependency in the loop that contradicts parallel execution. ■ Definition references of array elements in the loop are equidistant on the storage area. ■Definition quotation of array elements in a loop is unidirectional in the storage area. Note that ■ is a matter of course, and ■ and ■ are one-dimensional arrays (in the example in Figure 14, AA, BBCC, DD).
) is required by sequentially increasing and decreasing the elements of

しかして、第4図に示すような多重Doループを含む原
始プログラムが与えられた場合、D○変数にの増分が「
2」であると共に、内側のDOループD○変数の終値が
その配列に許される最大値でないので、上記の■の条件
を満たさないため、この原始プログラムは一重化による
ベクトル化が行えず、最も内側のDoループについてだ
け、前述した第10図〜第■2図と同様の手法でベクト
ル化が行えるに過ぎず、よって、生成された目的プログ
ラムを実行するベクトル処理プロセッサでは外側のルー
プ制御および配列の添字計算についてはスカラ命令で順
次実行することを余儀なくされていた。
Therefore, when a source program including multiple Do loops as shown in Figure 4 is given, the increment in the D○ variable is "
2", and the final value of the inner DO loop D○ variable is not the maximum value allowed for that array, so the above condition (■) is not satisfied. Therefore, this source program cannot be vectorized by unification, and the most Only the inner Do loop can be vectorized using the same method as shown in Figs. The subscript calculations had to be executed sequentially using scalar instructions.

本発明は上記の点に鑑み提案されたものであり、その目
的とするとごろは、」二記の■、■の条件が満たされれ
ば、■の条件が満たされていない場合であっても一重化
によるベクトル化が行え、より一層の実行時間短縮を達
成することのできる多重ループベクトル化コンパイル方
式を提供することにある。
The present invention has been proposed in view of the above-mentioned points, and its purpose is that if the conditions ``■'' and ``2'' are satisfied, even if the condition ``■'' is not satisfied, The object of the present invention is to provide a multi-loop vectorization compilation method that can perform vectorization by converting and achieve further reduction in execution time.

〔課題を解決するための手段〕[Means to solve the problem]

本発明は上記の目的を達成するため、高級言語で記述さ
れた原始プログラムを読み込み構文解析を行って第1中
間テキストを生成する構文解析部と、第1中間テキスト
から原始プログラム中のループ構造を検出してベクトル
化可能部分の認識を行いベク(・ル処理用のテキストを
含む第2中間テキストを生成するベクトル化処理部と、
第2中間テキストから目的プログラムを生成して出力す
るコード生成部とを有し、ベクトル処理プロセッサに対
して、与えられた原始プログラムから目的プログラムを
生成して出力するコンパイル方式において、 前記ベクトル化処理部に、 第1中間テキストから原始プログラムのループ中の制御
の流れを解析する構造解析手段と、ループ中に並列実行
に矛盾するデータ依存関係があるか否かを判定するデー
タ依存関係判定手段と、 並列実行に矛盾しないと判定された部分につき通常のも
しくはマスク使用による多重ループの−・重化が可能か
否かを解析して判定する多重ループ−重化解析手段と、 一重化が可能と判定された部分および並列実行に矛盾し
ないと判定された他の部分を一重化およびもしくはベク
トル化して第2中間テキストを生成するベクトルテキス
ト生成手段とを設けるようにしている。
In order to achieve the above object, the present invention includes a syntax analysis unit that reads a source program written in a high-level language and performs syntax analysis to generate a first intermediate text, and a syntax analysis unit that generates a first intermediate text from the first intermediate text. a vectorization processing unit that detects and recognizes vectorizable portions and generates a second intermediate text including text for vector processing;
a code generation unit that generates and outputs a target program from a second intermediate text, and generates and outputs a target program from a given source program to a vector processing processor, the vectorization process A structure analysis means for analyzing the flow of control in a loop of the source program from the first intermediate text; and a data dependency relationship determination means for determining whether there is a data dependency relationship inconsistent with parallel execution in the loop. , a multiple loop-overlapping analysis means for analyzing and determining whether or not multiple loops can be overlapped normally or by using a mask for parts that are determined to be consistent with parallel execution; Vector text generation means is provided for generating a second intermediate text by unifying and/or vectorizing the determined portion and other portions determined to be compatible with parallel execution.

〔作用〕[Effect]

本発明の多重ループベクトル化コンパイル方式にあって
は、構文解析部の生成した第1中間テキストに対し、ベ
クトル化処理部の構造解析手段が原始プログラムのルー
プ中の制御の流れを解析し、データ依存関係判定手段が
ループ中に並列実行に矛盾するデータ依存関係があるか
否かを判定し、並列実行に矛盾しないと判定された部分
につき多重ループ−重化解析手段が通常のもしくはマス
ク使用による多重ループの一重化が可能か否かを解析し
て判定し、−重化が可能と判定された部分および並列実
行に矛盾しないと判定された他の部分をベクトルテキス
ト生成手段が一重化およびもしくはベクトル化して第2
中間テキストを生成し、次いで、この第2中間テキスト
からコード生成部が目的プログラムを生成して出力する
In the multiple loop vectorization compilation method of the present invention, the structure analysis means of the vectorization processing section analyzes the control flow in the loop of the source program with respect to the first intermediate text generated by the syntax analysis section, and The dependency determination means determines whether or not there is a data dependency that contradicts parallel execution in the loop, and the multiple loop-duplication analysis means determines whether or not there is a data dependency that is inconsistent with parallel execution in the loop. Analyze and determine whether it is possible to combine multiple loops, and - vector text generation means unify and/or Vectorized and second
An intermediate text is generated, and then a code generation section generates and outputs a target program from this second intermediate text.

〔実施例〕〔Example〕

以下、本発明の実施例につき図面を参照して説明する。 Embodiments of the present invention will be described below with reference to the drawings.

第1図は本発明の多重ループベクトル化コンパイル方式
を適用したコンパイラの一実施例を示す構成図である。
FIG. 1 is a block diagram showing an embodiment of a compiler to which the multiple loop vectorization compilation method of the present invention is applied.

第1図において、コンパイラ2は、基本的な構成として
、高級言語で記述された原始プログラム1を読み込み構
文解析を行って第1中間テキスト24を生成する構文解
析部21と、第1中間テキスト24から原始プログラム
1中のループ構造を検出してベクトル化可能部分の認識
を行いベクトル処理用のテキストを含む第2中間テキス
ト25を生成するベクトル化処理部22と、第2中間テ
キスト25から目的プログラム3を生成して出力するコ
ード生成部23とを含んでいる。
In FIG. 1, the compiler 2 basically includes a syntax analysis unit 21 that reads a source program 1 written in a high-level language and performs syntax analysis to generate a first intermediate text 24; a vectorization processing unit 22 that detects loop structures in the source program 1 from the source program 1 and recognizes vectorizable portions to generate a second intermediate text 25 that includes text for vector processing; 3 and a code generation section 23 that generates and outputs the code.

また、本発明の特徴部分として、ベクトル化処理部22
には、第1中間テキスト24から原始プログラム1のル
ープ中の制御の流れを解析する構造解析手段221と、
ループ中に並列実行に矛盾するデータ依存関係があるか
否かを判定するデータ依存関係判定手段222と、デー
タ依存関係判定手段222により並列実行に矛盾しない
と判定された部分につき通常のもしくはマスク使用によ
る多重ループの一重化が可能か否かを解析して判定する
多重ループ−重化解析手段223と、多重ループ−重化
解析手段223により一重化が可能と判定された部分お
よびデータ依存関係判定手段222により並列実行に矛
盾しないと判定された他の部分を一重化およびもしくは
ベクトル化して第2中間テキストを生成するベクトルテ
キスト生成手段224とが設けられている。
Further, as a characteristic part of the present invention, the vectorization processing unit 22
a structure analysis means 221 for analyzing the control flow in the loop of the source program 1 from the first intermediate text 24;
A data dependency relationship determining means 222 determines whether there is a data dependency relationship inconsistent with parallel execution in the loop, and normal or mask use is performed for the portion determined by the data dependency relationship determining means 222 to be consistent with parallel execution. A multiple loop-duplication analysis means 223 that analyzes and determines whether or not multiple loops can be unified by the multiple loop-duplication analysis means 223, and portions and data dependence relationships determined by the multiple loop-duplication analysis means 223 to be unified. Vector text generation means 224 is provided which generates a second intermediate text by unifying and/or vectorizing other portions determined by means 222 to be compatible with parallel execution.

第2図は構造解析手段221において多重ループの構造
解析の結果である解析情報を表現するのに用いる多重D
○ループ情報テーブル4の論理的構成を示したものであ
り、次の多重Do小ループ報テーブルへのポインタ41
と、D○ループネストチェーン42と、D○ループ−重
化テーブルへのポインタ43と、配列テーブルへのポイ
ンタ44と、ベクトルテキストへのポインタ45と、D
O変数のシンボルテーブルへのポインタ4Gと、D○ル
ープ初期値のトライアト47と、Do小ループ値の1−
ライアト48と、DOループ分値のトライアト49とか
ら構成されている。
FIG. 2 shows the multiplex D used in the structural analysis means 221 to express analysis information that is the result of structural analysis of multiple loops.
○ This shows the logical configuration of the loop information table 4, and a pointer 41 to the next multiple Do small loop information table.
, a D○ loop nest chain 42, a pointer to the D○ loop-duplication table 43, a pointer to the array table 44, a pointer to the vector text 45, and D
Pointer 4G to the symbol table of the O variable, triat 47 of the D○ loop initial value, and 1- of the Do small loop value.
It consists of a triat 48 and a triat 49 for DO loop values.

第3図は多重ループ−重化解析手段223において一重
化が可能な多重ループを解析した結果の解析情報を表現
するのに用いるDoループ一重重化上 1−ブル5の論理的構成を示したものであり、最内側の
多重D○ループ情報テーブルへのポインタ51と、マス
ク用配列テーブルへのポインタ52と、−重化後のD○
ループ初期値のトライアト53と、−重化後のDOルー
プ終値のトライアト54と、−重化後のDOループ分値
のトライアト55と、−重化後のDo小ループ繰り返し
数56とから構成されている。
FIG. 3 shows the logical configuration of the Do-loop-multiplexing method 1-Blu 5 used to express the analysis information of the result of analyzing multiple loops that can be combined in the multiple-loop-multiplexing analysis means 223. A pointer 51 to the innermost multiple D○ loop information table, a pointer 52 to the mask array table, and
It is composed of a triat 53 of the loop initial value, - a triat 54 of the DO loop final value after duplication, - a triat 55 of the DO loop value after duplication, and - a Do small loop repetition number 56 after duplication. ing.

以下、従来では多重ループの一重化によるベクトル化が
行えなかった第4図に示す原始プログラムが与えられた
場合を例にとって動作を説明する。
The operation will be described below by taking as an example the case where the source program shown in FIG. 4 is given, which conventionally could not be vectorized by unifying multiple loops.

具体的な動作に先立って、本発明による多重ループの一
重化の手法を概念的に説明する。
Prior to specific operations, a method of multiplexing multiple loops according to the present invention will be conceptually explained.

すなわち、本発明では、第4図の原始プログラムを第5
図に示すような2つの多重DOループ含む形にし、最初
の多重Do小ループ元の原始プログラムにおける多重D
Oループ同しDo変数を用い、その最内側ではマスク用
配列Wに値「1」を代入するだけの命令を置き、次の多
重DOループはD○変数の増分を全て「1」とすると共
に、2 内側のD○変数のP、(Ii!をその配列で許される最
大値とし、そのループの最内側でマスク用配列Wの要素
が例えば「1」である場合にのみ元の原始プログラム中
におけると同し定義引用を行わせる。
That is, in the present invention, the source program shown in FIG.
Contain two multiple DO loops as shown in the figure, and the first multiple DO small loop
The O loop uses the same Do variable, and at its innermost position there is an instruction that simply assigns the value "1" to the mask array W, and the next multiple DO loop sets all the increments of the D○ variable to "1", and , 2 Let P of the inner D○ variable, (Ii! be the maximum value allowed in the array, and only if the element of the mask array W at the innermost part of the loop is "1", for example, in the original source program Make the same definition citation as in .

つまり、第4図の原始プログラムにおける多重DOルー
プが一重化できなかったのは、Do変@Kが増分「2」
で変化するため、「ループ中の配列要素の定義引用が記
憶域上で等間隔でなければならない」という−重化の条
件に合致しないためであったので、D○変数にの増分を
強制的に「1」にすると共に、内側のDo小ループDo
変数の終値をその配列で許される最大値としてしまうの
である。ただし、そのままでは、D○変変数部「2」「
4」、・・・等およびDo変数I、JがIT、JJより
も大きいもの等の、プログラム作成者の意図していない
配列要素についても定義引用が行われてしまうこととな
るため、これを防止するために元の原始プログラムと同
じD○変数の多重DOループ残し、その多重ループの中
で演算を実際に行うべきことを示す情報をマスク用配列
Wに書き込み、続く多重DOループおいてマスク用配列
Wの要素を参照し、その値が「1」である場合にのみ定
義引用を行うようにしている。
In other words, the reason why the multiple DO loops in the source program in Figure 4 could not be unified is because the Do variation @K is incremented by ``2''.
This was because it did not meet the duplication condition that ``the definition references of array elements in the loop must be at equal intervals in the storage area'', so the increment was forced to the D○ variable. In addition to setting it to "1", the inner Do small loop Do
The final value of the variable is set to the maximum value allowed in the array. However, if left as is, D○ variable part "2""
4", etc. and Do variables I and J are larger than IT and JJ, definitions will also be quoted for array elements that are not intended by the program creator. To prevent this, leave multiple DO loops with the same D○ variables as in the original source program, write information indicating that the operation should actually be performed in the multiple loops to the masking array W, and mask it in the subsequent multiple DO loops. The element of the data array W is referenced, and definition citation is performed only when the value is "1".

そして、第5図のように変形されたもののうち、2番目
の多重DOループ、第13図および第14図で説明した
のと同様の手法で一重化する。この状態を第6図に示す
。そして、この−重化したD○ループを第10図〜第1
2図で説明したのと同様の手法でベクトル化する。また
、1番目の多重DOループついても、最内側のDo小ル
ープついて第10図〜第12図で説明したのと同様の手
法でベクトル化できる。なお、実際の動作では第4図の
原始プログラムの解析結果に基づいて直接に該当する多
重D○ループ部分の一重化およびベクトル化が行われる
ため、第5図および第6図のような形に変換された状態
が存在するわけではない。
Then, among those modified as shown in FIG. 5, the second multiplex DO loop is unified using the same method as explained in FIGS. 13 and 14. This state is shown in FIG. Then, this -duplicated D○ loop is shown in Figures 10 to 1.
Vectorization is performed using the same method as explained in Figure 2. Further, the first multiple DO loop can also be vectorized using the same method as that described for the innermost Do small loop with reference to FIGS. 10 to 12. In addition, in actual operation, the corresponding multiple D○ loop parts are unified and vectorized based on the analysis results of the source program shown in Figure 4, so the result is as shown in Figures 5 and 6. There is no transformed state.

次に、上記の例につき、第1図の実施例の各手段による
動作を説明する。
Next, the operation of each means of the embodiment shown in FIG. 1 will be explained with respect to the above example.

先ず、原始プログラム1が与えられてコンパイラ2が起
動されると4、構文解析部21は原始プログラム1を読
み込み、構文解析を行って第(中間テキスト24を生成
する。第4図の原始プログラム1に刻しては、第7図に
示すような構成の第1中間テキスト24 (ステップ2
401〜2412)が生成される。
First, when the source program 1 is given and the compiler 2 is activated, the syntax analysis unit 21 reads the source program 1, performs syntax analysis, and generates the intermediate text 24.The source program 1 shown in FIG. The first intermediate text 24 (step 2) having the structure shown in FIG.
401 to 2412) are generated.

次いで、ベクトル化処理部22の構造解析手段221は
第1中間テキスト24を読み込み、ループを認識してそ
の制御の流れを解析する。具体的には次のような処理を
行う。
Next, the structure analysis means 221 of the vectorization processing unit 22 reads the first intermediate text 24, recognizes loops, and analyzes the flow of control. Specifically, the following processing is performed.

■第1中間テキスト24を分岐を単位としたブロックに
分割する。ここで、分岐はループの出口もしくは人口に
相当する。第7図の第1中間テキスト24の場合は、ス
テップ2402.2404.2406で分割される。
(2) Divide the first intermediate text 24 into blocks with branches as units. Here, the branch corresponds to the exit or population of the loop. In the case of the first intermediate text 24 in FIG. 7, it is divided in steps 2402, 2404, and 2406.

■ループ部分を文単位のフ1コックに分割する。■Divide the loop part into sentence units.

■プログラム全体の制御の流れを解析して各ブロックの
関係を求める。
■Analyze the control flow of the entire program and find the relationship between each block.

■各々のブロックで定義引用されている配列および変数
に対して、ブロックへの人出情報を■5 収集する。
■5 Collect information on the number of people going to the block for the arrays and variables whose definitions are cited in each block.

なお、上記の解析結果は第2図に示した多重り。The above analysis results are multiplexed as shown in Figure 2.

ループ情報テーブル4を用いて表現される。例えば、第
7図の第1中間テキスト24の各DOループ情報は第8
図に示すように、多重DOループ報テーブルへのポイン
タ6から始まる多重DOループ報テーブル4.a、4b
、4.cのチェーンおよびその内容として表現される。
It is expressed using loop information table 4. For example, each DO loop information of the first intermediate text 24 in FIG.
As shown in the figure, the multiple DO loop report table 4.4 starts from pointer 6 to the multiple DO loop report table. a, 4b
,4. It is expressed as a chain of c and its contents.

ただし、この時点では第8図中のDOループ重化テーブ
ル5aは付加されていない。
However, at this point, the DO loop overlapping table 5a in FIG. 8 has not been added.

次いで、第1図において、データ依存関係判定手段22
2は解析情報を利用し、ループ中に並列実行に矛盾する
データ依存関係があるか否かを判定する。第4図の原始
プログラムIについて作威された第8図の解析情報から
は、並列実行に矛盾しないものと判定される。
Next, in FIG. 1, the data dependency relationship determining means 22
Step 2 uses analysis information to determine whether there is a data dependency in the loop that is inconsistent with parallel execution. From the analysis information shown in FIG. 8 created for the source program I shown in FIG. 4, it is determined that there is no contradiction in parallel execution.

次いで、多重ループ−重化解析手段223はデータ依存
関係判定手段222によって並列実行に矛盾しないと判
定された部分につき多重ループの一重化が可能か否かを
解析して判定する。具体的6 には次の処理を行う。
Next, the multiple loop/duplication analysis means 223 analyzes and determines whether or not it is possible to unify multiple loops for the portion determined by the data dependency relationship determination means 222 to be compatible with parallel execution. For example 6, perform the following processing.

■D○ループ内で定義引用されている配列・変数に対し
て定義引用関係が全て矛盾していないものを候補として
取り出す。
■D○ For arrays and variables whose definitions are cited in the loop, those whose definition citation relationships are consistent are extracted as candidates.

■その多重Do小ループ対応する多重DOループ報テー
ブル4のD○変数情報47.48゜49より、配列・変
数の定義引用が多重D○ループを通して記憶域上で一つ
の方向性をもつか否かを調べる。第4図の原始プログラ
ム1について作威された第8図の解析情報からは、一つ
の方向性をもつものと判定される。
■ From the D○ variable information 47.48゜49 of the multiple DO loop information table 4 corresponding to the multiple Do small loop, whether or not the array/variable definition quotation has one directionality in the storage area through the multiple D○ loop. Find out. From the analysis information shown in FIG. 8 created for the source program 1 shown in FIG. 4, it is determined that it has one directionality.

■一つの方向性をもつ場合には、多重D○ループを一重
化できると判定し、DOループ重化テーブル5を作成す
る。今の例では、第8図においてDo小ループ重化テー
ブル5aが作威され、チェーニングされる。
(2) If there is one directionality, it is determined that the multiple DO loops can be unified, and a DO loop duplication table 5 is created. In the present example, the Do small loop overlap table 5a is created and chained in FIG.

■DOループー重化テーブル5aが作成された後、その
多重Do小ループ外側のDo小ループD○変数の値が変
化する時に、配列要素の定義引用の記憶域上の位置の増
減の大きさが一定であるか否かを調べる。すなわち、ル
ープ中の配列要素の定義引用が記憶域上で等間隔である
か否かを調べる。第8図の解析情報からは、最外側のD
OループDo変数の増分が「2」であるため、増減の大
きさは一定でないと判定される。
■ After the DO loop-duplication table 5a is created, when the value of the Do small loop D○ variable outside the multiple Do loop changes, the magnitude of the increase/decrease in the storage location of the definition quotation of the array element is Check whether it is constant. That is, it is checked whether the definition references of array elements in the loop are evenly spaced in the storage area. From the analysis information in Figure 8, the outermost D
Since the increment of the O-loop Do variable is "2", it is determined that the magnitude of the increase/decrease is not constant.

■増減の大きさが一定でないと判定された場合、マスク
用配列の領域を確保し、その情報をマスク用配列テーブ
ル(図示せず)として作威し、D○ループ一重化テーブ
ル5にチェ一二ソグする。第8図の解析情報では、DO
ループ重化テーブル5aにマスク用配列テーブルがチェ
一二ソグされる。
■If it is determined that the magnitude of increase/decrease is not constant, secure a mask array area, use that information as a mask array table (not shown), and check the D○ loop unification table 5. Two sogs. In the analysis information in Figure 8, DO
A mask array table is checked into the loop overlapping table 5a.

■マスク用配列テーブルがチェーニングされた場合、−
重化後のD○変数の繰り返し数等の情報をDo小ループ
重化テーブル5に設定する。第8図の解析情報では、−
重化後のDOループ数の繰り返し数はr 1. OO*
 50 *KKJとなる。すなわち、繰り返し数は内側
のD○変数のそれぞれの最大値と最り(イリリのD○変
数の終値とを掛は合わせたものとなる。
■If the mask array table is chained, -
Information such as the number of repetitions of the D○ variable after duplication is set in the Do small loop duplication table 5. In the analysis information in Figure 8, −
The number of repetitions of the DO loop after overlapping is r1. OO*
50 * Becomes KKJ. That is, the number of repetitions is the sum of the maximum value of each inner D○ variable multiplied by the final value of the final D○ variable.

次いで、第1図において、ベクトルテキスト生成手段2
24は多重ループ−重化解析手段223により一重化が
可能と判定された部分およびデータ依存関係判定手段2
22により並列実行に矛盾しないと判定された部分を解
析情報を用いて一重化およびもしくはベクトル化して第
2中間テキスト25を生成する。具体的には次のような
処理を行う。
Next, in FIG. 1, vector text generation means 2
24 is a multiple loop - a portion determined to be possible to be unified by the duplication analysis means 223 and the data dependency relationship determination means 2
The second intermediate text 25 is generated by unifying and/or vectorizing the portion determined by 22 to be consistent with parallel execution using the analysis information. Specifically, the following processing is performed.

■並列実行可能部分をベクトル処理するために必要とな
るベクトル長設定用のテキストを生成する。例えば、第
8図の解析情報からは、通常の並列実行可能部分はなく
、マスク用配列を使うことにより一重化可能な多重DO
ループ1組あることが判明するため、その多重DOルー
プ一重化に必要なベクトル長設定用のテキストとして、
第9図中のステップ2505およびステップ251oに
示すようなテキストを生成する。なお、ステップ250
5はマスク設定用の多重DOループ最内99 側のDOループベクトル化する際に必要となるものであ
り、そのベクトル長はDo変数■の終値であるrl l
となる。ステップ2510は一重化されたDOループベ
クトル化する際に必要となるものであり、そのベクトル
長は一重化後のDOループ繰り返し数であるrloO*
50*KKjとなる。
■Generate text for vector length settings required for vector processing of parts that can be executed in parallel. For example, from the analysis information in Figure 8, there is no part that can be executed in parallel, but multiple DOs that can be unified by using a mask array.
Since it turns out that there is one set of loops, the text for setting the vector length required for unifying the multiple DO loops is as follows:
Text as shown in step 2505 and step 251o in FIG. 9 is generated. Note that step 250
5 is necessary when converting the innermost DO loop for mask setting into a DO loop vector, and the vector length is rl l which is the final value of the Do variable ■.
becomes. Step 2510 is necessary when converting the unified DO loop into a vector, and the vector length is rloO*, which is the number of DO loop repetitions after unification.
It becomes 50*KKj.

■通常の並列実行可能部分に対し、ベクトル処理用のテ
キストを生成する。第8図の解析情報からは通常の並列
実行可能部分はないことが判明するので、この処理は行
わない。
■Generate text for vector processing for normal parallel executable parts. From the analysis information in FIG. 8, it is clear that there is no part that can be executed in parallel, so this process is not performed.

■−一重化可能多重DOループ対し、その処理用のテキ
ストを生成する。マスク用配列を使うことにより一重化
可能な多重DOループある場合、この処理は次のように
行う。
(2) - Generate text for processing of the multiplexable DO loop. When there are multiple DO loops that can be combined by using a masking array, this process is performed as follows.

(alマスク設定用の多重DOループ外側のスカラ命令
による部分のテキストを生成すると共に、マスク用配列
に所定値を代入するテキストを生成する。今の例におい
ては、外側のスカラ命令として、第9図のステップ25
010 〜2504,2507.2508に示すテキストを生成
すると共に、ベクトル化された最内側のD○変数の終値
を保証するためにステップ2509に示すテキストを生
成する。また、マスク用配列に所定値を代入するテキス
トとしてステップ2506に示すテキストを生成する。
(Al Generates the text of the part by the scalar instruction outside the multiple DO loop for setting the mask, and also generates the text for assigning a predetermined value to the mask array. In the present example, as the outer scalar instruction, the 9th Step 25 in the diagram
The text shown in steps 010 to 2504, 2507, and 2508 is generated, and the text shown in step 2509 is generated to guarantee the final value of the vectorized innermost D○ variable. Further, the text shown in step 2506 is generated as the text for substituting a predetermined value into the masking array.

fblマスク用配列配列要素がいくつの時にマスクをオ
ンとするかというマスク情報を設定するためのテキスト
を生成する。今の例においては、第9図のステップ25
1■に示すテキストを生成する。
Generates text for setting mask information indicating how many fbl mask array elements the mask should be turned on. In the current example, step 25 in Figure 9
1) Generate the text shown in ■.

(Clマスクがオンの時に所定の定義引用を行うテキス
トを生成する。今の例においては、第9図のステップ2
512〜2514に示すテキストを生成する。
(When the Cl mask is on, a text is generated that quotes the predetermined definition. In this example, step 2 in Figure 9 is used.
The texts shown in 512-2514 are generated.

■次に、ムク1〜ルテキスト生成手段224は、通常の
並列実行可能部分をベクトル処理するために必要となる
後処理用のテキストを生成する。今の例の場合は該当す
るものがないのでこの処理は行わない。
(2) Next, the text generation means 224 generates text for post-processing, which is necessary for performing vector processing on the part that can be executed in parallel. In the case of the current example, there is no corresponding item, so this process is not performed.

次に、コード生成部23は上記のようにして生成された
第2中間テキスト25を読み込み、対応する機械語のコ
ードによる目的プログラム3を生成する。
Next, the code generation unit 23 reads the second intermediate text 25 generated as described above, and generates the object program 3 using the corresponding machine language code.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、本発明の多重ループベクトル化コ
ンパイル方式にあっては、ループ中に並列実行に矛盾す
るデータ依存関係がないこととループ中の配列要素の定
義引用が記憶域上で一方向であることとが満たされれば
、ループ中の配列要素の定義引用が記憶域上で等間隔で
なくても配列の定義引用の部分をループから出してベク
トル化できるため、多重ループの全体を一重化してベク
トル化する場合と同等とまではいかないが、最も内側の
ループのみをベクトル化する場合に比して大幅な実行時
間短縮の効果が期待できる。
As explained above, in the multiple loop vectorization compilation method of the present invention, there is no data dependency in the loop that contradicts parallel execution, and definition citation of array elements in the loop is unidirectional on the storage area. If the above is satisfied, even if the definition references of array elements in the loop are not evenly spaced in the storage area, the part of the array definition reference can be taken out of the loop and vectorized, so the entire multiple loop can be vectorized. Although it is not equivalent to vectorizing only the innermost loop, a significant reduction in execution time can be expected compared to vectorizing only the innermost loop.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明の多重ループベクトル化コンパイル方式
を適用したコンパイラの一実施例を示す構成図、 第2図はDOループ解析情報の表現に用いる多重DOル
ープ報テーブルの論理的構成図、第3図はDO小ループ
解析情報の表現に用いるDoループ−重化テーブルの論
理的構成図、第4図は多重DOループ含む原始プログラ
ムの例を示す図、 第5図は第4図の原始プログラムを一重化可能な形へ変
換した状態を原始プログラムの形式で示した概念図、 第6図は第5図の原始プログラムの一重化後の状態を原
始プログラムの形式で示した概念図、第7図は第4図の
原始プログラムを構文解析して生成した第1中間テキス
トの構成の概念図(流れ図)、 第8図は第4図の原始プログラム中のDoループの解析
情報の表現の例を示す図、 第9図は第7図の第1中間テキストをベクトル化して生
成した第2中間テキストの構成の概念図、第10図はD
O小ループ含む原始プログラムの3 例を示す図、 第11図は第10図の原始プログラムを構文解析して生
成した第1中間テキストの構成の概念図、第12図は第
11図の第1中間テキストをベクトル化して生成した第
2中間テキストの構成の概念図、 第13図は多重DOループ含む原始プログラムの例を示
す図および、 第14図は第13図の原始プログラムの一重化後の状態
を原始プログラムの形式で示した図である。 図において、 1・・・・・・・・・原始プログラム 2・・・・・・・・・コンパイラ 21・・・・・・構文解析部 22・・・・・・ベクトル化処理部 221・・・構造解析手段 222・・・データ依存関係判定手段 223・・・多重ループ−重化解析手段224・・・ベ
クトルテキスト生成手段4 23・・・・・・コード生底部 24・・・・・・第1中間テキスト 25・・・・・・第2中間テキスト 3・・・・・・・・・目的プログラム 4・・・・・・・・・多重DOループ報テーブル5・・
・・・・・・・D○ループ一重化テーブル6・・・・・
・・・・ポインタ
1 is a block diagram showing an embodiment of a compiler to which the multiple loop vectorization compilation method of the present invention is applied; FIG. 2 is a logical block diagram of a multiple DO loop information table used to express DO loop analysis information; Figure 3 is a logical configuration diagram of the Do loop-duplication table used to express DO small loop analysis information, Figure 4 is a diagram showing an example of a source program that includes multiple DO loops, and Figure 5 is the source program of Figure 4. Figure 6 is a conceptual diagram showing the state of the source program in Figure 5 after being unified in the form of a source program. The figure is a conceptual diagram (flow chart) of the structure of the first intermediate text generated by parsing the source program in Figure 4. Figure 8 is an example of the representation of analysis information of the Do loop in the source program in Figure 4. Figure 9 is a conceptual diagram of the structure of the second intermediate text generated by vectorizing the first intermediate text in Figure 7, and Figure 10 is a
Figure 11 is a conceptual diagram of the structure of the first intermediate text generated by parsing the source program in Figure 10. Figure 12 is the first intermediate text in Figure 11. A conceptual diagram of the structure of the second intermediate text generated by vectorizing the intermediate text, Figure 13 is a diagram showing an example of a source program including multiple DO loops, and Figure 14 is an example of the source program in Figure 13 after being unified. It is a diagram showing the state in the form of a source program. In the figure, 1... Source program 2... Compiler 21... Syntax analysis section 22... Vectorization processing section 221...・Structure analysis means 222...Data dependency determination means 223...Multiple loop-overlapping analysis means 224...Vector text generation means 4 23...Code raw bottom part 24... First intermediate text 25...Second intermediate text 3...Object program 4...Multiple DO loop information table 5...
......D○ loop unification table 6...
...pointer

Claims (2)

【特許請求の範囲】[Claims] (1)高級言語で記述された原始プログラムを読み込み
構文解析を行って第1中間テキストを生成する構文解析
部と、第1中間テキストから原始プログラム中のループ
構造を検出してベクトル化可能部分の認識を行いベクト
ル処理用のテキストを含む第2中間テキストを生成する
ベクトル化処理部と、第2中間テキストから目的プログ
ラムを生成して出力するコード生成部とを有し、ベクト
ル処理プロセッサに対して、与えられた原始プログラム
から目的プログラムを生成して出力するコンパイル方式
において、 前記ベクトル化処理部に、 第1中間テキストから原始プログラムのループ中の制御
の流れを解析する構造解析手段と、ループ中に並列実行
に矛盾するデータ依存関係があるか否かを判定するデー
タ依存関係判定手段と、 並列実行に矛盾しないと判定された部分につき通常のも
しくはマスク使用による多重ループの一重化が可能か否
かを解析して判定する多重ループ一重化解析手段と、 一重化が可能と判定された部分および並列実行に矛盾し
ないと判定された他の部分を一重化およびもしくはベク
トル化して第2中間テキストを生成するベクトルテキス
ト生成手段とを設けたことを特徴とする多重ループベク
トル化コンパイル方式。
(1) A syntactic analysis unit that reads a source program written in a high-level language and performs syntax analysis to generate a first intermediate text, and a syntax analysis unit that detects loop structures in the source program from the first intermediate text and converts them into vectorizable parts. It has a vectorization processing unit that performs recognition and generates a second intermediate text including text for vector processing, and a code generation unit that generates and outputs a target program from the second intermediate text, and has a vectorization processing unit that generates a target program from the second intermediate text and outputs it. , in a compilation method that generates and outputs a target program from a given source program, the vectorization processing unit includes a structure analyzer that analyzes the control flow in a loop of the source program from a first intermediate text, and a structure analyzer that analyzes a flow of control in a loop of the source program from a first intermediate text; A data dependency relationship determining means for determining whether there is a data dependency relationship that is inconsistent with parallel execution, and whether or not it is possible to combine multiple loops normally or by using a mask for the portion determined not to be inconsistent with parallel execution. a multiple loop unification analysis means that analyzes and determines whether unification is possible, and unification and/or vectorization of portions determined to be unification possible and other portions determined to be consistent with parallel execution to generate a second intermediate text. A multi-loop vectorization compilation method characterized by comprising a vector text generation means.
(2)多重DOループ情報テーブルおよびDOループ一
重化テーブルを用いてDOループの解析情報を表現した
ことを特徴とする請求項1記載の多重ループベクトル化
コンパイル方式。
(2) The multiple loop vectorization compilation method according to claim 1, wherein the DO loop analysis information is expressed using a multiple DO loop information table and a DO loop unification table.
JP2016700A 1990-01-26 1990-01-26 Multiple loop vectorization compilation method Pending JPH03220669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016700A JPH03220669A (en) 1990-01-26 1990-01-26 Multiple loop vectorization compilation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016700A JPH03220669A (en) 1990-01-26 1990-01-26 Multiple loop vectorization compilation method

Publications (1)

Publication Number Publication Date
JPH03220669A true JPH03220669A (en) 1991-09-27

Family

ID=11923566

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016700A Pending JPH03220669A (en) 1990-01-26 1990-01-26 Multiple loop vectorization compilation method

Country Status (1)

Country Link
JP (1) JPH03220669A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314897A (en) * 1995-05-23 1996-11-29 Nec Software Ltd Vectorizing processing system of partial array by three pairs of subscripts

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314897A (en) * 1995-05-23 1996-11-29 Nec Software Ltd Vectorizing processing system of partial array by three pairs of subscripts

Similar Documents

Publication Publication Date Title
US5276880A (en) Method for parsing and representing multi-versioned computer programs, for simultaneous and synchronous processing of the plural parses
US5522074A (en) Vectorization system for vectorizing loop containing condition induction variables
Walsh et al. Paragen: a novel technique for the autoparallelisation of sequential programs using gp
JPH03220669A (en) Multiple loop vectorization compilation method
Liu Dependence analysis for recursive data
JP3032030B2 (en) Loop optimization method and apparatus
JP6810380B2 (en) Source program conversion system, source program conversion method, and source program conversion program
Goldberg A variadic extension of Curry's fixed-point combinator
JPH11242598A (en) Compiling method, compiling device, object program executing method, object program executing device, and program storage medium
JPH0425969A (en) Compiling system which is made into definition arrangement vector under if sentence
Ramesh Decompilation of Move Programs to Dataflow Process Networks
JP2801193B2 (en) Vectorization processing device for induction variables
Tracz Parameterization: a case study
Košťál et al. Execution Efficiency of the use of Array and Linked-List Implementations of a Stack Abstract Data Types Containing Complex Numbers in Methods of an Android Application
JPH0795272B2 (en) Compile method
JP2533938B2 (en) Vector arithmetic processing method
JPS6367676A (en) Processing system for vector formation from general loop
JPH05120323A (en) System for optimizing vector calculation under if sentence
JPH08221276A (en) compiler
JP3921722B2 (en) Compiler processing device
JPH02101577A (en) Vectorizing processing system
JPH06290206A (en) Vectorization systen
JPH04295960A (en) Vectorize processing system for compiler
JPH03144830A (en) Parallel processing system
JPH02214974A (en) Vectorization processing system