JPH10283192A - Prefetching code generation system - Google Patents

Prefetching code generation system

Info

Publication number
JPH10283192A
JPH10283192A JP9090470A JP9047097A JPH10283192A JP H10283192 A JPH10283192 A JP H10283192A JP 9090470 A JP9090470 A JP 9090470A JP 9047097 A JP9047097 A JP 9047097A JP H10283192 A JPH10283192 A JP H10283192A
Authority
JP
Japan
Prior art keywords
loop
code
cache
processing
data
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
JP9090470A
Other languages
Japanese (ja)
Inventor
Giichi Tanaka
義一 田中
Shinichi Ito
信一 伊藤
Yuji Tsushima
雄次 對馬
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP9090470A priority Critical patent/JPH10283192A/en
Publication of JPH10283192A publication Critical patent/JPH10283192A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To hide a main memory penalty in the case that a data area accessed by a loop exceeds a cache capacity by dividing an inner side loop into two and starting the prefetching of data in a second half loop at the time of the repetition of an outer side loop one before for the data required in a first half loop and in the first half loop for the data required in the second half loop. SOLUTION: The inner side loop is divided into two and a code for incorporating the prefetching processing of the data required at the first part of the repetition processing of the outer side loop one after in the second half loop 41 and incorporating the prefetching of the data required in a second half in the repetition processing of the same outer side loop in the first half loop 40 is generated. For the distribution of the front half loop 40 and the second half loop 41, the processing time of the second half loop 41 is turned to be more than main memory penalty time. In the case that the processing time of the second half loop 41 can not be turned to be more than the main memory penalty, loop development is performed relating to the outer side loop and an arithmetic amount is increased so as to completely hide the main memory penalty.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、命令レベル並列処
理を行うプログラムの実行方式に係わり、プログラムが
アクセスするデータが大きく、キャッシュに入りきれな
い場合のループに好適なコード生成方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of executing a program for performing instruction level parallel processing, and more particularly to a code generation method suitable for a loop in a case where data accessed by the program is large and cannot be stored in a cache.

【0002】[0002]

【従来の技術】スーパコンピュータの1つの方向とし
て、スカラプロセッサをノードプロセッサとする並列処
理方式が有望視されている。スカラプロセッサを用いた
並列スーパコンピュータが期待されるのは、半導体技術
の進歩によるクロック周波数の向上、複数の並列実行可
能な演算器を有効に生かすスーパスカラ方式等の命令レ
ベル並列処理の実現により、スカラプロセッサの処理性
能が飛躍的に向上しているためである。しかしながら、
その高いスカラプロセッサ処理能力は、キャッシュが有
効に働くときにのみ達成される。
2. Description of the Related Art As one direction of a supercomputer, a parallel processing system using a scalar processor as a node processor is considered promising. Parallel supercomputers using scalar processors are expected to be improved by improving the clock frequency due to advances in semiconductor technology, and by realizing instruction-level parallel processing such as the superscalar method that makes effective use of multiple arithmetic units that can execute in parallel. This is because the processing performance of the processor has been dramatically improved. However,
Its high scalar processor throughput is only achieved when the cache works.

【0003】スカラプロセッサは、一般的に命令処理装
置とキャッシュ及びメモリ装置を有する。スカラプロセ
ッサはメモリにプログラムとデータを格納し、プログラ
ムに記述された命令に従いメモリ中のデータを処理す
る。キャッシュは命令処理装置からの参照時間の短い比
較的小容量の記憶手段であり、プログラム及びデータの
一部を一時的に格納する。命令実行にあたり必要なデー
タはメモリから読み出されるが、同時にデータを含むデ
ータブロックはキャッシュを構成するラインにコピーさ
れ、以後当該ブロック内のデータに対する参照が指定さ
れたときは上記キャッシュのラインからデータを参照す
る。このメモリからキャッシュラインへのデータブロッ
クの転送をライン転送と呼ぶ。
A scalar processor generally has an instruction processing device, a cache and a memory device. A scalar processor stores a program and data in a memory, and processes the data in the memory according to instructions described in the program. The cache is a relatively small-capacity storage unit having a short reference time from the instruction processing device, and temporarily stores a program and a part of data. Data necessary for executing the instruction is read from the memory, but at the same time, a data block including the data is copied to a line constituting the cache, and when a reference to the data in the block is designated thereafter, the data is read from the cache line. refer. The transfer of the data block from the memory to the cache line is called line transfer.

【0004】命令実行にあたり必要データがキャッシュ
にない場合、これをキャッシュミスと呼ぶが、キャッシ
ュミスが発生するとライン転送が実行される。従来のス
カラプロセッサでは命令実行に伴いこのライン転送が発
生すると、その完了まで当該命令の実行が待ち合わされ
る。従って、キャッシュミスが多発するとライン転送に
伴う待ち合わせによりプログラムの実行時間が増大し、
スカラプロセッサの処理性能が劣化するという問題があ
った。特に、大規模科学技術計算では、データ領域が大
きく、データの局所性が少ないという性質があるためキ
ャッシュミスによる性能低下は深刻であった。
When data necessary for instruction execution is not in the cache, this is called a cache miss. When a cache miss occurs, line transfer is executed. In a conventional scalar processor, when this line transfer occurs along with the execution of an instruction, the execution of the instruction is awaited until its completion. Therefore, when cache misses occur frequently, the execution time of the program increases due to the queuing associated with the line transfer,
There is a problem that the processing performance of the scalar processor deteriorates. In particular, in large-scale scientific and technical calculations, the performance is greatly reduced due to a cache miss due to the property that the data area is large and the locality of data is small.

【0005】これに対し、最近では予めプログラムにお
いて、キャッシュミスを引き起こす可能性のある命令に
先だってデータの先読みを指示する特殊な命令を実行さ
せることで上記ライン転送に伴う性能劣化を回避する試
みがなされている。このデータ先読みをプリフェッチと
呼ぶ。例えば、米国IBM社のマイクロプロセッサPowe
rPC では指定したオペランドアドレスに位置するデー
タをキャッシュに読み込むプリフェッチ命令がある。こ
の動作において、キャッシュミスを発生した場合、プリ
フェッチ命令の完了を待ち合わせることなくライン転送
を行う。従って上記データを参照する命令を実行する時
には上記データがキャッシュに入っているために上記性
能劣化が回避される。
On the other hand, recently, an attempt has been made to avoid the performance degradation associated with the line transfer by executing a special instruction for prefetching data in advance in a program in advance of an instruction which may cause a cache miss. It has been done. This data prefetch is called prefetch. For example, the microprocessor Powe of IBM of the United States
In rPC, there is a prefetch instruction for reading data located at a specified operand address into a cache. In this operation, when a cache miss occurs, the line transfer is performed without waiting for the completion of the prefetch instruction. Therefore, when an instruction that refers to the data is executed, the performance degradation is avoided because the data is in the cache.

【0006】このようなプリフェッチ命令を利用して、
データ転送と演算をオーバラップさせることで、実質的
に主記憶レイテンシを隠蔽させるコード生成技術が論文
ToddC.Mowry,Monica S.Lam,Anoop Gupta「Design and
Evaluation of a CompilerAlgorithm for Prefetchin
g」ASPLOS-V,ACM 0-89791-535-6/92/0010/0062 pp.62-
73に示されている。
Using such a prefetch instruction,
A paper on code generation technology that effectively hides main memory latency by overlapping data transfer and operation
ToddC. Mowry, Monica S. Lam, Anoop Gupta “Design and
Evaluation of a CompilerAlgorithm for Prefetchin
g ”ASPLOS-V, ACM 0-89791-535-6 / 92/0010/0062 pp.62-
Shown at 73.

【0007】[0007]

【発明が解決しようとする課題】しかしながら、上記の
従来のコード生成技術では以下に記すような問題があっ
た。図2に示すようなDO20(20)及びDO10
(21)で示される多重ループに対するプリフェッチコ
ードの生成において、内側ループDO10(21)のみ
しか考慮されていなかった。このことを例を用いて具体
的に問題点を示す。
However, the above-mentioned conventional code generation technology has the following problems. DO20 (20) and DO10 as shown in FIG.
In the generation of the prefetch code for the multiplex loop shown in (21), only the inner loop DO10 (21) has been considered. The problem will be specifically described using an example.

【0008】まず、以下のコード生成で前提としたアー
キテクチャの仮定を述べる。対象とするスカラプロセッ
サはロード/ストア命令が2個,浮動小数点演算が2
個、及び整数演算が2個、同時に実行でき、キャシュラ
インサイズが32バイト,キャッシュミス時の主記憶ペ
ナルティを75サイクルと仮定する。
First, the assumption of the architecture assumed in the following code generation will be described. The target scalar processor has two load / store instructions and two floating-point operations.
And two integer operations can be executed simultaneously, the cache line size is 32 bytes, and the main memory penalty at the time of a cache miss is 75 cycles.

【0009】図2のソースプログラムに対して、コンパ
イラは、まず、ローカリティ解析などによりプリフェッ
チ対象オペランドを探す。その結果、参照b(i,j)
22がプリフェッチ対象オペランドであるとする。オペ
ランドの大きさを8バイトとすると、1回のプリフェッ
チで、対象とするオペランドを含む連続した32バイト
のデータがキャッシュに格納されるため、ループ繰り返
しごとにプリフェッチ命令を実行していたのでは無駄
で、この例の場合、4回に1回の割合でプリフェッチ命
令を出力すればよい。このため、一般的には、コンパイ
ラのループ構造変換部で、最内側ループ21に関して4
倍のループ展開を行う。
For the source program of FIG. 2, the compiler first searches for a prefetch target operand by locality analysis or the like. As a result, reference b (i, j)
Assume that 22 is a prefetch target operand. If the size of the operand is 8 bytes, continuous 32-byte data including the target operand is stored in the cache in one prefetch, so it is useless to execute the prefetch instruction for each loop iteration. Thus, in this example, the prefetch instruction may be output once every four times. For this reason, generally, the loop structure conversion unit of the compiler performs
Perform double loop unrolling.

【0010】この結果を図3に示す。ここで、ループ2
1がループ25とループ26に分割されている。ループ
26は、ループ展開の余りループである。以後、簡単の
ため、ループ展開の余りループに関しては省略すること
にする。そして、通常の最適化、コード生成の後に、プ
リフェッチコードの生成を行う。
FIG. 3 shows the result. Here, loop 2
1 is divided into a loop 25 and a loop 26. The loop 26 is a remainder loop of the loop expansion. Hereinafter, for the sake of simplicity, the remainder of the loop expansion will be omitted. After normal optimization and code generation, a prefetch code is generated.

【0011】プリフェッチコードの生成は以下のように
行う。まず、ループ25のループ1回あたりの実行サイ
クル数を推定する。ループ25では、ロード命令が4
個,ストア命令4が4個,浮動小数点演算が4で、プリ
フェッチ命令が1であるので、ループ1回あたりの処理
サイクル数は5サイクル(=max(ceil((4+4+1)
/2),2/2)と推定できる。ここで、ceil関数は、
引数の値を超えない最小の整数を意味する。キャッシュ
ミス時の主記憶ペナルティは75サイクルであるので、
ループ処理では、15回(ceil(75/5)=15)後
で使用されるデータのプリフェッチを行うコードを生成
すると、主記憶ペナルティを隠蔽することができる。
Generation of the prefetch code is performed as follows. First, the number of execution cycles per loop of the loop 25 is estimated. In the loop 25, the load instruction is 4
, Four store instructions, four floating-point operations, and one prefetch instruction, so the number of processing cycles per loop is five (= max (ceil ((4 + 4 + 1)
/ 2) and 2/2). Where the ceil function is
Means the smallest integer that does not exceed the value of the argument. Since the main memory penalty at the time of a cache miss is 75 cycles,
In the loop processing, if a code for prefetching data used 15 times (ceil (75/5) = 15) is generated, the main storage penalty can be hidden.

【0012】図4は、図3のコードにプリフェッチ命令
を付加したものである。ここでA部30は、ループ繰り
返しの最初の方で必要となるデータのプリフェッチを行
う部分,B部31は演算処理とループ繰り返しに関して
15回後で使用するデータのプリフェッチ命令を含むル
ープ部分、C部32はループ処理の後半部でプリフェッ
チ命令を含まないループ部分である。
FIG. 4 is obtained by adding a prefetch instruction to the code of FIG. Here, the A section 30 is a section for performing prefetching of data required at the beginning of the loop iteration, the B section 31 is a loop section including a data prefetch instruction to be used 15 times later for arithmetic processing and loop iteration, and C section. The unit 32 is a loop part that does not include a prefetch instruction in the latter half of the loop processing.

【0013】図5はその時の実行の様子を模式的に示し
たものである。横軸が時間,斜線箱がプリフェッチ処
理,空箱が演算処理である。ただし、図面の都合上、図
4のプログラムとは数値的に一致はしていない。つま
り、図4のA部は15回のプリフェッチループである
が、図5では、3回に省略されている。ここで、問題で
あるのは、A部であり、主記憶アクセスペナルティが顕
在化する。これは、特にループ処理回数が小さい場合に
問題となる。
FIG. 5 schematically shows the state of execution at that time. The horizontal axis indicates time, the hatched box indicates prefetch processing, and the empty box indicates arithmetic processing. However, for the convenience of the drawing, the program does not numerically match the program in FIG. That is, part A of FIG. 4 is a prefetch loop of 15 times, but is omitted three times in FIG. Here, the problem is the part A, and the main memory access penalty becomes apparent. This is a problem particularly when the number of loop processes is small.

【0014】以下では、このコードの性能をみつもる。
ループ長がN=100の場合、A部の実行時間は、少な
くとも主記憶アクセスペナルティの75サイクル、B部
は50サイクル(ループ1回あたり5サイクル×ループ
10回実行)、そしてC部は60サイクル(ループ1回
あたり4サイクル×ループ15回実行)で計185サイ
クルで、全体の時間の内40%(75/185×100
%)が主記憶待ちのオーバヘッドとなっている。さら
に、ループ長が50と小さい場合には、A部は少なくと
も75サイクル,B部はループ長が小さいため実行され
ず0サイクル,C部は、48サイクル(ループ1回あた
り4サイクル×ループ12回実行)で、計133サイク
ルで、全体の時間の内56%(75/133×100
%)が主記憶待ちのオーバヘッドとなる大きな問題があ
る。A部で、少なくとも75サイクルと書いたのは、現
実の計算機では、同時に処理できるプリフェッチ命令の
数には限界があるためである。ここでは、十分大きいと
仮定した。
In the following, we will look at the performance of this code.
When the loop length is N = 100, the execution time of the part A is at least 75 cycles of the main memory access penalty, the part B is 50 cycles (5 cycles per loop × 10 times the loop), and the part C is 60 cycles. (4 cycles per loop × 15 loops), a total of 185 cycles, 40% of the total time (75/185 × 100
%) Is the overhead of waiting for main memory. Further, when the loop length is as small as 50, the portion A is at least 75 cycles, the portion B is not executed because the loop length is small, and 0 cycle, and the portion C is 48 cycles (4 cycles per loop × 12 loops). Execution), for a total of 133 cycles, 56% (75/133 × 100
%) Is a major problem that results in an overhead of waiting for main memory. The reason for writing at least 75 cycles in part A is that there is a limit to the number of prefetch instructions that can be processed simultaneously in a real computer. Here, it is assumed that it is sufficiently large.

【0015】また、上記で説明したプリフェッチ命令の
削減のための内側ループ展開法を用いたコード生成は、
以下の問題がある。通常、このようなループの構造変換
はコンパイラの前半部分で行われ、その後、最適化処理
が施され、コード生成部でプリフェッチ命令が挿入され
ると考えられる。こうすると、コンパイラ処理の大半
で、ループ展開による大きな中間語を扱わねばならず、
長大なコンパイル時間が必要になる。ここでは、ライン
サイズ32バイトでの例を示したため、高々4倍の展開
であったが、ラインサイズ128バイトの計算機では1
6倍展開ものループ展開が必要となり、さらに深刻とな
る。
The code generation using the inner loop unrolling method for reducing the prefetch instructions described above is as follows.
There are the following problems. Usually, it is considered that such a loop structure conversion is performed in the first half of the compiler, and thereafter, optimization processing is performed, and a prefetch instruction is inserted in the code generation unit. In this way, most of the compiler processing has to deal with large intermediate words by loop unrolling,
Requires a long compilation time. Here, since the example in which the line size is 32 bytes is shown, the expansion is at most 4 times.
A loop expansion as much as six times is required, which is even more serious.

【0016】本発明の目的は、上記の問題点を解決する
プリフェッチ命令を用いたコード生成方式を提供するこ
とにある。
An object of the present invention is to provide a code generation method using a prefetch instruction which solves the above-mentioned problems.

【0017】[0017]

【課題を解決するための手段】上記の目的は、図6に示
すように、内側ループ処理を2つにわけ、後半ループ4
1で、1つ先の外側ループの繰り返しの処理の最初の方
で必要となるデータのプリフェッチ処理を組み込み、前
半ループ40で、同一外側ループの繰り返し処理で、後
半で必要となるデータのプリフェッチ処理を組み込むコ
ードを生成することで達成される。
The object of the present invention is to divide the inner loop processing into two, as shown in FIG.
1, a data prefetching process required at the beginning of the repetition processing of the next outer loop is incorporated, and in a first half loop 40, a prefetching process of data required in the latter half of the same outer loop repetition processing is performed. This is achieved by generating code that incorporates

【0018】例では、外側ループJ=1の、内側ループ
I=3,4,5,6,7の処理の際に、外側ループJ=
2の内側ループI=1,2,3,4,5で必要となるデ
ータをプリフェッチする命令を挿入し、外側ループJ=
1の、内側ループI=1,2の処理の際に、内側ループ
の後半I=6,7で必要となるデータをプリフェッチす
る命令を挿入する。ここで、前半ループ40と、後半ル
ープ41の分配は、後半ループ41の処理時間が主記憶
ペナルティ時間以上となるようにループ処理を分割す
る。
In the example, when the outer loop J = 1 and the inner loop I = 3, 4, 5, 6, 7, the outer loop J =
2 inserts an instruction for prefetching necessary data in inner loop I = 1, 2, 3, 4, 5 and outer loop J =
At the time of the processing of the inner loop I = 1, 2, the instruction for prefetching the necessary data in the latter half I = 6, 7 of the inner loop is inserted. Here, the distribution of the former half loop 40 and the latter half loop 41 divides the loop processing so that the processing time of the latter half loop 41 becomes equal to or longer than the main storage penalty time.

【0019】ここで、内側ループの演算数が小さくルー
プ長が短い場合は、後半ループ41の処理時間を主記憶
ペナルティ以上にできない場合がある。この場合、当該
ループの処理の時間が、想定した規定値以上のループ長
の場合には、完全に主記憶ペナルティを隠蔽できるよう
に、外側ループに関してループ展開を行い、演算量を増
加させて、この目的を達成する。
Here, when the number of operations in the inner loop is small and the loop length is short, the processing time of the second half loop 41 may not be longer than the main storage penalty. In this case, if the processing time of the loop is a loop length that is equal to or greater than the assumed specified value, the loop expansion is performed on the outer loop so that the main memory penalty can be completely hidden, and the amount of calculation is increased. Achieve this goal.

【0020】また、プリフェッチ命令の削減のための内
側ループ展開法を用いたコード生成によるコンパイル時
間の増大の問題は、コンパイラ処理の後半のコード生成
処理において、コードを複製する方式により解決でき
る。
The problem of an increase in compile time due to code generation using the inner loop unrolling method for reducing the number of prefetch instructions can be solved by a method of duplicating code in the code generation processing in the second half of the compiler processing.

【0021】[0021]

【発明の実施の形態】以下、本発明のコンパイラにおけ
る実施例を図を参照しつつ説明する。図1にコンパイラ
全体の構造を示す。図1のソースプログラム1が、構文
解析2によって中間語3に変換される。ループ構造変換
部4は、これを入力として、多重ループに関するプリフ
ェッチコードの主記憶レイテンシの隠蔽される割合を高
くするために外側ループに関するループ展開を行い、中
間語5を出力する。最適化部6は、通常の公知の伝統的
な最適化を行い、中間語7を出力する。コード生成部8
は、プリフェッチ命令を含むオブジェクトコードを9
を、中間語7をもとに生成する。本発明は4及び8に係
わり、オブジェクトコード9の実行効率を向上させるも
のである。
BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram showing an embodiment of a compiler according to the present invention. FIG. 1 shows the overall structure of the compiler. The source program 1 in FIG. 1 is converted into the intermediate language 3 by the syntax analysis 2. The loop structure conversion unit 4 receives the input as an input, performs loop expansion on the outer loop in order to increase the concealment rate of the main storage latency of the prefetch code for the multiplex loop, and outputs the intermediate language 5. The optimizing unit 6 performs an ordinary well-known traditional optimization, and outputs an intermediate language 7. Code generator 8
Changes the object code including the prefetch instruction to 9
Is generated based on the intermediate language 7. The present invention relates to 4 and 8, and relates to improving the execution efficiency of the object code 9.

【0022】図1のループ構造変換部4のうち、多重ル
ープにおける主記憶アクセスペナルティの効率的な隠蔽
に関わる部分を図7に示す。図7に入力するソースプロ
グラム1として、図2のFORTRAN プログラムを例として
あげ説明する。図2のDO20(20),DO10(21)
はループを示し、これらは2重ループを構成している。
このようなプログラムに対して図7は以下のような処理
を行い、中間語5に変換する。
FIG. 7 shows a part of the loop structure conversion unit 4 shown in FIG. 1 which relates to efficient concealment of a main memory access penalty in a multiplex loop. The source program 1 input to FIG. 7 will be described with reference to the FORTRAN program of FIG. DO20 (20) and DO10 (21) in FIG.
Indicates a loop, and these constitute a double loop.
FIG. 7 performs the following processing on such a program to convert it into an intermediate language 5.

【0023】図7の処理は、ソースプログラム中の多重
ループ50を順次処理する。判定51は、多重ループを
考慮したプリフェッチコードを出力する多重ループを選
択する。ここでは、1つのループの中に、1つのループ
を含む正規型多重ループに限定する。図2のソースプロ
グラムでは、外側ループDO20(20)の中に、1つ
のループDO10(21)しかない構造であるので適合
する。この例で、外側ループDO20(20)の中に、
複数のDOループがある場合は、本発明では、多重ルー
プを考慮したプリフェッチ命令は出力しないので、ルー
プ構造が適合しないと判断する。
The process shown in FIG. 7 sequentially processes multiple loops 50 in the source program. The decision 51 selects a multiplex loop that outputs a prefetch code in consideration of the multiplex loop. Here, the normal type multiple loop including one loop is limited to one loop. The source program shown in FIG. 2 is suitable because the outer loop DO20 (20) has only one loop DO10 (21). In this example, in the outer loop DO20 (20),
When there are a plurality of DO loops, the present invention does not output a prefetch instruction in consideration of multiple loops, and thus determines that the loop structure does not match.

【0024】処理52では、元々の内側ループ1回あた
りの実行サイクル数を推定する。ループ内には、浮動小
数点演算が1個,ロード演算が1個,ストア演算が1個
であるので、仮定しているアーキテクチャでは、ループ
1回あたり、II=max(ceil((1+1)/2),ceil
(1/2))=1サイクルである。
In the process 52, the number of execution cycles per original inner loop is estimated. In the loop, there is one floating point operation, one load operation, and one store operation. Therefore, in the assumed architecture, II = max (ceil ((1 + 1) / 2 ), Ceil
(1/2)) = 1 cycle.

【0025】処理53では、次の外側ループでの処理に
必要なデータの主記憶アクセスペナルティを完全に隠蔽
する最小のループ長MINLを求める。この場合、主記
憶アクセスペナルティは75であるので、MINL=7
5となる。つまり、このままでは、内側ループ長が75
未満であると、次の外側ループの実行に必要なデータを
オーバヘッドなしに準備できなく、データ待ちの状態が
発生することになる。実際のプログラムにおいては、こ
のループ長よりも小さい場合も多い。
In the process 53, the minimum loop length MINL for completely concealing the main storage access penalty of the data necessary for the process in the next outer loop is obtained. In this case, since the main storage access penalty is 75, MINL = 7
It becomes 5. That is, in this state, the inner loop length is 75
If the value is less than the above, data necessary for execution of the next outer loop cannot be prepared without overhead, and a data waiting state occurs. In an actual program, it is often smaller than this loop length.

【0026】そこで、仮にコンパイラのコード生成の方
針として、ループ長40以上であれば主記憶アクセスペ
ナルティを完全に隠蔽できるコードを生成することにす
る。判定54において、規定値とは、このようにコンパ
イラのコード生成方針で決めた値である。図2のソース
プログラムの場合、MINL=75,規定値=40であ
るので、判定55に進む。判定55は、外側ループ展開
を行っても、もとのプログラムと同一の処理となるか、
データ依存関係からの検査を行う。外側ループ展開が可
能か否かは、当該多重ループのループ交換が可能か否か
と同一であり、これは公知技術、例えば田中義一,岩沢
京子「ベクトル計算機のためのコンパイル技術」情報処
理,Vol.31,No.6,pp.736−743(1990) に記述してある方
式を用いればよい。図2のソースプログラムではDO2
0(20)とDO10(21)のループを交換しても同
一の結果を得ることができるので、外側ループ展開が可
能である。
Therefore, as a code generation policy of the compiler, if the loop length is 40 or more, a code capable of completely concealing the main memory access penalty will be generated. In the determination 54, the specified value is a value determined in this way by the code generation policy of the compiler. In the case of the source program of FIG. 2, since MINL = 75 and the specified value = 40, the flow proceeds to determination 55. The judgment 55 indicates whether the same processing as the original program is performed even if the outer loop is unrolled,
Check from data dependencies. Whether or not outer loop unrolling is possible is the same as whether or not loop switching of the multiple loops is possible. This is a known technique, for example, Yoshikazu Tanaka, Kyoko Iwasawa, "Compiling Techniques for Vector Computers" 31, No. 6, pp. 736-743 (1990). In the source program of FIG.
Since the same result can be obtained even if the loops of 0 (20) and DO10 (21) are exchanged, the outer loop can be expanded.

【0027】処理56では、外側ループの展開数を決め
て、外側ループ展開を中間語上で行う。図の例ではceil
(75/40)=2倍展開を行い、図8のような結果を
得る。ここでは、中間語として、フォートランライクに
表現したものを用いている。DO20(60)とDO1
0(61)が、外側ループに関して2倍展開した多重ル
ープ、DO11(62)は、外側ループに関して2倍展
開した余りループである。以後、余りループに関しては
簡単のため、説明は省略する。判定57により、すべて
の多重ループに対して上記の処理を行う。
In step 56, the number of outer loop expansions is determined, and outer loop expansion is performed on the intermediate language. Ceil in the example shown
(75/40) = Double expansion is performed to obtain a result as shown in FIG. Here, the language expressed in Fortran-like is used as the intermediate language. DO20 (60) and DO1
0 (61) is a multiplex loop expanded twice with respect to the outer loop, and DO11 (62) is a residual loop expanded twice with respect to the outer loop. Hereinafter, the remaining loop will be omitted for simplicity. By the judgment 57, the above processing is performed for all the multiplex loops.

【0028】その後図1において、通常の中間語に対す
る最適化部6の処理を行い、コード生成8を行う。コー
ド生成部8において、多重ループにおける主記憶アクセ
スペナルティの効率的な隠蔽に関わる部分を図9,図1
0に示す。
Thereafter, in FIG. 1, the processing of the optimizing unit 6 for ordinary intermediate language is performed, and code generation 8 is performed. FIG. 9 and FIG. 1 show parts related to efficient concealment of the main memory access penalty in the multiplex loop in the code generation unit 8.
0 is shown.

【0029】処理90は、最内側ループ内のプリフェッ
チ対象ロードオペランドの選択を行う。選択の方法は、
例えば、公知技術である前記文献ACM 0-89791-535-6/92
/0010/0062 pp.62-73に従う。この結果、図8のDO1
0内のb(i,j)とb(i,j+1)がプリフェッチ
対象オペランドとなるとする。
A process 90 selects a prefetch target load operand in the innermost loop. The selection method is
For example, the aforementioned document ACM 0-89791-535-6 / 92 which is a known technique
/ 0010/0062 Follow pp.62-73. As a result, DO1 in FIG.
It is assumed that b (i, j) and b (i, j + 1) in 0 are prefetch target operands.

【0030】処理91は、すべてのプリフェッチ対象オ
ペランドについてプリフェッチ命令を挿入すべきループ
間隔を求め、それらの最大公約数を求める。キャッシュ
ラインサイズが32バイトであるため、b(i,j)を
プリフェッチすると、b(i,j)を含む連続32バイ
トのデータがプリフェッチされる。仮に、b(i,j)が
キャッシュラインの先頭にあれば、b(i,j),b
(i+1,j),b(i+2,j),b(i+3,j)
のデータプリフェッチされるので、ループ4回に1回の
割合でプリフェッチ命令を発行すればよい。同様に、b
(i,j+1)もループ4回に1回でよい。b(i,
j)及びb(i,j+1)に対するプリフェッチ命令を
挿入すべき間隔はそれぞれ4であるため、全体で、プリ
フェッチ命令を発行するループ間隔は上記の最大公約数
であるLC=4となる。
The process 91 finds a loop interval in which prefetch instructions are to be inserted for all prefetch target operands, and finds their greatest common divisor. Since the cache line size is 32 bytes, when b (i, j) is prefetched, continuous 32 bytes of data including b (i, j) are prefetched. If b (i, j) is at the head of the cache line, b (i, j), b
(I + 1, j), b (i + 2, j), b (i + 3, j)
, The prefetch instruction may be issued once every four loops. Similarly, b
(I, j + 1) may be performed once in four loops. b (i,
Since the intervals at which the prefetch instructions for j) and b (i, j + 1) are to be inserted are 4, respectively, the loop interval at which the prefetch instructions are issued is LC = 4, which is the greatest common divisor as a whole.

【0031】処理92では、最内側ループのループ範囲
を2つに分割する。この処理を記述した箱のなかに記す
ように、ループ後半のループ長は、実行時間を主記憶ア
クセスペナルティ以上にするループ長か、または、ルー
プ長が短く、主記憶アクセスペナルティ以上の実行時間
にならないときはもともとのループ長を設定し、ループ
前半の処理は残りとする。従って、前半ループは実行さ
れないこともある。
In the process 92, the loop range of the innermost loop is divided into two. As described in the box describing this processing, the loop length in the latter half of the loop is either a loop length that makes the execution time longer than the main memory access penalty, or a loop length that is shorter and longer than the main memory access penalty. If not, the original loop length is set, and the processing in the first half of the loop is left. Therefore, the first half loop may not be executed.

【0032】図8のDO10(61)のループ1回あた
りの実行推定サイクルは2(=max(ceil((2+2)
/2),ceil(2/2)),LC=4,プリフェッチ命
令はb(i,j)とb(i,j+1)に対して出るの
で、プリフェッチ命令による実行サイクルは1である。
このため、最内側ループをLC回実行した場合の推定実
行サイクルは9サイクルとなる。このため、後半ループ
のループ長は、min(元々のループ長、ceil(75/
9))となる。その結果、図8のDO10(61)は、
図11の前半ループDO10(65),後半ループDO
11(66)に分割できる。
The execution estimation cycle per loop of DO10 (61) in FIG. 8 is 2 (= max (ceil ((2 + 2)
/ 2), ceil (2/2)), LC = 4, the prefetch instruction is issued for b (i, j) and b (i, j + 1), so the execution cycle by the prefetch instruction is 1.
Therefore, the estimated execution cycle when the innermost loop is executed LC times is 9 cycles. Therefore, the loop length of the latter half loop is min (the original loop length, ceil (75 /
9)). As a result, DO10 (61) in FIG.
First half loop DO10 (65), second half loop DO in FIG.
11 (66).

【0033】図11では、前半ループDO10(6
5),後半ループDO11(66)を、DOループの構
造で示してある。このままであると、実際のオブジェク
トコードとのレベルギャップがあるので、最内側ループ
をマシン語レベルに近くした中間語表現を図12に示
す。ここで、文70−文78が図11での前半ループDO
10(65)に対応し、文80−88が図11での後半ル
ープDO11(66)に対応する。
In FIG. 11, the first half loop DO10 (6
5), the latter half loop DO11 (66) is shown by the structure of the DO loop. If this is left as it is, there is a level gap with the actual object code, so that an intermediate language expression in which the innermost loop is close to the machine language level is shown in FIG. Here, the sentence 70-sentence 78 is the first half loop DO in FIG.
The sentence 80-88 corresponds to the latter half loop DO11 (66) in FIG.

【0034】ここで、文71,文72,文73,文7
6,文77,文78でDOループ10の処理を意味す
る。変数cntに処理すべきループ処理長を71で設定
し、文76で1つ減じ、文77で繰り返す。文74はも
ともとのループ本体での処理、文70はループ制御変数
の初期設定で、文75がループ制御変数の更新を意味す
る。
Here, sentence 71, sentence 72, sentence 73, sentence 7
6, sentence 77 and sentence 78 mean the processing of the DO loop 10. The loop processing length to be processed is set to the variable cnt at 71, reduced by one at sentence 76, and repeated at sentence 77. Statement 74 is the original processing in the loop body, statement 70 is the initial setting of the loop control variable, and statement 75 means the update of the loop control variable.

【0035】同様に、文81,文82,文83,文8
6,文87,文88でDOループ11の処理を意味す
る。変数cnt に処理すべきループ処理長を81で設定
し、文86で1つ減じ、文87で繰り返す。文84はも
ともとのループ本体での処理、文80はループ制御変数
の初期設定で、文85がループ制御変数の更新を意味す
る。
Similarly, sentence 81, sentence 82, sentence 83, sentence 8
6, sentence 87 and sentence 88 mean the processing of the DO loop 11. The loop processing length to be processed is set to the variable cnt by 81, reduced by one at sentence 86, and repeated at sentence 87. Statement 84 is the original processing in the loop body, statement 80 is the initial setting of the loop control variable, and statement 85 means the update of the loop control variable.

【0036】図10に進んで、処理93は、前半ループ
に対するコード生成を行う。まず、内側ループ後半のた
めのプリフェッチ命令の挿入を行う。図13の文10
0,文101,文102がこのコードである。文100
により、内側ループでceil(75/9)回先に必要とな
るデータのアドレスを計算する。文101がプリフェッ
チ命令で、文102が、LC回おきにプリフェッチコー
ドを出すためのアドレス更新コードである。次にループ
ボディコードを3(=LC−1)回複製して、挿入しす
る。図12でのループボディ文74−77を複製し、文
103−文106,文107−文110となる。ループ
終了判定コード文77,文106,文110の飛び先の
lab1(文73)から、ループ直後のlab2(文78)に変
更する。そして、再度、ループボディのコードを複製
し、文111−114に挿入する。
Proceeding to FIG. 10, a process 93 performs code generation for the first half loop. First, a prefetch instruction for the latter half of the inner loop is inserted. Statement 10 in FIG.
0, sentence 101 and sentence 102 are this code. Sentence 100
Calculates the address of the data required before the ceil (75/9) times in the inner loop. Statement 101 is a prefetch instruction, and statement 102 is an address update code for issuing a prefetch code every LC times. Next, the loop body code is copied and inserted three (= LC-1) times. The loop body sentence 74-77 in FIG. 12 is duplicated to become sentence 103-sentence 106 and sentence 107-sentence 110. Loop jump judgment code statement 77, statement 106, statement 110 jump destination
lab1 (sentence 73) is changed to lab2 (sentence 78) immediately after the loop. Then, the code of the loop body is copied again and inserted into the sentences 111-114.

【0037】処理94は、後半ループに対するコード生
成を行う。前半ループとの違いは、前半ループでは、プ
リフェッチ対象オペランドの先頭アドレスが、当該外側
ループでの内側ループ処理の後半で必要になるデータに
対し、1つ先の外側ループの内側ループ処理前半で必要
となるデータである点である。最初に、次の外側ループ
で必要になるデータのためのプリフェッチ命令の挿入を
行う。図14の文120,文121,文122がこのコード
である。文120により、次の外側ループで必要となる
データのアドレスを計算する。文121がプリフェッチ
命令で、文122が、LC回おきにプリフェッチコードを
出すためのアドレス更新コードである。次にループボデ
ィコードを3(=LC−1)回複製して、挿入する。図1
2でのループボディ文84−87を複製し、文123−
文126,文127−文130となる。ループ終了判定
コード文87,文126,文130の飛び先のlab3(文
83)から、ループ直後のlab4(文88)に変更する。
そして、再度、ループボディのコードを複製し、文13
1−134に挿入する。
A process 94 generates a code for the latter half loop. The difference from the first half loop is that in the first half loop, the first address of the operand to be prefetched is required in the first half of the inner loop processing of the next outer loop for the data required in the second half of the inner loop processing in the outer loop. This is the data that First, a prefetch instruction is inserted for data needed in the next outer loop. The sentences 120, 121, and 122 in FIG. 14 are the codes. The statement 120 calculates the address of the data required in the next outer loop. Statement 121 is a prefetch instruction, and statement 122 is an address update code for issuing a prefetch code every LC times. Next, the loop body code is copied and inserted 3 (= LC-1) times. FIG.
The loop body statement 84-87 in step 2 is duplicated and the statement 123-
Sentence 126 and sentence 127-sentence 130. The lab 3 (sentence 83) at the jump destination of the loop end determination code statements 87, 126, and 130 is changed to lab 4 (sentence 88) immediately after the loop.
Then, the code of the loop body is duplicated again, and the statement 13
Insert 1-134.

【0038】処理95は、多重ループの入り口に、初期
プリフェッチ命令を挿入する。図13の文140がこれ
である。すなわち、最初の外側ループ繰り返し時におけ
る、最初の内側ループの最初に必要となるデータは、こ
こでプリフェッチをかける。しかし、このプリフェッチ
は、他の処理とオーバラップができないので、主記憶ペ
ナルティが隠蔽できない部分である。図6のj=1,i
=1,2,3,4,5のプリフェッチ処理に相当する処
理である。
A process 95 inserts an initial prefetch instruction at the entrance of the multiple loop. This is the sentence 140 in FIG. That is, the data required at the beginning of the first inner loop during the first outer loop iteration is prefetched here. However, this prefetch is a part where the main memory penalty cannot be concealed because it cannot overlap with other processing. J = 1, i in FIG.
= 1,2,3,4,5.

【0039】[0039]

【発明の効果】本発明のコード生成方式により、多重ル
ープにおいて、アクセスするデータ領域がキャッシュ容
量を超える場合も、内側ループ処理を2つのループに分
け、前半ループに必要なデータは、1つ前の外側ループ
の繰り返し時の後半ループでデータのプリフェッチを開
始し、後半ループで必要なデータは、前半ループでデー
タのプリフェッチを開始するため、主記憶ペナルティを
隠蔽することができる。
According to the code generation method of the present invention, even in the case where the data area to be accessed exceeds the cache capacity in the multiplex loop, the inner loop processing is divided into two loops, and the data necessary for the first half loop is one before. Since the prefetch of data is started in the latter half loop when the outer loop is repeated, and the data required in the latter half loop is started in the first half loop, the main memory penalty can be concealed.

【0040】例えば従来の手法では、先に述べたよう
に、外側ループ長Mに依存せず、内側ループ長Nが10
0の場合、全体の時間の内40%がデータ待ちの状態,
内側ループ長Nが50の場合は、全体の時間の内56%
がデータ待ちの状態であった。これに対して本発明の実
施によれば、最内側ループ長が9(=ceil(75/9))
以上であれば、外側ループの1回目の処理を除き、2回
目以降の処理では、完全に主記憶ペナルティを隠蔽でき
る。即ち、内側ループ長が100,50のケースとも、
外側ループ長が非常に大きければ、データ待ちの状態は
発生しない。外側ループ長が50の場合、内側ループ長
が100,50の場合は、全体の時間の内、1.3%,
2.6%がデータ待ちの状態で、外側ループ長が10の
場合、内側ループ長が100,50の場合は、全体の時
間の内、6.25%,11.8%がデータ待ちの状態と改
善することができる。
For example, in the conventional method, as described above, the inner loop length N is set to 10 without depending on the outer loop length M.
If 0, 40% of the total time is waiting for data,
When the inner loop length N is 50, 56% of the total time
Was waiting for data. On the other hand, according to the embodiment of the present invention, the innermost loop length is 9 (= ceil (75/9)).
If so, the main memory penalty can be completely hidden in the second and subsequent processes except for the first process of the outer loop. That is, in both cases where the inner loop length is 100 or 50,
If the outer loop length is very large, no data wait condition occurs. When the outer loop length is 50, when the inner loop length is 100, 50, 1.3% of the total time,
When 2.6% is waiting for data and the outer loop length is 10, when the inner loop length is 100 and 50, 6.25% and 11.8% of the total time are waiting for data. And can be improved.

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

【図1】コンパイラ全体の構成図。FIG. 1 is a configuration diagram of an entire compiler.

【図2】ソースプログラム例を示す図。FIG. 2 is a diagram showing an example of a source program.

【図3】従来法による、内側ループ展開後のコード例を
示す図。
FIG. 3 is a diagram showing a code example after inner loop expansion according to a conventional method.

【図4】従来法による多重ループにおけるプリフェッチ
命令を使用したコード例を示す図。
FIG. 4 is a diagram showing a code example using a prefetch instruction in a multiple loop according to a conventional method.

【図5】従来法による実行の様子を示した説明図。FIG. 5 is an explanatory diagram showing a state of execution by a conventional method.

【図6】本発明による実行の様子を示した説明図。FIG. 6 is an explanatory diagram showing a state of execution according to the present invention.

【図7】本発明による多重ループの外側ループの展開方
式の処理フロー図。
FIG. 7 is a processing flow diagram of an unrolling method of an outer loop of a multiple loop according to the present invention.

【図8】本発明による外側ループ展開後のコード例を示
す図。
FIG. 8 is a diagram showing a code example after the outer loop is expanded according to the present invention.

【図9】本発明による多重ループにおけるプリフェッチ
コード生成処理のフロー図。
FIG. 9 is a flowchart of a prefetch code generation process in a multiplex loop according to the present invention.

【図10】本発明による多重ループにおけるプリフェッ
チコード生成処理のフロー図。
FIG. 10 is a flowchart of a prefetch code generation process in a multiplex loop according to the present invention.

【図11】本発明によるループ分割後のコード例を示す
図。
FIG. 11 is a diagram showing a code example after loop division according to the present invention.

【図12】本発明によるループ分割後の機械語に近いコ
ード例を示す図。
FIG. 12 is a diagram showing a code example close to a machine language after loop division according to the present invention.

【図13】本発明による多重ループにおけるプリフェッ
チ命令を使用したコード例を示す図。
FIG. 13 is a diagram showing a code example using a prefetch instruction in a multiple loop according to the present invention.

【図14】本発明による多重ループにおけるプリフェッ
チ命令を使用したコード例を示す図。
FIG. 14 is a diagram showing a code example using a prefetch instruction in a multiple loop according to the present invention.

【符号の説明】[Explanation of symbols]

1…ソースプログラム、2…構文解析部、3…中間語、
4…ル−プ構造変換部、5…中間語、6…最適化部、7
…中間語、8…コード生成部、9…オブジェクトコー
ド。
1. Source program, 2. Parsing unit, 3. Intermediate language,
4 ... Loop structure conversion unit, 5 ... Intermediate language, 6 ... Optimization unit, 7
... intermediate language, 8 ... code generation unit, 9 ... object code.

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】ソースプログラムをオブジェクトプログラ
ムにコンパイルする方式において、上記ソースプログラ
ムの多重ループ部分に対して、上記多重ループのそれぞ
れがループの実行の直前にはループ実行回数が決まるル
ープの場合、上記多重ループのうち外側ループをループ
1,最内側ループをループ2とするとき、上記ループ2
内にある演算で必要となるデータの一部を、上記ループ
1に関して前のループ繰り返し処理時に、キャッシュに
転送するプリフェッチコードを生成することを特徴とす
るコード生成方式。
In a method of compiling a source program into an object program, in a case where each of the multiple loops is a loop whose number of times of execution is determined immediately before execution of the loop with respect to a multiple loop portion of the source program, When the outer loop is the loop 1 and the innermost loop is the loop 2 of the multiple loops, the loop 2
A code generation method for generating a prefetch code for transferring a part of data necessary for an operation in a cache to a cache at the time of the previous loop repetition processing with respect to the loop 1.
【請求項2】ソースプログラムをオブジェクトプログラ
ムにコンパイルする方式において、上記ソースプログラ
ムの多重ループ部分に対して、上記多重ループのそれぞ
れがループの実行の直前にはループ実行回数が決まるル
ープの場合、上記多重ループのうち外側ループをループ
1,最内側ループをループ2とするとき、上記ループ2
を2つのループ繰り返し範囲に分割し、それぞれを前半
ループ,後半ループとするとき、上記後半ループのコー
ドは、上記ループ1に関して次の繰り返し処理時に上記
前半ループの演算の最初に必要となるデータをキャッシ
ュに転送するプリフェッチコードともともとのコードか
らなり、上記前半ループのコードは、上記前半ループの
演算で必要となるデータのうち、上記後半ループでキャ
ッシュに転送されるデータ以外のデータをキャッシュに
転送するプリフェッチコードともともとのコードとから
なることを特徴とするコード生成方式。
2. A method for compiling a source program into an object program, wherein, for each of the multiple loops of the source program, each of the multiple loops is a loop whose number of times of execution is determined immediately before the execution of the loop. When the outer loop is the loop 1 and the innermost loop is the loop 2 of the multiple loops, the loop 2
Is divided into two loop repetition ranges, each of which is a first half loop and a second half loop, the code of the second half loop includes the data necessary at the beginning of the operation of the first half loop in the next iteration of the loop 1 The pre-fetch code to be transferred to the cache and the original code, and the code of the first half loop transfers, to the cache, data other than the data transferred to the cache in the second half loop among the data required for the operation of the first half loop. A code generation method comprising a prefetch code to be executed and an original code.
【請求項3】請求項2のコード生成方式において、上記
ループ2のループ繰り返し範囲の分割において、上記後
半ループの繰り返し数は、上記後半ループの処理時間を
推定し、上記処理時間がメモリからキャッシュへの転送
時間である主記憶アクセスペナルティを超えるように求
めた推定ループ繰り返し数か、もともとの上記ループ2
のループ繰り返し数のうち小さい繰り返し数を設定する
ことを特徴とするコード生成方式。
3. The code generation method according to claim 2, wherein in the division of the loop repetition range of the loop 2, the number of repetitions of the latter loop estimates a processing time of the latter loop, and the processing time is cached from a memory. Estimated number of loop iterations determined to exceed main memory access penalty, which is the transfer time to
A code generation method characterized by setting a small number of repetitions among the number of loop repetitions of (1).
【請求項4】請求項3のコード生成方式にて、上記後半
ループの処理時間を推定し、上記処理時間がメモリから
キャッシュへの転送時間である主記憶ペナルティを超え
る推定ループ繰り返し数が、ある与えられた基準値よ
り、大きい時は、ループ1に関してループ展開ができな
いか解析を行い、展開可能な場合、展開後の上記後半ル
ープの処理時間を推定し、上記処理時間がメモリからキ
ャッシュへの転送時間である主記憶アクセスペナルティ
を超える推定ループ繰り返し数が、上記基準値より小さ
くなるまでループ1に関するループ展開を行ったコード
を生成することを特徴とするコード生成方式。
4. The code generation method according to claim 3, wherein the processing time of the latter half loop is estimated, and there is an estimated number of loop iterations in which the processing time exceeds a main storage penalty which is a transfer time from a memory to a cache. When the value is larger than the given reference value, analysis is performed to determine if loop unrolling can be performed for loop 1. If unrolling is possible, the processing time of the latter half loop after expansion is estimated. A code generation method for generating a code in which loop expansion for loop 1 is performed until the estimated number of loop repetitions exceeding a main memory access penalty, which is a transfer time, becomes smaller than the reference value.
【請求項5】請求項2のコード生成方式にて、上記プリ
フェッチが必要なループ繰り返し間隔数を求め、上記後
半ループのコードは、上記ループ1に関して次の繰り返
し処理時に上記前半ループの演算の最初に必要となるデ
ータをキャッシュに転送するプリフェッチコードともと
もとの処理コードを上記展開数分だけ複製したものから
なり、上記前半ループのコードは、上記前半ループの演
算で必要となるデータのうち、上記後半ループでキャッ
シュに転送されるデータ以外のデータをキャッシュに転
送するプリフェッチコードともともとの処理コードを上
記展開数分だけ複製したコードからなることを特徴とす
るコード生成方式。
5. The code generation method according to claim 2, wherein the number of loop repetition intervals required for the prefetch is determined, and the code of the latter half loop is used in the first iteration of the operation of the former half loop during the next repetition processing with respect to the loop 1. The prefetch code for transferring data required to the cache and the original processing code are duplicated for the number of expansions, and the code of the first half loop is one of the data required for the operation of the first half loop. A code generation method comprising a prefetch code for transferring data other than data transferred to the cache in the latter half loop to the cache and a code obtained by duplicating the original processing code by the number of expansions.
JP9090470A 1997-04-09 1997-04-09 Prefetching code generation system Pending JPH10283192A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9090470A JPH10283192A (en) 1997-04-09 1997-04-09 Prefetching code generation system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9090470A JPH10283192A (en) 1997-04-09 1997-04-09 Prefetching code generation system

Publications (1)

Publication Number Publication Date
JPH10283192A true JPH10283192A (en) 1998-10-23

Family

ID=13999489

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9090470A Pending JPH10283192A (en) 1997-04-09 1997-04-09 Prefetching code generation system

Country Status (1)

Country Link
JP (1) JPH10283192A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6892280B2 (en) 2001-11-07 2005-05-10 Hitachi, Ltd. Multiprocessor system having distributed shared memory and instruction scheduling method used in the same system
WO2005078579A1 (en) * 2004-02-12 2005-08-25 Matsushita Electric Industrial Co., Ltd. Program conversion device and program conversion method
JP2010244208A (en) * 2009-04-02 2010-10-28 Fujitsu Ltd Prefetch generation program and compiler device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6892280B2 (en) 2001-11-07 2005-05-10 Hitachi, Ltd. Multiprocessor system having distributed shared memory and instruction scheduling method used in the same system
WO2005078579A1 (en) * 2004-02-12 2005-08-25 Matsushita Electric Industrial Co., Ltd. Program conversion device and program conversion method
JP2010244208A (en) * 2009-04-02 2010-10-28 Fujitsu Ltd Prefetch generation program and compiler device

Similar Documents

Publication Publication Date Title
US5797013A (en) Intelligent loop unrolling
US7594102B2 (en) Method and apparatus for vector execution on a scalar machine
US7185323B2 (en) Using value speculation to break constraining dependencies in iterative control flow structures
Krashinsky et al. The vector-thread architecture
US5854934A (en) Optimizing compiler having data cache prefetch spreading
JP3120152B2 (en) Computer system
US8522220B2 (en) Post-pass binary adaptation for software-based speculative precomputation
JP3218932B2 (en) Data prefetch code generation method
WO2005093563A2 (en) Method and apparatus for dynamically adjusting the mode of an execute-ahead processor
JP2002312181A (en) General and effective method for converting predicate execution into static and speculative execution
WO2005078579A1 (en) Program conversion device and program conversion method
JPH05282265A (en) Method for distributing instruction group of execution sequence and device for scheduling serial instruction stream
JP2006508414A (en) Extended instruction encoding system and method
JP2003108386A (en) Method for prefetching indirect reference data
Vander Wiel et al. A compiler-assisted data prefetch controller
US6516462B1 (en) Cache miss saving for speculation load operation
EP1999575B1 (en) Method and apparatus for simultaneous speculative threading
US20020032558A1 (en) Method and apparatus for enhancing the performance of a pipelined data processor
Doshi et al. Optimizing software data prefetches with rotating registers
US20040199907A1 (en) Compiler and method for optimizing object codes for hierarchical memories
JPH10283192A (en) Prefetching code generation system
Ro et al. Design and evaluation of a hierarchical decoupled architecture
JPH06290057A (en) Loop optimizing method
Oberoi et al. Out-of-order instruction fetch using multiple sequencers
JP2001325111A (en) Compiling method for speculation system