JPH0497484A - Vectorization processing system for compiler - Google Patents

Vectorization processing system for compiler

Info

Publication number
JPH0497484A
JPH0497484A JP21627890A JP21627890A JPH0497484A JP H0497484 A JPH0497484 A JP H0497484A JP 21627890 A JP21627890 A JP 21627890A JP 21627890 A JP21627890 A JP 21627890A JP H0497484 A JPH0497484 A JP H0497484A
Authority
JP
Japan
Prior art keywords
loop
value
inner loop
vectorization
control variable
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
JP21627890A
Other languages
Japanese (ja)
Inventor
Akiyoshi Endo
明芳 遠藤
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 Corp
Original Assignee
NEC Corp
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 Corp filed Critical NEC Corp
Priority to JP21627890A priority Critical patent/JPH0497484A/en
Publication of JPH0497484A publication Critical patent/JPH0497484A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To perform the vectorization of an outside loop by performing loop switching after replacing the designation of the initial value and the end value of a control variable in an inside loop in a duplex loop by a condition statement. CONSTITUTION:It is recognized that the vectorization of the control variable in the outside loop can be performed though that of the control variable in the inside loop is impossible, and a repeat condition conversion part 6 called by a vectorization part 4 inserts codes to find the minimum value of the initial value and the maximum value of the end value of the control variable in the inside loop first. Thence, the designation of the initial value and the end value in the inside loop are replaced by the minimum value and the maximum value, respectively, and also, the code in the loop is rewritten to an intermediate text by storing in an appropriate condition block. After that, a loop switching part 7 called by the vectorization part 4 performs the switching of the loop on the duplex loop, and generates the intermediate text. Finally, the vectorization part 4 performs the vectorization of the inside loop by using a mask vector, and generates the intermediate text. Thereby, the vectorization of the outside loop can be performed.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、ベクトル演算を実行可能な計算機システムに
おいて、目的プログラムのベクトル化率を高め、実行時
間を短縮するための、コンパイラのベクトル化処理方式
に関するものである。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to vectorization processing of a compiler in order to increase the vectorization rate of a target program and shorten the execution time in a computer system capable of executing vector operations. It is related to the method.

〔従来の技術〕[Conventional technology]

ベクトル演算が実行可能な計算機システムにおいては、
ベクトル演算は、スカラー演算に比べて極めて高速であ
る。このような、いわゆるベクトル計算機の能力を最大
限に引き出すために、プログラムのうちベクトル演算に
より実行される部分の割合、即ちベクトル化率を高める
事が重要な要件となる。このため、ベクトル化を不可と
する要因は、できる限り少ないことが望ましい。
In a computer system that can perform vector operations,
Vector operations are extremely fast compared to scalar operations. In order to maximize the capabilities of such a so-called vector computer, it is an important requirement to increase the proportion of the portion of the program that is executed by vector operations, that is, the vectorization rate. Therefore, it is desirable that the factors that make vectorization impossible are as small as possible.

このような背影からループが2重にネストしているとき
、内側ループの制御変数(FORTRAN言語において
はDo変数等)についてはベクトル化不可であるが、外
側ループの制御変数についてはベクトル北回であるとい
うことが起こりうる。この場合、内側ループと外側ルー
プを入れ替え、入れ替えた後の内側ループをベクトル化
するという方法がよる採られる。
Due to this background, when loops are nested twice, the control variables of the inner loop (such as the Do variable in the FORTRAN language) cannot be vectorized, but the control variables of the outer loop cannot be vectorized. Something can happen. In this case, a method is adopted in which the inner loop and outer loop are swapped and the swapped inner loop is vectorized.

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

ところが、内側ループの制御変数の採りうる値の範囲が
外側ループの繰り返しに依存している場合、入れ替え後
の内側ループの制御変数の初期値・終値が一般には求め
難いため、極く限られた単純な場合を除いてループ入れ
替えはできなかった。
However, if the range of possible values of the inner loop's control variable depends on the repetition of the outer loop, it is generally difficult to determine the initial and final values of the inner loop's control variable after replacement, so the range of possible values is extremely limited. Loop swapping was not possible except in simple cases.

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

本発明の目的は、上記のように、内側ループの制御変数
の値の範囲が、外側ループの繰り返しに依存しているよ
うな2重ループについて、内側ループの制御変数の初期
値・終値の指定を条件文で置き換えた後、ループ入れ替
えを行うことにより、外側ループをベクトル化すること
を目的とする。
As described above, an object of the present invention is to specify the initial value and final value of the control variable of the inner loop for a double loop in which the value range of the control variable of the inner loop depends on the repetition of the outer loop. The purpose is to vectorize the outer loop by replacing it with a conditional statement and then swapping the loop.

上記の目的を達成するため、本発明におけるコンパイラ
のベクトル化処理方式は、プログラム中に存在する各ル
ープについて変数、配列の定義引用関係を解析し、ベク
トル化された目的プロクラムを生成するコンパイラにお
いて、前記ループが2重にストしており、定義・引用関
係上内側ループの制御変数についてはベクトル化不可、
外側ループの制御変数についてはベクトル北回てあって
、内側ループの制御変数の初期値と終値か外側ループの
繰り返しに依存している場合に、■内側ループの制御変
数の、初期値の最小値〈たたし内側ループの制御変数が
減少する場合は最大値)及び終値の最大値(ただし内側
ループの制御変数が減少する場合には最小値以下同じ)
を求めるコードを2重ループの直前に挿入する手段と、
■内側ループの制御変数の初期値・終値を上記最小値、
最大値で置き換える手段と、 ■内側ループの制御変数が本来の初期値・終値の範囲内
にあるときのみ実行される条件ブロック内に内側ループ
内部のコード全体を納めるための条件文を挿入する手段
と、 ■内側ループと外側ループを入れ替える手段とを備え、
当該2重ループをループ入れ替えによりベクトル化する
ことを特徴としている。
In order to achieve the above object, the vectorization processing method of the compiler in the present invention analyzes the definition citation relationships of variables and arrays for each loop existing in the program, and generates a vectorized target program. The above loop runs twice, and the control variables of the inner loop cannot be vectorized due to definition/quotation.
For the control variable of the outer loop, if the vector is north, and the initial value and final value of the control variable of the inner loop depend on the repetition of the outer loop, ■ the minimum value of the initial value of the control variable of the inner loop. (If the control variable of the inner loop decreases, the maximum value) and the maximum value of the final value (However, if the control variable of the inner loop decreases, the minimum value or less is the same)
A means of inserting the code that asks for just before the double loop,
■Set the initial and final values of the control variables of the inner loop to the above minimum values,
A means of replacing it with the maximum value, and a means of inserting a conditional statement to store the entire code inside the inner loop in a conditional block that is executed only when the control variable of the inner loop is within the range of the original initial value and final value. and ■ a means for exchanging the inner loop and the outer loop,
The feature is that the double loop is vectorized by loop swapping.

〔実施例〕〔Example〕

以下、図面を参照しつつ説明する。 This will be explained below with reference to the drawings.

第1図は、本発明における一実施例を示すブロック図で
ある。図中、1はコンパイラ、2はコンパイラの制御部
、3は構文解析部、4はベクトル化部、5は目的プログ
ラム生成部、6は繰り返し条件変換部、7はループ入れ
替え部、8はソースプログラム、9は目的プログラムを
それぞれ示す。
FIG. 1 is a block diagram showing one embodiment of the present invention. In the figure, 1 is the compiler, 2 is the compiler control unit, 3 is the syntax analysis unit, 4 is the vectorization unit, 5 is the target program generation unit, 6 is the repetition condition conversion unit, 7 is the loop replacement unit, and 8 is the source program , 9 indicate the target programs, respectively.

構文解析部3は、ソースプログラム8を読み込み、構文
解析を行って中間テキストを生成する。
The syntax analysis unit 3 reads the source program 8, performs syntax analysis, and generates intermediate text.

ベクトル化部4は、中間テキスト中の各ループに対して
、ベクトル化可能性を判定し、ベクトル化可能なループ
についてはその部分をベクトル化された中間テキストに
書き換える。目的プログラム生成部5は、中間テキスト
から目的プログラムを生成する。
The vectorization unit 4 determines the possibility of vectorization for each loop in the intermediate text, and for loops that can be vectorized, rewrites that portion into vectorized intermediate text. The target program generation unit 5 generates a target program from the intermediate text.

一例として、ソースプログラム中に第2図のようなルー
プが存在した場合を考える。
As an example, consider a case where a loop as shown in FIG. 2 exists in a source program.

構文解析部3は、第3図のような中間テキストを生成す
る。ベクトル化部4は、まずループ内の配列Aの定義・
引用関係を解析する。その結果、内側ループの制御変数
Jについてはベクトル化不可であるが、外側ループの制
御変数Iについてはベクトル北回であることを見い出す
The syntax analysis unit 3 generates intermediate text as shown in FIG. The vectorization unit 4 first defines the array A in the loop.
Analyze citation relationships. As a result, it is found that the control variable J of the inner loop cannot be vectorized, but the control variable I of the outer loop is vectorized.

次にベクトル化部4は、繰り返し条件変換部6を呼び出
す。繰り返し条件変換部6は、まず内側ループの制御変
数の、初期値の最小値と終値の最大値を求めるコートを
挿入する。次に内側ループの初期値・終値の指定を、そ
れぞれ上記の最小値、最大値で置き換えるとともに、ル
ープ内のコードを適当な条件ブロック内におさめて、第
4図のような中間テキストに書き換える。
Next, the vectorization unit 4 calls the repetition condition conversion unit 6. The repetition condition conversion unit 6 first inserts a code for finding the minimum initial value and maximum final value of the control variables of the inner loop. Next, the initial value and final value specifications of the inner loop are replaced with the above minimum and maximum values, respectively, and the code within the loop is placed in an appropriate condition block and rewritten into intermediate text as shown in Figure 4.

次にベクトル化部4は、ループ入れ替え部7を呼び出す
。ループ入れ替え部7は、第4図の2重ループに対し、
ループ入れ替えを行って第5図のような中間テキストを
生成する。
Next, the vectorization unit 4 calls the loop replacement unit 7. For the double loop in FIG. 4, the loop switching unit 7
Intermediate text as shown in FIG. 5 is generated by performing loop replacement.

最後にベクトル化部4は、第5図の内側ループをマスク
ベクトルを用いてベクトル化し、第6図の中間テキスト
を生成する。
Finally, the vectorization unit 4 vectorizes the inner loop shown in FIG. 5 using a mask vector to generate the intermediate text shown in FIG. 6.

なお本発明は、3重以上のループにおける最内側の2重
ループ及び3重以上のループに対して適当なループ入れ
替えを行った後の最内側の2重ループに対して上記機能
をもつコンパイラのベクトル化処理方式も含むことは言
うまでもない。
The present invention provides a compiler with the above function for the innermost double loop in triple or more loops and the innermost double loop after appropriate loop replacement for triple or more loops. Needless to say, it also includes a vectorization processing method.

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

以上説明した通り、本発明のベクトル化処理方式により
、従来のコンパイラではベクトル化されなかったループ
かベクトル化されるので目的プロクラムの実行時間か短
縮されるという効果がある。
As explained above, the vectorization processing method of the present invention vectorizes loops that were not vectorized by conventional compilers, thereby reducing the execution time of the target program.

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

第1図は本発明の一実施例を示すブロック図、第2図は
本発明の一実施例の動作説明に用いるソースコードの一
例を示す図、第3図、第4図、第5図、第6図は本発明
の一実施例の動作説明に用いる中間テキストの一例を示
す図である。 1はコンパイラ、2は制御部、3は構文解析部、4はベ
クトル化部、5は目的プログラム生成部、6は繰り返し
条件変換部、7はループ入れ替え部、8はソースプログ
ラム、9は目的プログラムである。
FIG. 1 is a block diagram showing an embodiment of the present invention, FIG. 2 is a diagram showing an example of source code used to explain the operation of the embodiment of the present invention, FIGS. 3, 4, 5, FIG. 6 is a diagram showing an example of intermediate text used to explain the operation of an embodiment of the present invention. 1 is a compiler, 2 is a control unit, 3 is a syntax analysis unit, 4 is a vectorization unit, 5 is a target program generation unit, 6 is a repetition condition conversion unit, 7 is a loop replacement unit, 8 is a source program, and 9 is a target program It is.

Claims (1)

【特許請求の範囲】[Claims] 高級言語によるプログラム中に存在する各ループについ
て変数、配列の定義・引用関係を解析し、ベクトル化さ
れた目的プログラムを生成するコンパイラのベクトル化
処理方式において、前記ループが2重にネストしており
、定義・引用関係上内側ループの制御変数についてはベ
クトル化不可、外側ループの制御変数についてはベクト
ル化可であって、内側ループの制御変数の初期値と終値
が外側ループの繰り返しに依存している場合に、内側ル
ープの制御変数の、初期値の最小値(ただし内側ループ
の制御変数が減少する場合は最大値)及び終値の最大値
(ただし内側ループの制御変数が減少する場合には最小
値以下同じ)を求めるコードを2重ループの直前に挿入
する手段と、内側ループの制御変数の初期値・終値を上
記最小値、最大値で置き換える手段と、内側ループの制
御変数が本来の初期値・終値の範囲内にあるときのみ実
行される条件ブロック内に内側ループ内部のコード全体
を納めるための条件文を挿入する手段と、内側ループと
外側ループを入れ替える手段とを備え、当該2重ループ
をループ入れ替えによりベクトル化することを特徴とす
るコンパイラのベクトル化処理方式。
In the compiler's vectorization processing method, which analyzes the definitions and citation relationships of variables and arrays for each loop that exists in a program written in a high-level language and generates a vectorized target program, the loops are nested twice. , due to definitions and citations, the control variables of the inner loop cannot be vectorized, but the control variables of the outer loop can be vectorized, and the initial and final values of the control variables of the inner loop depend on the iterations of the outer loop. , the minimum initial value (however, the maximum value if the control variable of the inner loop decreases) and the maximum value of the final value (however, the minimum value if the control variable of the inner loop decreases) of the control variable of the inner loop. A method for inserting a code that calculates the value (the same value and below) immediately before the double loop, a means for replacing the initial value and final value of the control variable of the inner loop with the above minimum and maximum values, and a means for replacing the control variable of the inner loop with the original initial value. A means for inserting a conditional statement for storing the entire code inside the inner loop in a conditional block that is executed only when the value/end value is within the range, and a means for exchanging the inner loop and the outer loop. A compiler vectorization processing method characterized by vectorizing loops by exchanging them.
JP21627890A 1990-08-16 1990-08-16 Vectorization processing system for compiler Pending JPH0497484A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP21627890A JPH0497484A (en) 1990-08-16 1990-08-16 Vectorization processing system for compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP21627890A JPH0497484A (en) 1990-08-16 1990-08-16 Vectorization processing system for compiler

Publications (1)

Publication Number Publication Date
JPH0497484A true JPH0497484A (en) 1992-03-30

Family

ID=16686030

Family Applications (1)

Application Number Title Priority Date Filing Date
JP21627890A Pending JPH0497484A (en) 1990-08-16 1990-08-16 Vectorization processing system for compiler

Country Status (1)

Country Link
JP (1) JPH0497484A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017086391A1 (en) * 2015-11-20 2017-05-26 日本電気株式会社 Vectorization device, vectorization method, and recording medium on which vectorization program is stored

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017086391A1 (en) * 2015-11-20 2017-05-26 日本電気株式会社 Vectorization device, vectorization method, and recording medium on which vectorization program is stored
US10572233B2 (en) 2015-11-20 2020-02-25 Nec Corporation Vectorization device, vectorization method, and recording medium on which vectorization program is stored

Similar Documents

Publication Publication Date Title
US4833606A (en) Compiling method for vectorizing multiple do-loops in source program
JP2001166949A (en) Method and device for compiling source code by using symbolic execution
US5067068A (en) Method for converting an iterative loop of a source program into parellelly executable object program portions
US5522074A (en) Vectorization system for vectorizing loop containing condition induction variables
JPH0497484A (en) Vectorization processing system for compiler
Yuki et al. Derivation of efficient FSM from loop nests
JP4985461B2 (en) Compiler, compiling method, and program
DONGEN Compiling distributed loops onto SPMD code
JP2801193B2 (en) Vectorization processing device for induction variables
US5437035A (en) Method and apparatus for compiling a program incending a do-statement
JPS63155264A (en) Language tuning processing system for vector computer
JPH04220727A (en) Vectorization processing system
JPH04295960A (en) Vectorize processing system for compiler
McFarlin et al. Library function selection in compiling Octave
JP2019012324A (en) compiler
JP2674489B2 (en) Vectorization processor
Wolfe Experiences with data dependence and loop restructuring in the tiny research tool
JPH0795272B2 (en) Compile method
JPH03220669A (en) Multiple loop vectorization compiling system
JPH02253472A (en) Vectorizing system
JPS6358574A (en) Vector transformation processing system
JPH0425969A (en) Compiling system which is made into definition arrangement vector under if sentence
JPH10326193A (en) Compile method for optimizing inline expansion function
JPH08272777A (en) Vectorization processing system for infinite loop
JPH04332044A (en) Vectorization processing system for compiler