JP2809073B2 - Array memory allocation method - Google Patents
Array memory allocation methodInfo
- Publication number
- JP2809073B2 JP2809073B2 JP5321229A JP32122993A JP2809073B2 JP 2809073 B2 JP2809073 B2 JP 2809073B2 JP 5321229 A JP5321229 A JP 5321229A JP 32122993 A JP32122993 A JP 32122993A JP 2809073 B2 JP2809073 B2 JP 2809073B2
- Authority
- JP
- Japan
- Prior art keywords
- array
- memory
- size
- distributed memory
- code
- 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
- 230000015654 memory Effects 0.000 title claims description 109
- 238000000034 method Methods 0.000 title claims description 20
- 238000006243 chemical reaction Methods 0.000 claims description 19
- 238000003491 array Methods 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000000605 extraction Methods 0.000 description 6
- 238000005457 optimization Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 239000000284 extract Substances 0.000 description 2
- 230000010365 information processing Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Landscapes
- Multi Processors (AREA)
- Complex Calculations (AREA)
- Devices For Executing Special Programs (AREA)
Description
【0001】[0001]
【産業上の利用分野】本発明はソースプログラムから目
的プログラムを生成するコンパイラに関し、特にソース
プログラム中の実行文において定義または参照される配
列を分割し、各々を、分散メモリマルチプロセッサシス
テムを構成するそれぞれ異なるプロセッサ対応の分散メ
モリ上に割り付けるようにした、配列のメモリ割り付け
方式に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compiler for generating a target program from a source program, and more particularly to an array defined or referred to in an executable statement in the source program, each of which constitutes a distributed memory multiprocessor system. The present invention relates to a memory allocation method for arrays, which is allocated on distributed memories corresponding to different processors.
【0002】[0002]
【従来の技術】FORTRANコンパイラ等のコンパイ
ラにおいては、ソースプログラム中の実行文で定義また
は参照される配列に対して、その配列を格納するための
配列領域をメモリ上の連続した領域に割り付けるように
している。これは、複数のプロセッサから構成されるマ
ルチプロセッサシステム向けのコンパイラでも同じであ
った。2. Description of the Related Art In a compiler such as a FORTRAN compiler, for an array defined or referred to by an executable statement in a source program, an array area for storing the array is allocated to a continuous area on a memory. ing. This is the same for a compiler for a multiprocessor system composed of a plurality of processors.
【0003】[0003]
【発明が解決しようとする課題】マルチプロセッサシス
テムには、複数のプロセッサが全メモリをほぼ同じアク
セス時間で均等にアクセスできるシステム以外に、例え
ば図6に示すように、各プロセッサP1〜Pn対応に分
散メモリM1〜Mnを備えると共に各分散メモリM1〜
MnおよびプロセッサP1〜Pnに接続されたスイッチ
網SWを備え、各プロセッサP1〜Pnは自プロセッサ
対応の分散メモリM1〜Mnは直接的に高速にアクセス
できるが、他プロセッサ対応の分散メモリはスイッチ網
SWを通じて間接的にしかアクセスすることができない
システム、いわゆる仮想共有メモリ方式の分散メモリマ
ルチプロセッサシステムがある。In a multiprocessor system, besides a system in which a plurality of processors can access all memories equally with almost the same access time, for example, as shown in FIG. It has distributed memories M1 to Mn and each distributed memory M1
Mn and a switch network SW connected to the processors P1 to Pn. Each of the processors P1 to Pn can directly access the distributed memories M1 to Mn corresponding to its own processor at high speed. There is a system that can only be accessed indirectly through the SW, that is, a distributed memory multiprocessor system of a so-called virtual shared memory system.
【0004】一般にマルチプロセッサシステムでは、1
つの配列に対する処理を複数のプロセッサに分担させる
ことが行われるため、配列領域をメモリ上の連続した領
域に割り付ける方法によると、複数のプロセッサが全メ
モリを均等にアクセスできるマルチプロセッサシステム
の場合には特に問題は生じないが、上述した分散メモリ
マルチプロセッサシステムの場合、配列領域が自己の分
散メモリ上に割り付けられたプロセッサでは高速に配列
要素をアクセスし得るのに対し、それ以外のプロセッサ
では高速なアクセスが行えず、負荷のアンバランスが生
じて並列化の性能が低下するという問題点がある。In general, in a multiprocessor system, 1
Since the processing for one array is shared by multiple processors, according to the method of allocating the array area to a continuous area on the memory, in the case of a multiprocessor system in which multiple processors can access the entire memory equally, Although there is no particular problem, in the case of the distributed memory multiprocessor system described above, a processor in which the array area is allocated on its own distributed memory can access array elements at high speed, whereas other processors have high speed. There is a problem that the access cannot be performed, the load becomes unbalanced, and the parallelization performance is reduced.
【0005】そこで本発明の目的は、分散メモリマルチ
プロセッサシステムにおいて配列の処理を各プロセッサ
に分担させる場合に、各プロセッサ間で負荷のアンバラ
ンスが生じないように配列をメモリに割り付けるように
した、配列のメモリ割り付け方式を提供することにあ
る。SUMMARY OF THE INVENTION An object of the present invention is to allocate arrays to memories in a distributed memory multiprocessor system so that the processing of the arrays is shared among the processors so that there is no load imbalance among the processors. An object of the present invention is to provide an array memory allocation method.
【0006】なお、特開昭63−127340号公報
に、配列要素を所定の順序でアクセスする際に特定のメ
モリバンクや特定のバッファにアクセスが集中しないよ
うに配列の次元の寸法を拡大して配列の次元間に隙間を
入れる技術が提案されているが、この技術は分散メモリ
マルチプロセッサシステム向けのコンパイラに適用され
るものではない。また、この技術を分散メモリマルチプ
ロセッサシステムに応用して、例えばA(16,16)
という配列の第1次元の寸法を分散メモリのサイズに等
しく拡大して、図7に示すように各分散メモリM1,M
2,…に割り付けるようにすると、図中の*で示す分散
メモリの領域が実質的に他の目的に使用できない無駄な
領域となり、メモリ効率が極端に悪化する。Japanese Unexamined Patent Publication No. 63-127340 discloses an enlarged dimension of the array so that accesses to array elements in a predetermined order are not concentrated on a specific memory bank or a specific buffer. Although a technique for providing a gap between array dimensions has been proposed, this technique is not applied to a compiler for a distributed memory multiprocessor system. Also, applying this technology to a distributed memory multiprocessor system, for example, A (16,16)
Is enlarged to the size of the distributed memory equal to the size of the distributed memory, and as shown in FIG.
If assigned to 2,..., The area of the distributed memory indicated by * in the figure becomes a useless area that cannot be used for other purposes, and the memory efficiency is extremely deteriorated.
【0007】そこで本発明の別の目的は、配列の次元の
寸法を拡大することなく、各プロセッサの配列処理にか
かる負荷のアンバランスを解消することにある。It is another object of the present invention to eliminate the imbalance in the load on the array processing of each processor without increasing the dimension of the array.
【0008】[0008]
【課題を解決するための手段】本発明は上記の目的を達
成するために、ソースプログラムを入力し、各プロセッ
サ対応に分散メモリを備え各プロセッサは自プロセッサ
対応の分散メモリを直接アクセスし得ると共に他プロセ
ッサ対応の分散メモリをスイッチ網を通じて間接的にア
クセスし得るように構成された仮想共有メモリ方式の分
散メモリマルチプロセッサシステムで実行可能な目的プ
ログラムを生成するコンパイラにおいて、前記ソースプ
ログラム中の実行文において定義または参照される配列
を分割し、各々を、前記分散メモリマルチプロセッサシ
ステムを構成するそれぞれ異なるプロセッサに割り当て
られた分散メモリ上に割り付ける配列のメモリ割り付け
方式において、 前記ソースプログラムから配列宣言を取
り出す配列取り出し手段と、 取り出された配列宣言にか
かる配列に対して分割サイズを求める分割サイズ決定手
段と、 前記配列宣言にかかる配列が前記ソースプログラ
ム中の実行文に定義または参照される配列として現れた
場合に、その配列を前記求められた分割サイズで分割
し、得られた個々の配列部分に対応するコードとして、
個々の配列部分がそれぞれ異なるプロセッサに割り当て
られた分散メモリ上に割り付けられるような仮想共有メ
モリアドレスで表現されたコードを生成するアドレス変
換コード生成手段とを有し、かつ、 前記アドレス変換コ
ード生成手段は、インデックスiの配列要素に対して、 base+N{int(i/b)×(p−b)+i} 但し、base;当該配列のベースとなるアドレス b;分割サイズ p;各プロセッサに割り当てられた分散メモリのサイズ N;1つの配列要素が占めるメモリ上の記憶単位数 で示される仮想共有メモリアドレスに変換したコードを
生成する ようにしている。According to the present invention, in order to achieve the above object, a source program is input, a distributed memory is provided for each processor, and each processor can directly access the distributed memory corresponding to its own processor. In a compiler for generating a target program executable in a distributed memory multiprocessor system of a virtual shared memory system configured so that a distributed memory corresponding to a processor can be indirectly accessed through a switch network, an execution statement in the source program Memory allocation of an array that divides an array to be defined or referred to and allocates each on distributed memory allocated to different processors constituting the distributed memory multiprocessor system
In the method, the array declaration is taken from the source program.
The array fetching means to be fetched and the
Division size determinant for finding the division size for such arrays
And the array according to the array declaration is the source program.
Appeared as an array defined or referenced in an executable statement in the program
In the case, the array is divided by the obtained division size.
Then, as the code corresponding to the obtained individual sequence portion,
Individual array parts are assigned to different processors
Virtual shared memory that can be allocated on
Address conversion that generates code represented by memory addresses
Conversion code generation means, and the address conversion code
The code generation means calculates base + N {int (i / b) × (p−b) + i} for the array element of index i, where: base; address b serving as a base of the array ; division size p; The size N of the distributed memory allocated to the memory ; a code converted to a virtual shared memory address indicated by the number of storage units on the memory occupied by one array element
It is generated .
【0009】[0009]
【作用】本発明においては、コンパイラがソースプログ
ラム中の実行文において定義または参照される配列を分
割し、個々の配列部分をそれぞれ異なる分散メモリ上に
割り付けることにより、各プロセッサの配列処理にかか
る負荷のアンバランスを解消する。具体的には、配列取
り出し手段がソースプログラムから配列宣言を取り出
し、分割サイズ決定手段が取り出された配列宣言にかか
る配列に対して分割サイズを求め、アドレス変換コード
生成手段が、配列宣言にかかる配列が前記ソースプログ
ラム中の実行文に定義または参照される配列として現れ
た場合に、その配列を前記求められた分割サイズで分割
し、得られた個々の配列部分に対応するコードとして、
個々の配列部分がそれぞれ異なるプロセッサに割り当て
られた分散メモリ上に割り付けられるような仮想共有メ
モリアドレスで表現されたコードを生成する。 According to the present invention, a compiler divides an array defined or referred to in an executable statement in a source program and allocates each array part to a different distributed memory, thereby reducing the load on array processing of each processor. Eliminate imbalance. Specifically,
Extraction means extracts array declaration from source program
And the division size determination means
The division size for the array
The generating means determines that the array according to the array declaration is the source program.
Appear as an array defined or referenced in an executable statement in a ram
The array is divided by the calculated division size.
Then, as the code corresponding to the obtained individual sequence portion,
Individual array parts are assigned to different processors
Virtual shared memory that can be allocated on
Generates the code represented by the memory address.
【0010】[0010]
【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, embodiments of the present invention will be described in detail with reference to the drawings.
【0011】図1は本発明を適用したコンパイラの一実
施例の構成図である。本例のコンパイラ1は、ソースプ
ログラム2を入力して、コンパイル過程で第1中間テキ
スト3および第2中間テキスト4を順次生成しながら、
最終的に分散メモリマルチプロセッサシステム向けの目
的プログラム5を生成出力する機能を有している。FIG. 1 is a configuration diagram of an embodiment of a compiler to which the present invention is applied. The compiler 1 of the present example receives a source program 2 and sequentially generates a first intermediate text 3 and a second intermediate text 4 during a compilation process.
Finally, it has a function of generating and outputting a target program 5 for a distributed memory multiprocessor system.
【0012】コンパイラ1は、ソースプログラム2を入
力して字句解析,構文解析,意味解析等を行って第1中
間テキスト3を出力する解析部11と、第1中間テキス
ト3を入力して最適化やベクトル化にかかる処理,メモ
リ割り付け処理等を行って第2中間テキスト4を出力す
る処理部12と、第2中間テキスト4を入力して機械語
で記述された目的プログラム5を出力する目的プログラ
ム生成部13とを含んでいる。The compiler 1 inputs a source program 2, performs lexical analysis, syntax analysis, semantic analysis, and the like, and outputs a first intermediate text 3. The compiler 1 receives the first intermediate text 3 and performs optimization. Processing unit 12 that outputs the second intermediate text 4 by performing a process related to data and vectorization, a memory allocation process, and the like, and a target program that inputs the second intermediate text 4 and outputs a target program 5 described in a machine language And a generating unit 13.
【0013】そして、配列のメモリ割り付けに関連する
機能的手段として、解析部11内に配列取り出し手段1
11,分割サイズ決定手段112および分散メモリサイ
ズ取り出し手段113を備え、処理部12内にアドレス
変換コード生成手段121を備えている。As a functional means relating to memory allocation of the array, an array fetching means 1 is provided in the analyzing unit 11.
11, a division size determination unit 112 and a distributed memory size extraction unit 113, and an address conversion code generation unit 121 in the processing unit 12.
【0014】以下、このように構成されたコンパイラ1
の動作を説明する。Hereinafter, the compiler 1 configured as described above will be described.
Will be described.
【0015】コンパイラ1の解析部11はソースプログ
ラム2を入力し、通常のコンパイラと同様に字句解析,
構文解析,意味解析等を行う。このとき、ソースプログ
ラム2中に配列宣言が現れると、配列取り出し手段11
1は、この配列宣言を取り出し、配列名,配列の型,次
元数,配列長等の配列にかかる情報を図示しないテーブ
ル等に保持する。The analysis unit 11 of the compiler 1 inputs the source program 2 and performs lexical analysis,
Performs syntax analysis and semantic analysis. At this time, when an array declaration appears in the source program 2, the array fetching means 11
1 retrieves the array declaration and stores information on the array such as the array name, array type, number of dimensions, and array length in a table (not shown) or the like.
【0016】また、当該宣言された配列に関する分割サ
イズを指定する記述がソースプログラム2中に現れる
と、分割サイズ決定手段112は、この記述から当該配
列に関する分割サイズを取得して図示しないテーブル等
に保持する。When a description designating the division size related to the declared array appears in the source program 2, the division size determining means 112 obtains the division size related to the array from the description and stores it in a table (not shown). Hold.
【0017】なお、本実施例では配列の分割サイズをユ
ーザがソースプログラム中に記述しておく方法を採用し
ているが、分割サイズ決定手段112に、対象となる分
散メモリマルチプロセッサシステムのプロセッサ数を調
べて各プロセッサに分散される配列部分のサイズが全て
均等、または配列サイズをプロセッサ台数で割ったとき
に余りがでるときは少なくとも1つのプロセッサを除き
均等となるような分割サイズを自動的に求める機能を持
たせるようにしても良い。Although this embodiment employs a method in which the user describes the array division size in the source program, the division size determination means 112 includes the number of processors of the target distributed memory multiprocessor system. The size of the array part distributed to each processor is checked to be equal, or if the array size is divided by the number of processors, and there is a remainder, the division size is automatically set to be equal except for at least one processor. The function required may be provided.
【0018】更に、各プロセッサの分散メモリのサイズ
を指定する記述がソースプログラム2中に現れると、分
散メモリサイズ取り出し手段113は、この記述から分
散メモリのサイズを取得して図示しないテーブル等に保
持する。Further, when a description designating the size of the distributed memory of each processor appears in the source program 2, the distributed memory size extracting means 113 obtains the size of the distributed memory from this description and stores it in a table (not shown). I do.
【0019】なお、本実施例では分散メモリのサイズを
ユーザがソースプログラム中に記述しておく方法を採用
しているが、コンパイラオプションで指定するようにし
ても良い。更に、分散メモリサイズ取り出し手段113
では分散メモリのサイズを取り出すコードを生成するよ
うにしておき、このコードの実行により目的プログラム
の実行開始時に分散メモリのサイズを取得するようにし
ても良い。このときは、後述のアドレス変換コード生成
手段121では、分散メモリサイズ取り出し手段113
で生成されたコードによって取り出された分散メモリの
サイズが代入される変数を含むコードを生成する構成が
採られる。ここで、分散メモリのサイズは一般的にはマ
シンアーキテクチャに従ってオペレーティング・システ
ムが制御するアドレス機構により定まる。Although this embodiment employs a method in which the size of the distributed memory is described in the source program by the user, the size may be specified by a compiler option. Further, the distributed memory size extracting means 113
In this case, a code for extracting the size of the distributed memory may be generated, and the size of the distributed memory may be acquired at the start of execution of the target program by executing this code. At this time, the address conversion code generation unit 121 described later performs the distributed memory size extraction unit 113
A configuration for generating a code including a variable to which the size of the distributed memory extracted by the code generated in step (1) is substituted is adopted. Here, the size of the distributed memory is generally determined by the address mechanism controlled by the operating system according to the machine architecture.
【0020】さて、ソースプログラム2が解析部11で
処理されて第1中間テキスト3が生成されると、処理部
12がこれを入力して最適化,ベクトル化,メモリ割り
付け等の処理を行って第2中間テキスト4を出力する。When the source program 2 is processed by the analysis unit 11 to generate the first intermediate text 3, the processing unit 12 inputs the first intermediate text 3 and performs processing such as optimization, vectorization, and memory allocation. The second intermediate text 4 is output.
【0021】このとき、アドレス変換コード生成手段1
21は、ソースプログラム2中の実行文において定義ま
たは参照される配列については、配列取り出し手段11
1,分割サイズ決定手段112および分散メモリサイズ
取り出し手段113で図示しないテーブル等に保持され
た分割サイズ,分散メモリサイズ等を考慮して、配列を
分割し、各々を、対象となる分散メモリマルチプロセッ
サシステムを構成するそれぞれ異なるプロセッサに割り
当てられた分散メモリ上に割り付ける。At this time, the address conversion code generation means 1
Reference numeral 21 denotes an array extracting means 11 for an array defined or referred to in an executable statement in the source program 2.
1, the array is divided in consideration of the division size, distributed memory size, and the like held in a table or the like (not shown) by the division size determination unit 112 and the distributed memory size extraction unit 113, and each is divided into target distributed memory multiprocessors. Allocate them on distributed memories allocated to different processors constituting the system.
【0022】そして、処理部12によって第2中間テキ
スト4が生成されると、目的プログラム生成部13がこ
れを機械語に変換して目的プログラム5を生成する。When the second intermediate text 4 is generated by the processing unit 12, the target program generation unit 13 converts the second intermediate text 4 into a machine language to generate the target program 5.
【0023】次に、具体例を挙げて、本実施例の動作を
より具体的に説明する。Next, the operation of this embodiment will be described more specifically with reference to specific examples.
【0024】今、ソースプログラム2中に図2に示すよ
うな配列宣言21があり、実行文中に配列Aの参照文を
含むDOループ22が存在しているとする。また、この
配列Aに対して分割サイズが「86」と指定され、分散
メモリのサイズはpであるものとする。Assume that an array declaration 21 as shown in FIG. 2 exists in the source program 2 and a DO loop 22 including a reference statement of the array A exists in an execution statement. It is also assumed that the division size is designated as “86” for this array A, and the size of the distributed memory is p.
【0025】このような配列Aに対して、アドレス変換
コード生成手段121は、配列Aを86要素数の第1の
配列部分,86要素数の第2の配列部分,84要素数の
第3の配列部分に分割し、図3に示すように、各々がサ
イズpの分散メモリM1,M2,M3(アドレスは分散
メモリM1を先頭に全分散メモリにわたって連続して振
られている)のうちの分散メモリM1に第1の配列部分
31を割り付け、分散メモリM2に第2の配列部分32
を割り付け、分散メモリM3に第3の配列部分33を割
り付けるようなコードを生成する。For such an array A, the address conversion code generation means 121 converts the array A into a first array portion having 86 elements, a second array portion having 86 elements, and a third array portion having 84 elements. As shown in FIG. 3, each of the distributed memories M1, M2, and M3 (the addresses are continuously distributed over the entire distributed memory with the distributed memory M1 at the top) is divided into array portions. The first array portion 32 is allocated to the memory M1, and the second array portion 32 is allocated to the distributed memory M2.
, And a code for allocating the third array portion 33 to the distributed memory M3 is generated.
【0026】即ち、アドレス変換コード生成手段121
は、配列Aのインデックスiの配列要素に対して、 base+N{int(i/b)×(p−b)+i} で示される仮想共有メモリアドレスに変換したコードを
生成する。ここで、baseは当該配列のベースとなる
アドレスであり、添字の値が0から始まらない場合は仮
想的に0から始まるようにずらされる。また、bは分割
サイズ、pは分散メモリのサイズ、Nは1つの配列要素
が占めるメモリ上の記憶単位数(今の場合は1)、in
t( )は( )の値の整数部分のみを取り出す整数化
関数である。That is, the address conversion code generation means 121
Generates a code converted to a virtual shared memory address represented by base + N {int (i / b) × (p−b) + i} for the array element at index i of array A. Here, base is the base address of the array, and if the value of the subscript does not start from 0, it is shifted so that it starts virtually from 0. Also, b is the division size, p is the size of the distributed memory, N is the number of storage units on the memory occupied by one array element (1 in this case), in
t () is an integer conversion function that extracts only the integer part of the value of ().
【0027】従って、図2の配列Aを含むループ22に
対してコンパイラ1が生成するコードのイメージは図4
に示すようになる。但し図4は説明の為にコンパイラ1
が生成するコードをソースプログラムの形に置き直した
ものであり、実際のオブジェクトコードを示すものでは
ない。Therefore, the image of the code generated by the compiler 1 for the loop 22 including the array A in FIG.
It becomes as shown in. However, FIG. 4 shows compiler 1 for explanation.
Is the source code in the form of the generated code, not the actual object code.
【0028】このようにすることにより、配列Aを各プ
ロセッサ対応の分散メモリにほぼ均等に分散することが
できるので、分散メモリマルチプロセッサシステムを構
成する各プロセッサに自プロセッサ対応の分散メモリM
1,M2,M3上の配列部分の処理を分担させることに
より、各プロセッサの配列処理にかかる負荷のアンバラ
ンスが均等化され、並列処理における各プロセッサの仕
事量が均一に小さくなって並列処理の効率が向上する。By doing so, the array A can be almost evenly distributed among the distributed memories corresponding to the respective processors, so that each processor constituting the distributed memory multiprocessor system has the distributed memory M corresponding to its own processor.
By sharing the processing of the array portions on M1, M2, and M3, the imbalance of the load on the array processing of each processor is equalized, and the work amount of each processor in the parallel processing is reduced uniformly, so that the parallel processing is reduced. Efficiency is improved.
【0029】以上の実施例では、図2のようにDOルー
プ内で用いられている線形配列、すなわちインデックス
iが一次式である配列に対して図4のイメージのような
オブジェクトコードを生成したが、図4から明らかなよ
うに、変換後においてはインデックスが線形でなくなっ
ている。一般に、配列のインデックスが線形でないと、
生成されたコードに対する最適化やベクトル化に支障が
生じるため、最適化等を考慮すると、インデックスは線
形であることが望まれる。In the above embodiment, an object code as shown in the image of FIG. 4 is generated for the linear array used in the DO loop as shown in FIG. 2, that is, the array whose index i is a linear expression. As is clear from FIG. 4, the index is not linear after the conversion. In general, if the indices of the array are not linear,
Since optimization and vectorization of the generated code are hindered, it is desirable that the index be linear in consideration of optimization and the like.
【0030】インデックスの線形性を保つようにするた
めには、以下のようにすれば良い。即ち、アドレス変換
コード生成手段121では、インデックスiが一次式で
ある配列を含むDOループを、ループの初期値,終値,
増分値を適切に設定することにより、配列インデックス
が一次式で表現された内側ループとこのループを包含す
る外側ループとの二重ループに変形した上でオブジェク
トコードを生成することである。In order to maintain the linearity of the index, the following may be performed. That is, the address conversion code generation unit 121 sets a DO loop including an array whose index i is a linear expression as an initial value, a final value,
By appropriately setting the increment value, an object code is generated after the array index is transformed into a double loop of an inner loop represented by a linear expression and an outer loop including the inner loop.
【0031】このような方法によれば、図2の配列Aを
含むループ22に対しては、ソースプログラムのイメー
ジで置き換えて表現した図5に示すようなコードが生成
され、配列アクセスは内側のループの制御変数(i2)
に関して線形性を保つことができる。ここで、外側ルー
プは各プロセッサ対応の分散メモリを渡るループであ
り、内側ループは個々のプロセッサ対応の分散メモリ内
の配列部分の先頭から終了までを渡るループである。According to such a method, for the loop 22 including the array A in FIG. 2, a code as shown in FIG. 5, which is expressed by replacing it with the image of the source program, is generated. Loop control variable (i2)
Can be kept linear with respect to. Here, the outer loop is a loop that crosses the distributed memory corresponding to each processor, and the inner loop is a loop that extends from the beginning to the end of the array portion in the distributed memory corresponding to each processor.
【0032】なお、ループ内に現れない配列や、ループ
内に現れても元々線形でない配列は図4に例示した方法
でオブジェクトコードを生成する必要がある。An array that does not appear in the loop or an array that is originally linear even if it appears in the loop needs to generate an object code by the method illustrated in FIG.
【0033】[0033]
【発明の効果】以上説明したように、本発明は、配列を
複数に分割し、個々の配列部分をそれぞれ異なる分散メ
モリ上に割り付けるようにしたので、分散メモリマルチ
プロセッサシステムを構成する各プロセッサに自プロセ
ッサ対応の分散メモリ上の配列部分の処理を分担させる
ことにより、各プロセッサの配列処理にかかる負荷のア
ンバランスを解消することができ、且つ、配列にかかる
並列処理の高速化が可能となる。As described above, according to the present invention, the array is divided into a plurality of parts, and the individual array portions are allocated to different distributed memories, respectively. By sharing the processing of the array part on the distributed memory corresponding to the own processor, it is possible to eliminate the imbalance in the load on the array processing of each processor, and it is possible to speed up the parallel processing on the array. .
【0034】また、配列の次元の寸法は拡大しないた
め、分散メモリ上の配列部分を割り付けた残りの部分は
他の配列部分の割り付け等に有効に活用することができ
る。Further, since the dimension of the array is not enlarged, the remaining portion of the distributed memory where the array portion is allocated can be effectively used for allocation of other array portions.
【0035】更に、配列がループ内に現れ且つそのイン
デックスが一次式で表現されている場合、そのループ
を、配列インデックスが一次式で表現された内側ループ
とそれを包含する外側ループとの二重ループに変形した
上でオブジェクトコードを生成することにより、配列を
含むループを最適化やベクトル化の対象とすることがで
きる。Further, when an array appears in a loop and its index is expressed by a linear expression, the loop is divided into an inner loop whose array index is expressed by a linear expression and an outer loop containing the inner loop. By generating object code after transforming into a loop, a loop including an array can be a target of optimization or vectorization.
【図1】本発明を適用したコンパイラの一例を示すブロ
ック図である。FIG. 1 is a block diagram illustrating an example of a compiler to which the present invention is applied.
【図2】ソースプログラム中に現れる配列宣言および配
列を含む実行文の例を示す図である。FIG. 2 is a diagram illustrating an example of an array declaration and an executable statement including an array appearing in a source program.
【図3】分散メモリへの配列の割り付け例を示す図であ
る。FIG. 3 is a diagram showing an example of allocation of arrays to distributed memories.
【図4】アドレス変換コード生成手段で生成されるコー
ドの一例をソースプログラムの表現形式に置き換えて示
した図である。FIG. 4 is a diagram in which an example of a code generated by an address conversion code generation unit is replaced with a representation format of a source program.
【図5】アドレス変換コード生成手段で生成されるコー
ドの別の例をソースプログラムの表現形式に置き換えて
示した図である。FIG. 5 is a diagram in which another example of the code generated by the address conversion code generation means is replaced with an expression format of a source program.
【図6】分散メモリマルチプロセッサシステムの構成例
を示すブロック図である。FIG. 6 is a block diagram illustrating a configuration example of a distributed memory multiprocessor system.
【図7】従来の問題点の説明図である。FIG. 7 is an explanatory diagram of a conventional problem.
1…コンパイラ 11…解析部 111…配列取り出し手段 112…分割サイズ決定手段 113…分散メモリサイズ取り出し手段 12…処理部 121…アドレス変換コード生成手段 13…目的プログラム生成部 2…ソースプログラム 3…第1中間テキスト 4…第2中間テキスト 5…目的プログラム DESCRIPTION OF SYMBOLS 1 ... Compiler 11 ... Analysis part 111 ... Array extraction means 112 ... Division size determination means 113 ... Distributed memory size extraction means 12 ... Processing part 121 ... Address conversion code generation means 13 ... Object program generation part 2 ... Source program 3 ... First Intermediate text 4 ... Second intermediate text 5 ... Objective program
フロントページの続き (56)参考文献 特開 平3−256129(JP,A) 特開 平5−290000(JP,A) 情報処理学会研究会報告(92−ARC −97)、92〜97!(1992−12.)、P. 41−48 情報処理、34〜9!(1993−9)、 P.1150−1157、「自動並列化コンパイ ラ」 (58)調査した分野(Int.Cl.6,DB名) G06F 9/45 G06F 15/16 JICSTファイル(JOIS)Continuation of the front page (56) References JP-A-3-256129 (JP, A) JP-A-5-290,000 (JP, A) IPSJ Technical Report (92-ARC-97), 92-97! (1992-12.), P. 41-48 Information processing, 34-9! (1993-9); 1150-1157, "Automatic parallelizing compiler" (58) Fields investigated (Int. Cl. 6 , DB name) G06F 9/45 G06F 15/16 JICST file (JOIS)
Claims (7)
サ対応に分散メモリを備え各プロセッサは自プロセッサ
対応の分散メモリを直接アクセスし得ると共に他プロセ
ッサ対応の分散メモリをスイッチ網を通じて間接的にア
クセスし得るように構成された仮想共有メモリ方式の分
散メモリマルチプロセッサシステムで実行可能な目的プ
ログラムを生成するコンパイラにおいて、前記ソースプ
ログラム中の実行文において定義または参照される配列
を分割し、各々を、前記分散メモリマルチプロセッサシ
ステムを構成するそれぞれ異なるプロセッサに割り当て
られた分散メモリ上に割り付ける配列のメモリ割り付け
方式において、 前記ソースプログラムから配列宣言を取り出す配列取り
出し手段と、 取り出された配列宣言にかかる配列に対して分割サイズ
を求める分割サイズ決定手段と、 前記配列宣言にかかる配列が前記ソースプログラム中の
実行文に定義または参照される配列として現れた場合
に、その配列を前記求められた分割サイズで分割し、得
られた個々の配列部分に対応するコードとして、個々の
配列部分がそれぞれ異なるプロセッサに割り当てられた
分散メモリ上に割り付けられるような仮想共有メモリア
ドレスで表現されたコードを生成するアドレス変換コー
ド生成手段とを有し、かつ、 前記アドレス変換コード生成手段は、インデックスiの
配列要素に対して、 base+N{int(i/b)×(p−b)+i} 但し、base;当該配列のベースとなるアドレス b;分割サイズ p;各プロセッサに割り当てられた分散メモリのサイズ N;1つの配列要素が占めるメモリ上の記憶単位数 で示される仮想共有メモリアドレスに変換したコードを
生成する ことを特徴とする配列のメモリ割り付け方式。A distributed memory is provided for each processor when a source program is input, and each processor can directly access the distributed memory corresponding to its own processor and indirectly access the distributed memory corresponding to another processor through a switch network. In a compiler for generating a target program executable in a distributed memory multiprocessor system of a virtual shared memory system configured as described above, an array defined or referred to in an execution statement in the source program is divided, and each is divided into the distributed memory Memory allocation of arrays to be allocated on distributed memory allocated to different processors constituting a multiprocessor system
Fetching an array declaration from the source program
Output means and split size for the array associated with the fetched array declaration
And an array according to the array declaration in the source program
When it appears as an array defined or referenced in an executable statement
Then, the array is divided by the obtained division size,
The code corresponding to the individual array part
Array parts were assigned to different processors
A virtual shared memory that can be allocated on distributed memory
Address conversion code that generates a code
And the address conversion code generating means has an index i.
For the array element, base + N {int (i / b) × (p−b) + i} where base; address b as the base of the array ; division size p; size N of distributed memory allocated to each processor A code converted into a virtual shared memory address indicated by the number of storage units on the memory occupied by one array element;
An array memory allocation method characterized by generation .
記配列がループ内に現れ且つそのインデックスが一次式
で表現されている場合、該ループを、配列インデックス
が一次式で表現された内側ループと該内側ループを包含
する外側ループとの二重ループに変形した上でコードを
生成することを特徴とする請求項1記載の配列のメモリ
割り付け方式。2. The address conversion code generation means, when the array appears in a loop and its index is represented by a linear expression, defines the loop as an inner loop whose array index is represented by a linear expression. arrangement of the memory allocation system according to claim 1, wherein the generating the code after having deformed the double loop and outer loop encompassing an inner loop.
ンデックスiが一次式である配列を含むDOループを、 DO i1=1,int((n+b−1)/b) DO i2=i1×p+1,min(i1×p+b,int(n/b) ×(p−b)+n) a(i2) として二重ループ化することを特徴とする請求項2記載
の配列のメモリ割り付け方式。3. The address conversion code generation unit generates a DO loop including an array whose index i is a linear expression by DO i1 = 1, int ((n + b−1) / b) DO i2 = i1 × p + 1, min 3. The array memory allocation method according to claim 2, wherein (i1 * p + b, int (n / b) * (p-b) + n) a (i2) is used to form a double loop.
グラム中に記述された配列の分割サイズを認識して分割
サイズを求めることを特徴とする請求項2または3記載
の配列のメモリ割り付け方式。4. The array memory allocation method according to claim 2, wherein said division size determination means recognizes a division size of an array described in a source program to obtain a division size.
分散メモリマルチプロセッサシステムのプロセッサ数を
調べて各プロセッサに分散される配列部分のサイズが少
なくとも1つのプロセッサを除き均等となるような分割
サイズを求めることを特徴とする請求項2または3記載
の配列のメモリ割り付け方式。5. The division size determining means checks the number of processors of a target distributed memory multiprocessor system and determines a division size such that the size of an array portion distributed to each processor is uniform except for at least one processor. 4. The array memory allocation method according to claim 2, wherein
がソースプログラム中またはコンパイラオプションで指
定されることを特徴とする請求項4または5記載の配列
のメモリ割り付け方式。6. The array memory allocation method according to claim 4, wherein the size of the distributed memory corresponding to each processor is specified in a source program or by a compiler option.
を取り出すコードを生成する分散メモリサイズ取り出し
手段を備え、 前記アドレス変換コード生成手段は、前記分散メモリサ
イズ取り出し手段で生成されたコードによって取り出さ
れた分散メモリのサイズが代入される変数を含むコード
を生成することを特徴とする請求項4または5記載の配
列のメモリ割り付け方式。7. A distributed memory size extracting means for generating a code for extracting the size of the distributed memory corresponding to each processor, wherein the address conversion code generating means is extracted by the code generated by the distributed memory size extracting means. 6. The array memory allocation method according to claim 4 , wherein a code including a variable to which the size of the distributed memory is substituted is generated.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5321229A JP2809073B2 (en) | 1993-11-26 | 1993-11-26 | Array memory allocation method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5321229A JP2809073B2 (en) | 1993-11-26 | 1993-11-26 | Array memory allocation method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH07152582A JPH07152582A (en) | 1995-06-16 |
| JP2809073B2 true JP2809073B2 (en) | 1998-10-08 |
Family
ID=18130258
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP5321229A Expired - Fee Related JP2809073B2 (en) | 1993-11-26 | 1993-11-26 | Array memory allocation method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2809073B2 (en) |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH03256129A (en) * | 1990-03-07 | 1991-11-14 | Hitachi Ltd | Program conversion method and device for parallel computers |
-
1993
- 1993-11-26 JP JP5321229A patent/JP2809073B2/en not_active Expired - Fee Related
Non-Patent Citations (2)
| Title |
|---|
| 情報処理、34〜9!(1993−9)、P.1150−1157、「自動並列化コンパイラ」 |
| 情報処理学会研究会報告(92−ARC−97)、92〜97!(1992−12.)、P.41−48 |
Also Published As
| Publication number | Publication date |
|---|---|
| JPH07152582A (en) | 1995-06-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3551353B2 (en) | Data relocation method | |
| EP1119807B1 (en) | Program code conversion | |
| EP0806725B1 (en) | Method and apparatus for early insertion of assembler code for optimization | |
| US20030196196A1 (en) | Program interpreter | |
| JPH09330233A (en) | Optimum object code generating method | |
| JP2000231545A (en) | Parallel program generation method | |
| US6175935B1 (en) | Software debugging method and recording medium to which debugging program has been recorded | |
| US6334212B1 (en) | Compiler | |
| US6134708A (en) | Program compilation execution system | |
| JP2809073B2 (en) | Array memory allocation method | |
| JPH01118931A (en) | Program conversion method | |
| JP3430635B2 (en) | Constant reference optimization processor | |
| JPH08212081A (en) | Memory allocation method, compilation method and compiler | |
| JPH07105013A (en) | Register allocation system | |
| JPH11345127A (en) | compiler | |
| JP3338466B2 (en) | Main memory access optimization processor | |
| JPS6234240A (en) | Data allotting system | |
| JP3239963B2 (en) | Multi-processor computer system | |
| JP2000020318A (en) | Memory access instruction reduction device and recording medium | |
| JP3551352B2 (en) | Loop splitting method | |
| JPH07129408A (en) | Executing system for language processing program | |
| JP3566602B2 (en) | Compilation method and recording medium recording compilation program | |
| JPH0689187A (en) | Inline expansion optimization method | |
| McFarlin et al. | Library function selection in compiling Octave | |
| JPH04256132A (en) | Optimization system for substitute sentence of high level program language |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |