JP3953697B2 - Compiler and recording medium - Google Patents
Compiler and recording medium Download PDFInfo
- Publication number
- JP3953697B2 JP3953697B2 JP37183499A JP37183499A JP3953697B2 JP 3953697 B2 JP3953697 B2 JP 3953697B2 JP 37183499 A JP37183499 A JP 37183499A JP 37183499 A JP37183499 A JP 37183499A JP 3953697 B2 JP3953697 B2 JP 3953697B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- expansions
- loop
- registers
- virtual
- 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
Images
Description
【0001】
【発明の属する技術分野】
本発明は、ソースプログラムのベクトル化時に展開数の最適化を行うコンパイラおよび記録媒体に関するものである。
【0002】
【従来の技術】
従来、ソースプログラムをベクトル化する場合に、ループの繰り返し回数を減らして高速化を図るアンローリング処理が行われている。この従来のアンローリング処理における展開数は下記のようにして決めていた。
【0003】
(1) コンパイラディレクティブに指定された展開数とする。
(2) 外側ループの繰り返し回数が陽に判る場合には、その値を展開数とする。
【0004】
(3) 上記以外で、展開後の命令数が許容範囲(例えばレジスタ不足にならない範囲)を越えなければn重展開とする。
【0005】
【発明が解決しようとする課題】
上記従来の展開数では、演算数が多い場合は良いが、演算数が少ないループではレジスタを有効に使わないオブジェクトが生成されてしまうという問題があった。
【0006】
また、アンローリング数の増加によりオブジェクト量が多量になってしまう危険性を持つという問題もあった。
本発明は、これらの問題を解決するため、ソースプログラムをベクトル化するときにループの繰り返し回数などをもとに最適化したアンローリング処理を行うと共に重複するメモリアクセスを削除し、オブジェクトプログラムの実行性能の向上を図ることを目的としている。
【0007】
【課題を解決するための手段】
図1を参照して課題を解決するための手段を説明する。
図1において、ソースプログラム1は、ベクトル化する際に展開数の最適化を行う対象のプログラムである。
【0008】
コンパイラ2は、ソースプログラム1を入力とし、実行可能形式のオブジェクトプログラム10を生成するものであって、ここでは、最適化手段4などから構成されるものである。
【0009】
最適化手段4は、ソースプログラム1をベクトル化して最適化を行うものであって、ここでは、ベクトル化手段5、およびベクトル最適化手段6などから構成されるものである。
【0010】
ベクトル最適化手段6は、ベクトル化する際に展開数の最適化を行うものであって、ここでは、アンローリング手段7およびメモリアクセス削除手段8などから構成されるものである。
【0011】
アンローリング手段7は、ベクトル化する際に最適な展開数で展開したりなどするものである。
メモリアクセス削除手段8は、最適な展開数で展開した後の重複するメモリアクセスをレジスタ間転送命令に変更し、削除するものである。
【0012】
次に、動作を説明する。
ベクトル化手段5がソースプログラム1をベクトル化し、アンローリング手段7がソースプログラム1を解析して検出されたループの繰り返し回数から求めたレジスタ個数および演算に必要な最大レジスタ数をもとに仮想展開数を算出し、算出した仮想展開数について、ベクトル化されたプログラムのデータ依存関係をもとに展開数を算出して展開し、メモリアクセス削除手段8が展開後のベクトル命令列から重複するメモリアクセス命令がある場合にレジスタ間移動命令に変更するようにしている。
【0013】
また、ベクトル化手段5がソースプログラム1をベクトル化し、アンローリング手段7がソースプログラムを解析して検出されたループの繰り返し回数が不明の場合に、ループで使用している配列のベクトル次元から求めたレジスタ個数および演算に必要な最大レジスタ数をもとに仮想展開数を算出し、算出した仮想展開数についてベクトル化されたプログラムのデータ依存関係をもとに展開数を算出し、算出した展開数をもとにベクトル化されたプログラムを展開し、メモリアクセス削除手段8が展開後のベクトル命令列から重複するメモリアクセス命令がある場合にレジスタ間移動命令に変更するようにしている。
【0014】
これらの際に、デフォルトで展開数の最大値を設定しておき、最大値を越えない範囲内で展開数を算出するようにしている。
従って、ソースプログラム1をベクトル化するときにループの繰り返し回数などをもとに最適化したアンローリング処理を行うと共に重複するメモリアクセスを削除することにより、オブジェクトプログラム10の実行性能の向上を図ることが可能となる。
【0015】
【発明の実施の形態】
次に、図1から図4を用いて本発明の実施の形態および動作を順次詳細に説明する。
【0016】
図1は、本発明のシステム構成図を示す。
図1において、ソースプログラム1は、ベクトル化する際に展開数の最適化を行う対象のプログラムであって、例えば後述する図4の(a)に示すような、ループの存在するプログラムである。
【0017】
コンパイラ2は、ソースプログラム1を入力とし、実行可能形式のオブジェクトプログラム10を生成するものであって、ここでは、ソースプログラム解析手段3、最適化手段4、およびコード生成手段9などから構成されるものである。
【0018】
ソースプログラム解析手段3は、ソースプログラム1を形態素解析、構文解析などを行い、中間言を生成するものである。ここで、実際は、形態素解析および構文解析などを行った情報を付加した中間言をもとに以降説明するベクトル化、アンローリング処理などを行うが、説明を分かり易くするために、ソースプログラム1をベクトル化、アンローリング処理するなどとして説明を行う。
【0019】
最適化手段4は、ソースプログラム1の最適化を行うものであって、ここでは、ベクトル化手段5、およびベクトル最適化手段6などから構成されるものである。
【0020】
ベクトル化手段5は、ソースプログラム1をベクトル化するものであって、例えば後述する図3の(a)のソースプログラム1を(b)に示すプログラム(ベクトル計算機で動作するベクトル命令を使ったプログラム)にするものである。
【0021】
ベクトル最適化手段6は、ベクトル化されたプログラムを最適化するものであって、ここでは、アンローリング手段7およびメモリアクセス削除手段8などから構成されるものである。
【0022】
アンローリング手段7は、ベクトル化されたプログラムについて、最適な展開数で展開してループの繰り返し回数を削減したりなどするものである。
メモリアクセス削除手段8は、最適な展開数で展開した後のプログラム中で重複するメモリアクセスをレジスタ間転送命令に変更し、削除したりするものである。
【0023】
コード生成手段9は、最適化後のプログラムを、実行可能形式のオブジェクトプログラム10にするものである。
次に、図2のフローチャートの順番に従い、図1の構成の動作を詳細に説明する。
【0024】
図2は、本発明の動作説明フローチャートを示す。
図2において、S1は、コンパイラディレクティブ指定があるか判別する。YESの場合には、その指定に従いS6以降の処理に進む。一方、NOの場合には、S2に進む。
【0025】
S2は、ループの繰り返し回数が不明か判別する。これは、ソースプログラム1のループの回数が不明、例えば後述する図3の(a)のソースプログラム1ではループの回数が判明と判別し、図4の(a)のソースプログラム1ではループの回数が不明と判別する。YESの場合には、S3に進む。NOの場合には、S9に進む。
【0026】
S9は、S2のNOでループの繰り返し回数が不明でないと判別されたので、
仮想展開数=(ループ内の繰り返し回数から見積もったレジスタ個数)/(必要なレジスタ数の最大値)
を求める。例えば後述する図3の(b)のベクトル化した後のプログラムにおいて、当該プログラムの場合には(ループ内の繰り返し回数から見積もったレジスタ個数)=256、必要なレジスタ数の最大値=1であるので、仮想展開数=256となるが、実行させるベクトル計算機の各種性能を考慮してデフォルトで最大が例えば4と設定されているので、仮想展開数を4と決定する。
【0027】
S10は、メモリアクセスの削除が可能か判別する。これは、例えば後述する図3の(c−1)に示すように、展開(この場合には4重展開)した場合に重複するメモリアクセスがあって当該メモリアクセスを削除して変りにレジスタ間移動命令で置き換えることが可能か判別する。YESの場合には、S11に進む。一方,NOの場合には、S6に進む。
【0028】
S11は、S10のYESでメモリアクセス削除可能と判明したので、正式展開数を、データ依存関係を見て補正する。例えば後述する図3の(b)のベクトル化したプログラムの場合には、2重展開からメモリアクセス命令の削除が可能であるので、S9で決めた仮想展開数4をそのまま正式展開数として決定する。そして、S6に進む。
【0029】
S6は、ループアンローリングの展開処理を行う。これは、S9で決定した正式展開数、ここでは4をもとに、例えば図3の(b)を図3の(c−1)に示すように4重展開する。
【0030】
S7は、メモリアクセスの削除が可能か判別する。YESの場合には、S8に進む。NOの場合には、終了する。
S8は、S7のYESでメモリアクセスの削除が可能と判明したので、メモリアクセスの削除処理を行う。例えば図3の(c−1)の4重展開した後のプログラム中の重複するメモリアクセスをレジスタ間移動命令(例えばVMOVE命令)に置き換え、重複するメモリアクセスを削除し、図3の(c−2)に示すプログラムに修正する。
【0031】
以上のS1のNO,S2のNO,S9からS11、S6からS8の手順によって、プログラムのループの繰り返し回数が判明する場合に、内部のループについて多重展開を行ってループの繰り返し回数を削減および重複したメモリアクセスをVMOVE命令に置き換えてメモリアクセスを必要最小限とし、オブジェクトプログラム10の実行性能を向上させることが可能となる。
【0032】
次に、ループの繰り返し回数が不明の場合について以下説明する。
図2において、S3は、S2のYESでループの繰り返し回数が不明と判明したので、
仮想展開数=(ループ内で使用している配列のベクトル次元の添字に現れた要素数から見積もったレジスタ個数)/(必要なレジスタ数の最大値)
を求める。例えば後述する図4の(b)のベクトル化した後のプログラムにおいて、当該プログラムの場合には(ループ内の繰り返し回数から見積もったレジスタ個数)=256、(必要なレジスタ数の最大値)=1.3であるので、仮想展開数=256/1.3=196と決定する。
【0033】
S4は、データ依存関係から最大展開数を見積もる。例えば図4の(b)のプログラムの場合には、2重展開以上してもメモリアクセスの削除は見込めないので、最大展開数=2と決定する。
【0034】
S5は、正式展開数が最大展開数を越えない範囲で決定する。ここでは、例えば図4の(b)の場合には、上記したように、最大展開数=2であるので、これを越えない正式展開数を2と決定する。
【0035】
S6は、ループアンローリングの展開処理を行う。これは、S5で決定した正式展開数、ここでは2をもとに、例えば図4の(b)を図4の(c)に示すように2重展開する。
【0036】
S7は、メモリアクセスの削除が可能か判別する。YESの場合には、S8に進む。NOの場合には、終了する。
S8は、S7のYESでメモリアクセスの削除が可能と判明したので、メモリアクセスの削除処理を行う。
【0037】
以上のS1のNO,S2のYES,S3からS8の手順によって、プログラムのループの繰り返し回数が不明の場合に、内部のループで使用している配列のベクトル次元の添字に現れる要素数、必要なレジスタ数の最大値などをもとに展開数を決定して多重展開を行い、ループの繰り返し回数を削減および重複したメモリアクセスをVMOVE命令に置き換えてメモリアクセスを必要最小限とし、オブジェクトプログラム10の実行性能を向上させることが可能となる。
【0038】
図3は、本発明の説明図(その1、ループの繰り返し回数判明)を示す。ここでは、ループの繰り返し回数が判明するプログラムについて以下説明する。
図3の(a)は、ソースプログラム1の例を示す。このソースプログラム1は、図示のように、2重ループからなるプログラムである。
【0039】
図3の(b)は、アンローリング展開前のプログラムの例を示す。これは、図3の(a)のソースプログラム1をベクトル化した後のプログラムであって、図示のように、アンローリング展開前の1重展開したものである。
【0040】
図3の(c)は、アンローリング展開後のプログラムを示す。ここでは、図3の(b)のアンローリング展開前のプログラムを、4重展開して(c−1)のプログラムを作成し、次に、(c−1)のプログラム中の重複したメモリアクセス命令を削除してレジスタ間移動命令(VMOVE命令)に置き換えてメモリセスを必要最小限に削減して(c−2)のプログラムを作成する。
【0041】
図3の(c−1)は、図3の(b)のプログラムを4重展開(既述した図2のS3からS5で決定した展開数4)したプログラムの例を示す。尚、4重展開の場合には、ループの繰り返しに対して4で割った余りの処理に関しては、別のループを生成している(図3の(c−1)の末尾のDOループ参照)。ここでは、図示したように、3つの重複したメモリアクセスが存在するので、これら重複するメモリアクセスを削除し、変わりにVMOVE命令に置き換えて図3の(c−2)に示すプログラムとし、実行性能を向上させている。
【0042】
図3の(c−2)は、メモリアクセスを削除した場合のプログラムの例を示す。これは、図3の(c−1)のプログラム中の重複するメモリアクセスの一方を削除し他方はVMOVE命令でレジスタ間転送して処理を行うように修正したものである。
【0043】
尚、図3のプログラムの場合の展開数の決定について説明する。
図3の(a)のプログラムはループの繰り返し回数が判明し、ループの繰り返し回数から見積もったレジスタ個数がここでは256となり、必要なレジスタ数の最大値が1となるので、仮想展開数=256/1=256となるが、デフォルトで通常最大仮想展開数=4と設定しているので、仮想展開数=4と決定する。次に、メモリアクセスの削除が可能かの観点より、データ依存関係を見ると、2重展開からメモリアクセスの削除が可能と判明するので、正式展開数をそのまま4と決定する。決定された4重展開する場合には、4で割り切れる部分を図3の(c−1)の上段のループ(4重展開のループ)とし、余りの部分を図3の(c−1)の下段のループ(1重展開のままのループ)とする。更に、重複するメモリアクセスをレジスタ間移動命令(VMOVE命令)に置き換えると図3の(c−2)のプログラムを生成することが可能となる。
【0044】
図4は、本発明の説明図(その2、ループの繰り返し回数不明)を示す。ここでは、ループの繰り返し回数が不明なプログラムについて以下説明する。
図4の(a)は、ソースプログラム1の例を示す。このソースプログラム1は、図示のように、2重ループからなるプログラムである。
【0045】
図4の(b)は、アンローリング展開前のプログラムの例を示す。これは、図4の(a)のソースプログラム1をベクトル化した後のプログラムであって、図示のように、アンローリング展開前の1重展開したものである。
【0046】
図4の(c)は、アンローリング展開後のプログラムを示す。ここでは、図4の(b)のアンローリング展開前のプログラムを2重展開して作成する。
尚、図4のプログラムの場合の展開数の決定について説明する。
【0047】
図4の(a)のプログラムはループの繰り返し回数が不明であるので、ループ内で使用している配列のベクトル次元の添字に現れた要素数から見積もったレジスタ個数がここでは256となり、必要なレジスタ数の最大値が1.3となるので、仮想展開数=256/1.3=196となる。データの依存関係から最大展開数を見積もると、2展開以上してもメモリアクセスの削除が見込めないので最大展開数を2と決定する。正式展開数は最大展開数を越えない範囲で決まるので、この場合には正式展開数が2と決定され、図4の(c)のプログラムに示すように、2重展開する。
【0048】
【発明の効果】
以上説明したように、本発明によれば、ソースプログラム1をベクトル化するときにループの繰り返し回数などをもとに最適化したアンローリング処理を行うと共に重複するメモリアクセスを削除する構成を採用しているため、オブジェクトプログラム10の実行性能の向上を図ることができる。
【図面の簡単な説明】
【図1】本発明のシステム構成図である。
【図2】本発明の動作説明フローチャートである。
【図3】本発明の説明図(その1)である。
【図4】本発明の説明図(その2)である。
【符号の説明】
1:ソースプログラム
2:コンパイラ
3:ソースプログラム解析手段
4:最適化手段
5:ベクトル化手段
6:ベクトル最適化手段
7:アンローリング手段
8:メモリアクセス削除手段
9:コード生成手段
10:オブジェクトプログラム[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a compiler and a recording medium for optimizing the number of expansions when a source program is vectorized.
[0002]
[Prior art]
Conventionally, when a source program is vectorized, an unrolling process has been performed to increase the speed by reducing the number of loop iterations. The number of developments in this conventional unrolling process was determined as follows.
[0003]
(1) The number of expansions specified in the compiler directive.
(2) If the number of iterations of the outer loop is clearly known, that value is taken as the number of expansions.
[0004]
(3) In addition to the above, if the number of instructions after expansion does not exceed an allowable range (for example, a range where there is no register shortage), n-fold expansion is performed.
[0005]
[Problems to be solved by the invention]
With the above conventional number of expansions, it is good if the number of operations is large, but there is a problem that an object that does not use registers effectively is generated in a loop with a small number of operations.
[0006]
There is also a problem that there is a risk that the amount of objects becomes large due to an increase in the number of unrolling.
In order to solve these problems, the present invention performs an unrolling process optimized based on the number of loop iterations when vectorizing a source program, deletes duplicate memory accesses, and executes an object program. The purpose is to improve performance.
[0007]
[Means for Solving the Problems]
Means for solving the problem will be described with reference to FIG.
In FIG. 1, a
[0008]
The
[0009]
The
[0010]
The vector optimizing means 6 optimizes the number of expansions when vectorizing. Here, the vector optimizing means 6 comprises an unrolling means 7 and a memory access deleting means 8.
[0011]
The unrolling means 7 expands with the optimal number of expansions when vectorizing.
The memory access deleting means 8 changes the overlapping memory access after the expansion with the optimum expansion number into an inter-register transfer instruction and deletes it.
[0012]
Next, the operation will be described.
The vectorizing means 5 vectorizes the
[0013]
Further, when the vectorization means 5 vectorizes the
[0014]
At these times, the maximum number of expansions is set by default, and the number of expansions is calculated within a range not exceeding the maximum value.
Therefore, the execution performance of the
[0015]
DETAILED DESCRIPTION OF THE INVENTION
Next, embodiments and operations of the present invention will be described in detail sequentially with reference to FIGS.
[0016]
FIG. 1 shows a system configuration diagram of the present invention.
In FIG. 1, a
[0017]
The
[0018]
The source program analysis means 3 performs morphological analysis, syntax analysis, etc. on the
[0019]
The
[0020]
The vectorization means 5 vectorizes the
[0021]
The vector optimizing means 6 optimizes the vectorized program, and here is composed of an unrolling means 7 and a memory access deleting means 8.
[0022]
The unrolling means 7 expands the vectorized program with the optimal number of expansions to reduce the number of loop iterations.
The memory access deleting means 8 changes a memory access that is duplicated in a program after being developed with the optimum number of expansions into an inter-register transfer instruction and deletes it.
[0023]
The code generation means 9 converts the optimized program into an
Next, the operation of the configuration of FIG. 1 will be described in detail according to the order of the flowchart of FIG.
[0024]
FIG. 2 shows a flowchart for explaining the operation of the present invention.
In FIG. 2, S1 determines whether there is a compiler directive designation. In the case of YES, the process proceeds to the processing after S 6 in accordance with the specification. On the other hand, if NO, the process proceeds to S2.
[0025]
In S2, it is determined whether the number of loop repetitions is unknown. This is because the number of loops of the
[0026]
S 9, since the number of iterations of the loop is determined not unknown in S2 NO, the
Number of virtual expansions = (number of registers estimated from the number of iterations in the loop) / (maximum number of necessary registers)
Ask for. For example, in the program after vectorization of FIG. 3B described later, in the case of the program, (the number of registers estimated from the number of repetitions in the loop) = 256, and the maximum number of necessary registers = 1. Therefore, although the number of virtual deployments is 256, the maximum number of virtual deployments is determined to be 4 because the maximum is set to 4 by default in consideration of various performances of the vector computer to be executed.
[0027]
[0028]
S 11, since proved to memory accessible delete YES in
[0029]
S 6 performs the expansion process of the loop unrolling. This is formally expanded number determined in S 9, where on the basis of 4, for example, in FIG. 3 (b) deploying quadruple as shown in the FIG. 3 (c-1).
[0030]
S 7, the deletion of the memory access is possible or not. In the case of YES, the process proceeds to S 8. If NO, the process ends.
S 8 since proved possible to remove the memory access by a YES S 7, and delete processing of the memory access. For example, the overlapping memory access in the program after quadruple expansion of (c-1) in FIG. 3 is replaced with an inter-register movement instruction (for example, VMOVE instruction), the overlapping memory access is deleted, and (c− Modify the program shown in 2).
[0031]
By the procedure of S 8 from S 11, S 6 from NO, S 9 of the above S1 of NO, S2, if the number of iterations of the loop of the program is found, the number of iterations of the loop performing multiple developed for inner loop It is possible to improve the execution performance of the
[0032]
Next, a case where the number of loop repetitions is unknown will be described below.
In FIG. 2,
Number of virtual expansions = (number of registers estimated from the number of elements appearing in the vector dimension subscript of the array used in the loop) / (maximum number of necessary registers)
Ask for. For example, in the program after vectorization of FIG. 4B described later, in the case of the program, (the number of registers estimated from the number of repetitions in the loop) = 256, (the maximum value of the necessary number of registers) = 1. .3, it is determined that the number of virtual deployments = 256 / 1.3 = 196.
[0033]
[0034]
[0035]
S 6 performs the expansion process of the loop unrolling. This,
[0036]
S 7, the deletion of the memory access is possible or not. In the case of YES, the process proceeds to S 8. If NO, the process ends.
S 8 since proved possible to remove the memory access by a YES S 7, and delete processing of the memory access.
[0037]
More S1 of NO, S2 YES of, by the procedure of S 8 from
[0038]
FIG. 3 is an explanatory diagram of the present invention (
FIG. 3A shows an example of the
[0039]
FIG. 3B shows an example of a program before unrolling development. This is a program after vectorizing the
[0040]
FIG. 3C shows a program after unrolling development. Here, the program before unrolling expansion in FIG. 3B is quadruple expanded to create the program of (c-1), and then the duplicate memory access in the program of (c-1) The instruction is deleted and replaced with a register-to-register move instruction (VMOVE instruction) to reduce the memory access to the minimum necessary, and the program (c-2) is created.
[0041]
(C-1) in FIG. 3 shows an example of a program in which the program in FIG. 3 (b) is expanded four times (the number of
[0042]
(C-2) in FIG. 3 shows an example of a program when memory access is deleted. This is a modification in which one of the overlapping memory accesses in the program of (c-1) in FIG. 3 is deleted and the other is transferred between registers by the VMOVE instruction for processing.
[0043]
The determination of the number of expansions in the case of the program of FIG. 3 will be described.
In the program of FIG. 3A, the number of loop iterations is known, and the number of registers estimated from the number of loop iterations is 256 here, and the maximum number of necessary registers is 1, so the number of virtual expansions = 256. / 1 = 256, but since the normal maximum virtual deployment number = 4 is set by default, the virtual deployment number = 4 is determined. Next, from the viewpoint of whether or not memory access can be deleted, from the viewpoint of data dependency, it is found that memory access can be deleted from double expansion, so the official expansion number is determined to be 4 as it is. When the determined quadruple expansion is performed, a portion divisible by 4 is set as the upper loop (four-fold expansion loop) of (c-1) in FIG. 3, and the remaining portion of FIG. 3 (c-1). Let it be the lower loop (the loop that has been unfolded once). Further, if the overlapping memory access is replaced with a register-to-register move instruction (VMOVE instruction), the program of (c-2) in FIG. 3 can be generated.
[0044]
FIG. 4 is an explanatory diagram of the present invention (No. 2, loop repetition count unknown). Here, a program whose loop repetition count is unknown will be described below.
FIG. 4A shows an example of the
[0045]
FIG. 4B shows an example of a program before unrolling development. This is a program after vectorizing the
[0046]
FIG. 4C shows a program after unrolling development. Here, the program before unrolling development of FIG. 4B is created by double development.
The determination of the number of expansions in the case of the program of FIG. 4 will be described.
[0047]
Since the number of loop iterations is unknown in the program of FIG. 4A, the number of registers estimated from the number of elements appearing in the vector dimension subscript of the array used in the loop is 256, which is necessary. Since the maximum value of the number of registers is 1.3, the number of virtual expansions = 256 / 1.3 = 196. If the maximum number of expansions is estimated from the data dependency, the deletion of memory access cannot be expected even if the number of expansions is two or more, so the maximum number of expansions is determined as two. Since the number of formal expansions is determined within a range not exceeding the maximum number of expansions, in this case, the number of formal expansions is determined to be 2 and double expansion is performed as shown in the program of FIG. 4C.
[0048]
【The invention's effect】
As described above, according to the present invention, when the
[Brief description of the drawings]
FIG. 1 is a system configuration diagram of the present invention.
FIG. 2 is a flowchart explaining the operation of the present invention.
FIG. 3 is an explanatory diagram (part 1) of the present invention.
FIG. 4 is an explanatory diagram (part 2) of the present invention.
[Explanation of symbols]
1: source program 2: compiler 3: source program analysis means 4: optimization means 5: vectorization means 6: vector optimization means 7: unrolling means 8: memory access deletion means 9: code generation means 10: object program
Claims (4)
上記ソースプログラムをベクトル化する手段と、
上記ソースプログラムを解析してループの繰り返し回数を検出、あるいはループの繰り返し回数を検出して不明と判定する手段と、
上記ループの繰り返し回数が検出された場合に、検出されたループの繰り返し回数から求めたレジスタ個数および演算に必要な最大レジスタ数をもとに仮想展開数するを算出し、一方、上記ループの繰り返し回数が不明と判定された場合に、ループで使用している配列のベクトル次元から求めたレジスタ個数および演算に必要な最大レジスタ数をもとに仮想展開数を算出する手段と、
上記算出された仮想展開数について、上記ベクトル化されたプログラムのデータ依存関係をもとに展開数を算出する手段と、
上記算出された展開数をもとに上記ベクトル化されたプログラムを展開する手段と
を備えたことを特徴とするコンパイラ。In a compiler that optimizes the number of expansions when vectorizing a source program,
Means for vectorizing the source program;
Means for determining the number of iterations of the loop detection, or by detecting the number of repetitions of the loop unknown analyzes the source program,
If the number of loop iterations is detected , calculate the number of virtual expansions based on the number of registers obtained from the detected number of loop iterations and the maximum number of registers required for the operation , while Means for calculating the number of virtual expansions based on the number of registers obtained from the vector dimension of the array used in the loop and the maximum number of registers necessary for the operation when it is determined that the number of times is unknown ;
Means for calculating the number of expansions based on the data dependency of the vectorized program for the calculated number of virtual expansions;
A compiler comprising means for developing the vectorized program based on the calculated number of expansions.
入力されたソースプログラムをベクトル化する手段と、
上記ソースプログラムを解析してループの繰り返し回数を検出、あるいはループの繰り返し回数を検出して不明と判定する手段と、
上記ループの繰り返し回数が検出された場合に、検出されたループの繰り返し回数から求めたレジスタ個数および演算に必要な最大レジスタ数をもとに仮想展開数するを算出し、一方、上記ループの繰り返し回数が不明と判定された場合に、ループで使用している配列のベクトル次元から求めたレジスタ個数および演算に必要な最大レジスタ数をもとに仮想展開数を算出する手段と、
上記算出された仮想展開数について、上記ベクトル化されたプログラムのデータ依存関係をもとに展開数を算出する手段と、
上記算出された展開数をもとに上記ベクトル化されたプログラムを展開する手段と
して機能させるプログラムを記録したコンピュータ読取可能な記録媒体。 On the computer,
Means for vectorizing the input source program;
Means for determining the number of iterations of the loop detection, or by detecting the number of repetitions of the loop unknown analyzes the source program,
If the number of loop iterations is detected , calculate the number of virtual expansions based on the number of registers obtained from the detected number of loop iterations and the maximum number of registers required for the operation , while Means for calculating the number of virtual expansions based on the number of registers obtained from the vector dimension of the array used in the loop and the maximum number of registers necessary for the operation when it is determined that the number of times is unknown ;
Means for calculating the number of expansions based on the data dependency of the vectorized program for the calculated number of virtual expansions;
A computer-readable recording medium recording a program that functions as means for developing the vectorized program based on the calculated number of expansions.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP37183499A JP3953697B2 (en) | 1999-12-27 | 1999-12-27 | Compiler and recording medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP37183499A JP3953697B2 (en) | 1999-12-27 | 1999-12-27 | Compiler and recording medium |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2001184341A JP2001184341A (en) | 2001-07-06 |
JP3953697B2 true JP3953697B2 (en) | 2007-08-08 |
Family
ID=18499393
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP37183499A Expired - Fee Related JP3953697B2 (en) | 1999-12-27 | 1999-12-27 | Compiler and recording medium |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3953697B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4608072B2 (en) | 2000-02-25 | 2011-01-05 | タカタ株式会社 | Airbag device |
-
1999
- 1999-12-27 JP JP37183499A patent/JP3953697B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2001184341A (en) | 2001-07-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3417984B2 (en) | Compile method to reduce cache contention | |
JP3317825B2 (en) | Loop-optimized translation processing method | |
US20100023731A1 (en) | Generation of parallelized program based on program dependence graph | |
US7007261B1 (en) | Translation of an electronic integrated circuit design into hardware description language using circuit description template | |
US5790859A (en) | Method of, system for, and computer program product for efficient identification of private variables in program loops by an optimizing compiler | |
Baghsorkhi et al. | FlexVec: Auto-vectorization for irregular loops | |
JP2007287044A (en) | Design support apparatus | |
JP3539613B2 (en) | Array summary analysis method for loops containing loop jump statements | |
JP3953697B2 (en) | Compiler and recording medium | |
EP1164477A2 (en) | A loop optimization method and a compiler | |
JP2004303113A (en) | Compiler provided with optimization processing for hierarchical memory and code generating method | |
JPH10320212A (en) | Cache optimizing method | |
JP3196625B2 (en) | Parallel compilation method | |
JP2001325111A (en) | Compiling method for speculation system | |
JP3734658B2 (en) | COMPILER DEVICE AND COMPUTER-READABLE RECORDING MEDIUM RECORDING COMPILER PROGRAM | |
Alappat et al. | YaskSite: stencil optimization techniques applied to explicit ODE methods on modern architectures | |
JP2008071065A (en) | Compile device, method, program and storage medium for performing in-line expansion | |
JPH04307624A (en) | Loop optimization system | |
JP7460902B2 (en) | Compiler program, compilation method, information processing device | |
JPH10177566A (en) | Memory access fast processor and recording medium | |
JP2008015665A (en) | Program analysis method and program analyzer | |
JP3657414B2 (en) | Multiple loop vectorization apparatus and recording medium | |
JP3817073B2 (en) | Memory access processing device, memory access processing system, and recording medium | |
Henretty | Performance Optimization of Stencil Computations on Modern SIMD Architectures | |
JP2000187596A (en) | Method and device for optimizing program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20060425 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060516 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060713 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20070403 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070425 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100511 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110511 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120511 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130511 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140511 Year of fee payment: 7 |
|
LAPS | Cancellation because of no payment of annual fees |