JPH05120016A - Execution method for parallel logic-type language - Google Patents

Execution method for parallel logic-type language

Info

Publication number
JPH05120016A
JPH05120016A JP27931591A JP27931591A JPH05120016A JP H05120016 A JPH05120016 A JP H05120016A JP 27931591 A JP27931591 A JP 27931591A JP 27931591 A JP27931591 A JP 27931591A JP H05120016 A JPH05120016 A JP H05120016A
Authority
JP
Japan
Prior art keywords
vliw
instruction
parallel
language
goal
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.)
Withdrawn
Application number
JP27931591A
Other languages
Japanese (ja)
Inventor
Yasunori Kimura
康則 木村
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP27931591A priority Critical patent/JPH05120016A/en
Publication of JPH05120016A publication Critical patent/JPH05120016A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To execute a program generated by means of parallel logic-type language at high speed by fetching the parallelism of the instruction levels of parallel logic-type language. CONSTITUTION:At the time of compiling the program 11 mentioned by parallel logic-type language by a compiler 12, the compiler 12 generates an instruction string consisting of respective codes for unifying the arguments A1, A2,... of a goal and the arguments A1, A2,... of a clause, a code for guard and a code for a body like a successive execution instruction string 14. The code for executing the arguments A1, A2,... of the goal and that of the arguments A1, A2,... of the clause are combined to a common VLIW instruction so as to generate a VLIW instruction string 15. When a VLIW parallel computer 16 executes the VLIW instruction string 15, the arguments of the goal and the arguments of the clause are simultaneously unified and it is executed at high speed.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は,VLIW(very long
instruction word)方式の並列計算機上で,GHC,P
arlog,KL1のような並列論理型言語の命令レベ
ルの並列性を取り出すことにより,並列論理型言語によ
って作成されたプログラムを高速に実行できるようにし
た並列論理型言語の実行方法に関する。
BACKGROUND OF THE INVENTION The present invention relates to VLIW (very long).
instruction word) on a parallel computer of GHC, P
The present invention relates to an execution method of a parallel logic type language capable of executing a program created by the parallel logic type language at high speed by taking out the instruction level parallelism of the parallel logic type language such as arlog and KL1.

【0002】近年,対象とする言語から命令レベルの並
列性を取り出すようにコンパイルコードを生成し,それ
をVLIW方式により,並列に高速実行する技術が注目
されている。ここで対象とする言語は,従来は主に数値
計算に用いられるFORTRANであることがほとんど
であった。
In recent years, a technique for generating a compile code so as to extract instruction level parallelism from a target language and executing the compile code in parallel by the VLIW method has attracted attention. In most cases, the target language heretofore was FORTRAN, which is mainly used for numerical calculation.

【0003】一方,このような計算機システム上で人工
知能用の言語といわれる並列論理型言語を効率よく実行
させるような研究開発はほとんどなされていない。並列
論理型言語についても,その特徴を旨く利用し,VLI
W並列計算機上で効率よく実行させることのできる技術
が必要とされる。
On the other hand, little research and development has been done to efficiently execute a parallel logic language called an artificial intelligence language on such a computer system. For parallel logic programming languages, the features of VLI can be used effectively.
There is a need for a technique that can be efficiently executed on a W parallel computer.

【0004】[0004]

【従来の技術】従来,GHC,Parlog,KL1な
どの並列論理型言語は,単一の逐次実行プロセッサある
いは逐次実行のプロセッサを複数接続したシステムで実
行されていた。プロセッサを複数接続した計算機システ
ムでは,各プロセッサにおいていわゆる並列実行が実現
されていたが,この場合の並列実行は,ゴールレベルの
並列実行であって,命令レベルの並列実行は実現されて
いなかった。
2. Description of the Related Art Conventionally, parallel logic languages such as GHC, Parlog, and KL1 have been executed by a single serial processor or a system in which a plurality of serial processors are connected. In a computer system in which a plurality of processors are connected, so-called parallel execution was realized in each processor, but the parallel execution in this case was goal-level parallel execution, and instruction-level parallel execution was not realized.

【0005】[0005]

【発明が解決しようとする課題】本発明は,GHC,P
arlog,KL1などの並列論理型言語の特徴に着目
し,その命令レベルにおける並列性を引き出し,それを
VLIW並列計算機のコンパイルコードに変換して高速
に実行する手段を提供することを目的としている。
The present invention is based on GHC, P
It aims at providing a means for drawing out the parallelism at the instruction level, converting it to the compiled code of the VLIW parallel computer, and executing it at high speed by paying attention to the characteristics of the parallel logic type language such as arlog and KL1.

【0006】[0006]

【課題を解決するための手段】図1は,請求項1に対応
する本発明の原理説明図である。請求項1記載の発明で
は,並列論理型言語のガード部をコンパイルする際に,
ゴールの引数と1つのクローズの引数のユニフィケーシ
ョンを行うコードを共通のVLIW命令に組み込むよう
にコンパイルし,並列論理型言語のガード部の実行にお
いて,VLIW並列計算機16によりゴールの引数と1
つのクローズの引数のユニフィケーションを同時に行
う。
FIG. 1 is a principle explanatory view of the present invention corresponding to claim 1. In FIG. According to the invention of claim 1, when compiling the guard part of the parallel logic language,
The code that performs unification of the goal argument and one close argument is compiled so as to be incorporated in a common VLIW instruction, and when the guard unit of the parallel logic language is executed, the VLIW parallel computer 16 and the goal argument
Unify the two closed arguments simultaneously.

【0007】例えば,図1に示す並列論理型言語で記述
されたプログラム11を,コンパイラ12によってコン
パイルする際,コンパイラ12は,構文解析,意味解析
を行った結果から,逐次実行命令列14のように,ゴー
ルの引数A1,A2,…とクローズの引数A1,A2,
…のユニフィケーションを行うための各コードと,gu
ardのためのコードと,bodyのためのコードから
なる命令列を生成する。この逐次実行命令列14をもと
に,ゴールの引数A1,A2,…とクローズの引数A
1,A2,…を行うためのコードを,共通のVLIW命
令に組み合わせ,VLIW命令列15を生成する。
For example, when compiling the program 11 described in the parallel logic type language shown in FIG. 1 by the compiler 12, the compiler 12 produces a sequential execution instruction sequence 14 based on the result of the syntax analysis and the semantic analysis. , Goal arguments A1, A2, ... and close arguments A1, A2
Each code for unification of ... and gu
An instruction sequence including a code for ard and a code for body is generated. Based on the sequential execution instruction sequence 14, goal arguments A1, A2, ... And close argument A
The codes for performing 1, A2, ... Are combined with a common VLIW instruction to generate a VLIW instruction sequence 15.

【0008】このVLIW命令列15をVLIW並列計
算機16によって実行すると,ゴールの引数と1つのク
ローズの引数のユニフィケーションが同時に行われ,高
速に実行されることになる。なお,この例では,VLI
W命令は一度に4つのオペレーションを実行できると仮
定している。図1では,わかかりやすくするために,A
1〜A4のためのコードが各フィールドに混ざり合うこ
となく置かれているが,実際には,混ぜて命令を置いて
もよい。
When this VLIW instruction sequence 15 is executed by the VLIW parallel computer 16, unification of the goal argument and one closing argument is performed at the same time, which results in high speed execution. In this example, VLI
The W instruction assumes that it can perform four operations at a time. In Fig. 1, in order to make it easier to catch
Although the codes for 1 to A4 are placed in each field without being mixed, in practice, the instructions may be mixed.

【0009】図2は,請求項2に対応する本発明の原理
説明図である。請求項2記載の発明では,複数のボディ
ゴールの引数設定の処理を行うコードを共通のVLIW
命令に組み込むようにコンパイルし,VLIW並列計算
機16により,選択されたクローズの引数の設定を各ボ
ディゴールについて1つずつ行うのではなく,複数のボ
ディゴールについて同時に行う。
FIG. 2 is an explanatory view of the principle of the present invention corresponding to claim 2. According to the second aspect of the present invention, the code for performing the argument setting process of a plurality of body goals is common VLIW.
The VLIW parallel computer 16 compiles so as to be incorporated into an instruction, and the VLIW parallel computer 16 does not set the selected closing arguments one by one for each body goal, but simultaneously for a plurality of body goals.

【0010】例えば,図2に示す並列論理型言語で記述
されたプログラム11を,コンパイラ12によってコン
パイルする際,コンパイラ12は,構文解析,意味解析
を行った結果から,逐次実行命令列14のように,he
adのためのコード,guardのためのコードおよび
各ボディゴールa(A1),b(A2),c(A3)の
ためのコードからなる命令列を生成する。この逐次実行
命令列14をもとに,各ボディゴールa(A1),b
(A2),c(A3)のためのコードを,共通のVLI
W命令に組み合わせ,VLIW命令列15を生成する。
For example, when compiling the program 11 described in the parallel logic type language shown in FIG. 2 by the compiler 12, the compiler 12 produces a sequential execution instruction sequence 14 based on the result of the syntax analysis and the semantic analysis. To he
An instruction sequence including a code for ad, a code for guard, and a code for each body goal a (A1), b (A2), c (A3) is generated. Based on this sequential execution instruction sequence 14, each of the body goals a (A1), b
The codes for (A2) and c (A3) are set to the common VLI.
Combined with the W instruction, the VLIW instruction sequence 15 is generated.

【0011】このVLIW命令列15をVLIW並列計
算機16によって実行すると,ボディの3つの子ゴール
の生成が同時に行われることになる。生成すべき子ゴー
ルが4つ以上ある場合,VLIW命令の4つのフィール
ドがすべて埋まることになる。
When this VLIW instruction sequence 15 is executed by the VLIW parallel computer 16, the three child goals of the body are generated at the same time. If there are four or more child goals to be generated, all four fields of the VLIW instruction will be filled.

【0012】図3は,請求項3に対応する本発明の原理
説明図である。請求項3記載の発明では,選択されたク
ローズのボディゴールの引数として使われるリストまた
はベクタの構造体の作成処理のコードを,事前のデータ
依存のない処理のコードと組み合わせたVLIW命令に
コンパイルし,VLIW並列計算機16による命令実行
において,前記リストまたはベクタの構造体を必要にな
った時点で作るのではなく,データ依存のない個所であ
らかじめ作っておく。
FIG. 3 is an explanatory view of the principle of the present invention corresponding to claim 3. In the invention according to claim 3, the code for creating the list or vector structure used as the argument of the selected body goal for closing is compiled into a VLIW instruction that is combined with the code for the processing that does not depend on data in advance. , The VLIW parallel computer 16 does not create the list or vector structure at the time when it is needed in the instruction execution, but creates it in a data-independent part in advance.

【0013】例えば,図3に示す並列論理型言語で記述
されたプログラム11を,コンパイラ12によってコン
パイルする際,コンパイラ12は,構文解析,意味解析
を行った結果から,逐次実行命令列14のように,he
adのためのコード,guardのためのコードおよび
各ボディゴールa(A1),b(A2),c(A3)の
ためのコードからなる命令列を生成する。この逐次実行
命令列14をもとに,VLIW命令列15を生成する際
に,ボディゴールb( )の引数として使われているリス
ト[a,b,c,d]のデータと事前の処理とのデータ
依存関係を調べ,データ依存がないことがわかった場合
には,リスト[a,b,c,d]を作るコードを,その
データ依存のない処理のコードと組み合わせたVLIW
命令に変換し,VLIW命令列15を生成する。
For example, when compiling the program 11 written in the parallel logic type language shown in FIG. 3 by the compiler 12, the compiler 12 produces a sequential execution instruction sequence 14 based on the result of the syntax analysis and the semantic analysis. To he
An instruction sequence including a code for ad, a code for guard, and a code for each body goal a (A1), b (A2), c (A3) is generated. When the VLIW instruction sequence 15 is generated based on the sequential execution instruction sequence 14, the data of the list [a, b, c, d] used as the argument of the body goal b () and the preprocessing are performed. VLIW in which the code that creates the list [a, b, c, d] is combined with the code that does not depend on the data when the data dependence of
It is converted into an instruction and the VLIW instruction sequence 15 is generated.

【0014】すなわち,この例では,ボディゴールのう
ち,b/2の第2引数のリストをVLIW命令の空きフ
ィールドを使ってあらかじめ生成している。ここで生成
したリストは,b/2の子ゴールを生成するときに使わ
れる。これによって,VLIW並列計算機16による実
行時には,リストやベクタなどの複雑なデータ構造体を
作成する時間を節約することが可能になる。
That is, in this example, of the body goals, the list of the second argument of b / 2 is generated in advance by using the empty field of the VLIW instruction. The list created here is used when creating a b / 2 child goal. As a result, at the time of execution by the VLIW parallel computer 16, it is possible to save the time for creating complicated data structures such as lists and vectors.

【0015】[0015]

【作用】本発明によれば,図1ないし図3に示すよう
に,並列論理型言語の特徴を利用して,VLIW命令列
15にコンパイルし,命令レベルの並列性を引き出すこ
とにより,VLIW並列計算機16による高速実行が可
能になる。
According to the present invention, as shown in FIGS. 1 to 3, the features of the parallel logic language language are utilized to compile into the VLIW instruction sequence 15 to bring out the parallelism at the instruction level. High-speed execution by the computer 16 becomes possible.

【0016】[0016]

【実施例】以下,並列論理型言語の例としてKL1を用
いて,本発明の実施例を説明する。他の並列論理型言語
についても同様に本発明を実施することができる。
Embodiments of the present invention will be described below by using KL1 as an example of a parallel logic language. The present invention can be similarly implemented for other parallel logic languages.

【0017】並列論理型言語KL1は,周知のようにフ
ラットGHC(Flat Guarded HornClauses)に基づいて
設計された言語である。KL1プログラムは,次のよう
なシンタックスを持つクローズの集合として表される。
The parallel logic language KL1 is a language designed based on Flat GHC (Flat Guarded Horn Clauses) as is well known. The KL1 program is represented as a set of closes having the following syntax.

【0018】 H:−G1 ,…,Gm |B1 ,…,Bn .(m≧0,n≧0) ここで,Hはクローズヘッド,Gi はガードゴール,B
i はボディゴールと呼ばれる。オペレータ“|”はコミ
ットメントバーと呼ばれ,クローズ中でこれに先立つ部
分をガード部(または受動部),これに続く部分をボデ
ィ部(または能動部)と呼ぶ。
H: -G 1 , ..., G m | B 1 , ..., B n . (M ≧ 0, n ≧ 0) where H is the close head, G i is the guard goal, and B is
i is called a body goal. The operator “|” is called a commitment bar, and the part preceding the closing bar in the closing is called the guard part (or the passive part), and the part following the part is called the body part (or the active part).

【0019】ここで,ガードゴールとしては,組込述語
しか書けない。これはGHCの言語記述能力を保ちなが
ら,効率的な実現を考慮して採用された制限である。フ
ラットGHCの「フラット」の由来は,この制限からき
ている。また,ボディゴールには,組込述語とユーザ定
義述語の2つの種類が書け,ユーザ定義述語には,実行
順序を指定するためのプライオリティや,マルチプロセ
ッサ環境で実行される際に,実行するプロセッサを指定
するためのプラグマと呼ばれる機能を付加することでが
できる。
Here, only a built-in predicate can be written as a guard goal. This is a restriction adopted in consideration of efficient realization while maintaining the language description capability of GHC. The origin of “flat” of flat GHC comes from this limitation. In addition, two types of built-in predicates and user-defined predicates can be written in the body goal, and the user-defined predicate has a priority for specifying the execution order and the processor to be executed when executing in a multiprocessor environment. This can be done by adding a function called a pragma for specifying.

【0020】KL1プログラムがどのようにして実行さ
れるかについて,以下に説明する。今,次のようなプロ
グラムが与えられて,ゴールHが与えられたとする。 (“|”の左側がガード部,右側がボディ部である。)
このとき,ゴールHの実行は,以下の規則に従って行わ
れる。 1)コミットメントバー“|”の左に書いてあること,
正確には, ・候補節のヘッドと,その節を呼び出したゴールHの同
一化(Unification), ・およびガードゴールの実行 は,複数の候補節に対して並列に実行してよい。しか
し,それらはHを具体化してはならない。具体化しよう
としたなら,その具体化の原因となる同一化がが中断さ
せられる。 2)コミットメントバー“|”の右に書いてあること,
すなわち節のボディゴールは,その節を呼び出したゴー
ルHを具体化してよいが,それができるのは,Hが,複
数の候補節の中からただ一つ“選択”された節に限られ
る。
How the KL1 program is executed will be described below. Now, suppose that the following program is given and the goal H is given. (The left side of "|" is the guard part and the right side is the body part.)
At this time, the goal H is executed according to the following rules. 1) What is written to the left of the commitment bar “|”,
To be precise, the head of a candidate clause and the goal H that calls that clause (Unification), and the execution of a guard goal may be executed in parallel for multiple candidate clauses. However, they must not embody H. If you try to materialize, the identification that causes the materialization will be interrupted. 2) What is written to the right of the commitment bar “|”,
That is, the body goal of a clause may instantiate the goal H that called that clause, but it can only do so if H is the only "selected" clause from among multiple candidate clauses.

【0021】図4は,並列論理型言語のプログラムの例
であって,KL1で記述された素数生成プログラムを示
している。このプログラム11は,“Max”までの素
数を求める。
FIG. 4 shows an example of a parallel logic language program, and shows a prime number generation program described in KL1. This program 11 finds prime numbers up to "Max".

【0022】今,トップレベルのゴールとして,“pr
imes(10,Res)”が与えられると,答とし
て,“Res”に[2,3,5,7]というリストが返
ってくる。この計算過程を以下に説明する。
Now, as a top-level goal, "pr
When "images (10, Res)" is given, the answer is "Res", and the list [2, 3, 5, 7] is returned. The calculation process will be described below.

【0023】まず,トップレベルのゴールが与えられる
と,primesのクローズのガード部の実行に成功
し,ボディ部が実行される。このとき,gen(1,1
0,Ns)とsift(Ns,Ps)の2つのゴールが
生成される。この2つのゴールは,意味的には,どちら
から先に実行してもかまわない。
First, when a top-level goal is given, the close guard part of the primes is successfully executed, and the body part is executed. At this time, gen (1,1
Two goals, 0, Ns) and shift (Ns, Ps) are generated. In terms of meaning, these two goals may be executed first.

【0024】もし,gen(1,10,Ns)のほうか
ら先に実行されると,genの1番目のクローズのガー
ド部の実行が成功するので,そのまま実行を続けること
ができるが,sift(Ns,Ps)のほうが先に実行
されると,ヘッド部の第1引数のユニフィケーションで
実行が中断する。変数Nsの値が決まるまで,この実行
は中断する。したがって,このプログラムでは,gen
(1,10,Ns)のほうが常に先に実行が終わる。
If gen (1,10, Ns) is executed first, the execution of the first closed guard part of gen succeeds, so execution can continue as it is. If Ns, Ps) is executed first, the execution is interrupted by the unification of the first argument of the head part. This execution is suspended until the value of the variable Ns is determined. Therefore, in this program, gen
(1,10, Ns) always ends earlier.

【0025】gen(1,10,Ns)では,Nsに第
1引数で与えられた整数+1から(Max−1)までの
整数を要素とするリストを返す。その後,sift(N
s,Ps)の実行が行われる。siftの実行では,ヘ
ッド部でリストがCar部とCdr部に分けられ,その
後,filter(Xs,P,Ys)とsift(Y
s,Zs1)の2つのゴールが生成される。ここでも,
このゴールの実行はどちらが先でもよいが,sift
(Ys,Zs1)が先に実行されると,第1引数が決ま
っていないために,実行が中断してしまう。
Gen (1,10, Ns) returns a list whose elements are integers from +1 to (Max-1) given by Ns as the first argument. After that, shift (N
s, Ps) is executed. In the execution of shift, the head section divides the list into a Car section and a Cdr section, and then the filters (Xs, P, Ys) and shift (Y
s, Zs1) two goals are generated. even here,
Either of these goals may be executed first, but
If (Ys, Zs1) is executed first, the execution is interrupted because the first argument is not determined.

【0026】filterでは,与えられたリストか
ら,第2引数の整数とその倍数を取り除いたリストを第
3引数に返す。これらの実行の結果,素数が求まる。図
4に示した素数生成プログラムで,filter/3の
プログラムを例にとり,このプログラムがどのようにし
てVLIW命令にコンパイルされ実行されるかを次に説
明する。
In the filter, the list obtained by removing the integer of the second argument and its multiple from the given list is returned to the third argument. As a result of these executions, a prime number is obtained. In the prime number generation program shown in FIG. 4, the filter / 3 program is taken as an example to explain how this program is compiled into the VLIW instruction and executed.

【0027】まず,このプログラムを通常の命令コード
にコンパイルした結果を,図5および図6に示す。ここ
で示したコード列は,KL1−Bと呼ばれ,KL1の抽
象命令セットである。ここで使用されている命令コード
について,簡単に説明すると以下のとおりである。
First, the results of compiling this program into a normal instruction code are shown in FIGS. 5 and 6. The code string shown here is called KL1-B and is an abstract instruction set of KL1. The instruction code used here is briefly described below.

【0028】[try_me_else Label] Labelで示されるアドレスを次候補クローズを表す
レジスタ(ACP)にセットする。この命令に続く命令
で失敗,あるいは実行の中断が起こった場合に,ACP
で示されるアドレスに分岐する。
[Try_me_else Label] The address indicated by Label is set in the register (ACP) indicating the next candidate close. If an instruction following this instruction fails or execution is interrupted, ACP
Branch to the address indicated by.

【0029】[wait_list Reg] Regで示されるレジスタが指すデータがリストである
かどうかをチェックする。リストならば次の命令に移
り,リストでなければ,(try_me_else命令
で設定した)ACPのアドレスに分岐する。
[Wait_list Reg] It is checked whether the data pointed to by the register indicated by Reg is a list. If it is a list, move to the next instruction. If it is not a list, branch to the ACP address (set by the try_me_else instruction).

【0030】[read_car Ai,Aj] レジスタAiで示されるリストのcar部を読み出し
て,レジスタAjに置く。
[Read_car Ai, Aj] The car part of the list indicated by the register Ai is read and placed in the register Aj.

【0031】[read_cdr Ai,Aj] レジスタAiで示されるリストのcdr部を読み出し
て,レジスタAjに置く。
[Read_cdr Ai, Aj] The cdr portion of the list indicated by the register Ai is read and placed in the register Aj.

【0032】[integer Ai] レジスタAiの内容が整数であるかどうかチェックす
る。整数ならば次命令を実行し,整数でなければ,AC
Pのアドレスに分岐する。
[Integer Ai] It is checked whether the content of the register Ai is an integer. If it is an integer, execute the next instruction. If it is not an integer, AC
Branch to address P.

【0033】[modulo Ai,Aj,Ak] レジスタAi,Ajに保持されている整数のmodul
oをとり,結果をレジスタAkに置く。
[Modulo Ai, Aj, Ak] An integer modul held in the registers Ai, Aj.
Take o and put the result in the register Ak.

【0034】 [put_constant Const,Ai] 定数ConstをレジスタAiに置く。 [not_equal Ai,Aj] レジスタAi,Ajの内容(整数)が同じでなければ,
次命令を実行し,同じならばACPのアドレスに分岐す
る。
[Put_constantConst, Ai] The constant Const is placed in the register Ai. [Not_equal Ai, Aj] If the contents (integers) of the registers Ai, Aj are not the same,
Execute the next instruction, and if the same, branch to the ACP address.

【0035】[collect_list Ai] レジスタAiから指されるリストのコンスセルを,ある
条件が満たされる場合に回収する。
[Collect_list Ai] The cons cell of the list pointed to by the register Ai is collected when a certain condition is satisfied.

【0036】[put_list Ai] リストを構成するためのコンスセルを1つ割り当て,レ
ジスタAiから指させる。
[Put_list Ai] One cons cell for structuring the list is allocated and designated from the register Ai.

【0037】 [write_car_value Ai,Aj] レジスタAiから指されるリストのcar部にレジスタ
Ajの内容を置く。 [write_cdr_variable Ai,Aj] 変数セルを1つ割り当て,レジスタAiから指されるリ
ストのcdr部に置くと共に,レジスタAjから指させ
る。
[Write_car_value Ai, Aj] Put the contents of the register Aj in the car part of the list pointed to by the register Ai. [Write_cdr_variableAi, Aj] One variable cell is allocated, placed in the cdr portion of the list pointed to by the register Ai, and pointed by the register Aj.

【0038】 [get_list_value Ai,Aj] レジスタAjの内容(ほとんどの場合,未定義変数)
と,レジスタAiの内容(これは,リストである)のユ
ニフィケーションを行う。多くの場合,Aiの内容をA
jに転送することで処理が完了する。
[Get_list_value Ai, Aj] Contents of register Aj (in most cases, undefined variable)
And unify the contents of the register Ai (this is a list). In many cases, the contents of Ai are A
Processing is completed by transferring to j.

【0039】[put_value Ai,Aj] レジスタAiの内容をレジスタAjに転送する。 [equal Ai,Aj] レジスタAj,Ajの内容(整数)が同じならば,次命
令を実行し,同じでなければ,ACPのアドレスに分岐
する。
[Put_value Ai, Aj] The contents of the register Ai are transferred to the register Aj. [Equal Ai, Aj] If the contents (integers) of the registers Aj, Aj are the same, the next instruction is executed, and if they are not the same, branch to the address of the ACP.

【0040】 [wait_constant Const,Ai] レジスタAiの内容がConstと一致するかどうかの
チェックを行う。もし同じならば,次命令を実行し,同
じでなければ,ACPのアドレスに分岐する。
[Wait_constant Const, Ai] It is checked whether the content of the register Ai matches Const. If they are the same, execute the next instruction, and if they are not the same, branch to the ACP address.

【0041】[collect_value Ai] レジスタAiから指されるデータを再帰的に回収する。 [get_constant Const,Ai] レジスタAiの内容がConstと一致するかどうかを
調べる。もし,Aiが未定義ならば,ConstをAi
に代入する。もし,AiがConstと同じならば,次
命令を実行する。同じでなければ,実行は失敗する。
[Collect_value Ai] The data pointed to by the register Ai is recursively collected. [Get_constantConst, Ai] It is checked whether the content of the register Ai matches Const. If Ai is undefined, set Const to Ai
To. If Ai is the same as Const, the next instruction is executed. If they are not the same, execution fails.

【0042】[proceed] 新しいゴールを1つ,ゴール管理領域(これをゴールス
タックと呼ぶ)から取り出し,ゴールリダクションを始
める。
[Proceed] One new goal is taken out from the goal management area (this is called a goal stack), and goal reduction is started.

【0043】[suspend Label] Labelで示されるゴールの実行を中断し,このゴー
ルを実行中断の原因となった変数にフックする。
[Suspend Label] The execution of the goal indicated by Label is suspended, and this goal is hooked to the variable that caused the suspension of execution.

【0044】[execute Label] Labelで示されるコードアドレスに分岐する。 [create_goal Label] Labelで示されるゴールの引数やコードアドレスを
置くための領域を1つ確保する。これをゴールレコード
と呼ぶ。
[Execute Label] Branches to the code address indicated by Label. [Create_goal Label] One area is reserved for placing the argument and code address of the goal indicated by Label. This is called a goal record.

【0045】[set_value Ai,Gj] レジスタAiの内容をゴールレコードの引数スロットの
Gjの位置に置く。 [enqueue_goal Label] Labelで示されるゴールレコードをゴールスタック
の先頭に置く。
[Set_value Ai, Gj] The content of the register Ai is placed at the position of Gj in the argument slot of the goal record. [Enqueue_goal Label] Place the goal record indicated by Label at the top of the goal stack.

【0046】 [write_car_constant Ai,Const] レジスタAiから示されるリストのcar部にCons
tを置く。 [write_cdr_constant Ai,Const] レジスタAiから示されるリストのcdr部にCons
tを置く。
[Write_car_constant Ai, Const] Cons in the car part of the list indicated by the register Ai.
put t. [Write_cdr_constant Ai, Const] Cons in the cdr part of the list indicated by the register Ai.
put t.

【0047】図5および図6に示す逐次実行命令列14
において,(1)から(17)の命令列は,図4に示す
1番目のfilterクローズ,(18)から(29)
の命令列は,図4に示す2番目のfilterクロー
ズ,(30)から(34)の命令列は,図4に示す3番
目のfilterクローズに対応している。(35)は
実行が中断したときの処理を行う命令である。
Sequential execution instruction sequence 14 shown in FIGS. 5 and 6.
4, the instruction sequence from (1) to (17) is the first filter close, (18) to (29) shown in FIG.
4 corresponds to the second filter close shown in FIG. 4, and the instruction sequence from (30) to (34) corresponds to the third filter close shown in FIG. (35) is an instruction for performing processing when execution is interrupted.

【0048】図5および図6に示すような命令列を,V
LIW並列計算機16で実行するために,VLIW命令
列15に変換する。図7は,本発明の実施例で用いるV
LIW並列計算機の例を示している。
An instruction sequence as shown in FIGS.
It is converted into the VLIW instruction sequence 15 for execution by the LIW parallel computer 16. FIG. 7 shows V used in the embodiment of the present invention.
An example of a LIW parallel computer is shown.

【0049】図7の(ロ)に示すVLIW並列計算機1
6が実行する命令フォーマットは,図7の(イ)に示す
ようになっており,命令フィールド数が3である。ここ
では,各命令フィールドの機能は均質であるとする。た
だし,命令フィールド数,各フィールドの均質/不均質
については,ターゲットとする並列計算機の個々のアー
キテクチャに依存し,このようにフィールド数が3で均
質と決めることは本質的なことではない。VLIW並列
計算機16は,(イ)に示すような命令フォーマットの
VLIW命令を,メモリから命令キャッシュ70に読み
込み,各命令フィールドについて,それぞれデコーダ7
1によりデコードし,演算ユニット72によりデコード
結果に基づいて同時に演算を実行する。演算ユニット7
2は,データキャッシュ73へのアクセスを行う。
The VLIW parallel computer 1 shown in FIG.
The instruction format executed by 6 is as shown in FIG. 7A, and the number of instruction fields is 3. Here, it is assumed that the function of each command field is uniform. However, the number of instruction fields and the homogeneity / inhomogeneity of each field depend on the individual architecture of the target parallel computer, and thus it is not essential to determine that the number of fields is 3 and that the fields are homogeneous. The VLIW parallel computer 16 reads a VLIW instruction having an instruction format as shown in (a) from the memory into the instruction cache 70, and for each instruction field, the decoder 7
1 is used for decoding, and the arithmetic unit 72 executes arithmetic operations simultaneously based on the decoding result. Arithmetic unit 7
2 accesses the data cache 73.

【0050】図5および図6に示す逐次実行命令列14
を,VLIW命令列15に変換する場合,命令フィール
ド数は3,各フィールドの機能は均質であると仮定して
いるから,命令間に依存関係がなければ,それを次々に
命令フィールドに埋め込んでいけばよい。
Sequential execution instruction sequence 14 shown in FIGS. 5 and 6.
Is converted into a VLIW instruction sequence 15, it is assumed that the number of instruction fields is 3, and the function of each field is uniform, so if there is no dependency between instructions, embed them in the instruction field one after another. Go!

【0051】命令間の依存関係には,あるデータが引数
レジスタにセットされ,その後参照というデータ依存,
参照の後更新という逆依存,同じレジスタにデータがセ
ットされる順を保障する出力依存などがある。
In the dependency relationship between instructions, certain data is set in the argument register and then referred to as data dependency,
There is an inverse dependency called update after reference, and an output dependency that guarantees the order in which data is set in the same register.

【0052】今の例の場合には,これらの依存関係は,
命令の引数のレジスタ番号が同じかどうかで判断する。
すなわち,同じレジスタ番号が使われている場合には,
依存関係があるとみなし,同じVLIW命令のフィール
ドには埋めないこととする。
In the present example, these dependencies are
Judges whether the register numbers of the instruction arguments are the same.
That is, if the same register number is used,
It is assumed that there is a dependency relationship, and the fields of the same VLIW instruction are not filled.

【0053】図5の例で示すと,命令(1)は命令
(2)の前に実行されなければならないから,命令
(1),(2)を1つのVLIW命令に組み込むことは
できない。これらの関係を示すために,図8に示すよう
な命令間の依存関係を示すグラフを作る。図8に示す数
値は,図5に示す命令の番号(1)〜(17)に対応し
ている。VLIW命令列15にコンパイルするには,図
8に示すグラフに基づいて命令のコードを埋めていけば
よいことになる。
In the example of FIG. 5, since the instruction (1) must be executed before the instruction (2), the instructions (1) and (2) cannot be incorporated in one VLIW instruction. In order to show these relationships, a graph showing the dependency relationship between instructions as shown in FIG. 8 is created. The numerical values shown in FIG. 8 correspond to the instruction numbers (1) to (17) shown in FIG. In order to compile the VLIW instruction sequence 15, it is sufficient to fill the instruction code based on the graph shown in FIG.

【0054】このようにしてコンパイルした結果を,図
9の(イ)に示す。この例では,対象としたクローズが
比較的簡単であるので,3つの命令フィールドのうち,
2つしか使われていないが,それでも逐次に実行する場
合には17ステップかかったのに対し,10ステップで
終わっていることがわかる。
The result of compiling in this way is shown in FIG. In this example, the target close is relatively easy, so
Although only two are used, it can be seen that it took 10 steps to execute 17 steps when executed sequentially.

【0055】図9の(イ)に示す命令列のステップ2で
は,第1引数がリストかどうかのチェックと,第2引数
が整数型のタイプを持つデータであるかどうかのチェッ
クが同時に行われている。ステップ3では,第1引数で
与えられたリストの分解を同時に行っている。さらにス
テップ4では,第1引数で与えられたリストのcar部
が整数型のタイプを持つデータであるかどうかのチェッ
クと,レジスタに整数の0を置く操作とを同時に行って
いる。このようにコンパイルすることにより,ガード部
でのユニフィケーションを同時に行うことができる。
In step 2 of the instruction sequence shown in FIG. 9A, it is simultaneously checked whether the first argument is a list and whether the second argument is data having an integer type. ing. In step 3, the list given by the first argument is decomposed at the same time. Further, in step 4, it is simultaneously checked whether or not the car part of the list given by the first argument is data having an integer type, and the operation of placing an integer 0 in the register. By compiling in this way, unification in the guard part can be performed at the same time.

【0056】図9の(イ)に示すコンパイル結果では,
ボディ部で使う構造体などを,ガード部であらかじめ作
っておくといった操作は行っていない。このような操作
を行ってさらに最適化すると,結果は図9の(ロ)に示
すようになる。
In the compilation result shown in FIG. 9A,
The structure used in the body is not pre-made in the guard. When further optimization is performed by performing such an operation, the result is as shown in FIG.

【0057】ただし,この場合,もしこのクローズが選
択されず,別のクローズの選択にいった場合などには,
あらかじめ作った構造体のためのメモリ領域を解放する
といった操作が必要になる。しかし,この場合には,8
ステップで実行できることになり,逐次の場合に比べて
約2倍の速度向上が期待できる。
However, in this case, if this close is not selected and another close is selected,
An operation such as releasing the memory area for the structure created in advance is required. However, in this case,
It can be executed in steps, and it is expected that the speed will be about twice as fast as the sequential case.

【0058】以上は,ガード部の実行におけるゴールの
引数と1つのクローズの引数とのユニフィケーションを
同時に行うことの説明であった。次に,以下のようなボ
ディ部にゴールが多く書かれているクローズのボディ部
の実行を同時に行う方法についての例を説明する。次の
ようなクローズを考える。
The above is a description of performing unification of the goal argument and one close argument in the execution of the guard unit at the same time. Next, an example of a method of simultaneously executing the closed body part in which many goals are written in the following body part will be described. Consider the following close.

【0059】 P(X,Y) :- true|q(x), r([100|X],Y), s([Y],X), t(Y,X). この例の逐次実行の場合のコンパイルコードは,図10
および図11に示す逐次実行命令列14のようになる。
P (X, Y):-true | q (x), r ([100 | X], Y), s ([Y], X), t (Y, X). The compile code for sequential execution of this example is shown in FIG.
And the sequential execution instruction sequence 14 shown in FIG.

【0060】この命令を逐次に実行すると,20ステッ
プかかることになる。なお,実行が中断しない場合のス
テップ数が20で,21番目の命令は実行が中断したと
きの処理を行う命令である。
When this instruction is sequentially executed, it takes 20 steps. The number of steps is 20 when execution is not interrupted, and the 21st instruction is an instruction for performing processing when execution is interrupted.

【0061】今,図10および図11に示す命令列を,
図7に示す命令フィールドが3つあるVLIW並列計算
機16で実行することを考える。この命令列のほとんど
は,ボディ部のゴールの引数を準備するために使われて
いる。そこで,このボディゴールの引数の準備を並列に
行うことを考える。
Now, the instruction sequence shown in FIGS. 10 and 11 is
Consider execution on a VLIW parallel computer 16 having three instruction fields shown in FIG. Most of this sequence of instructions is used to prepare the arguments for the goal of the body part. Therefore, consider preparing the arguments of this body goal in parallel.

【0062】この例では,ステップ(2)〜(5),ス
テップ(6)〜(12),ステップ(13)〜(19)
の3つの部分が,それぞれt/2,s/2,r/2のた
めの引数準備部分である。この引数準備部分は,今の実
行環境でのデータの値のゴールレコードにセットするだ
けで,デスティネーションは常に新しいメモリ領域であ
るから,データ依存を考慮する必要はなく,単純にデー
タをセットする命令列を各フィールドに並べればよい。
ただし,create_goal,enqueue_g
oalのように,大域変数にアクセスする可能性のある
命令は,1つのVLIW命令には置かないほうが,ハー
ドウェアの作りは簡単になる。
In this example, steps (2) to (5), steps (6) to (12), and steps (13) to (19).
Are the argument preparation parts for t / 2, s / 2, and r / 2, respectively. This argument preparation part is simply set in the goal record of the value of the data in the current execution environment. Since the destination is always a new memory area, there is no need to consider the data dependency, and the data is simply set. The instruction sequence may be arranged in each field.
However, create_goal, enqueue_g
It is easier to make hardware if an instruction that may access a global variable such as oal is not placed in one VLIW instruction.

【0063】こうして,図10および図11に示す逐次
実行命令列14をVLIW命令列に変換したコンパイル
結果の例を,図12に示す。図12に示すようにコンパ
イルコードを組み立てることにより,8ステップで実行
できることになり,逐次実行の場合の20ステップに比
べて,2倍以上の速度向上が得られていることがわか
る。
FIG. 12 shows an example of a compilation result obtained by converting the sequential execution instruction sequence 14 shown in FIGS. 10 and 11 into a VLIW instruction sequence. By assembling the compiled code as shown in FIG. 12, it can be executed in 8 steps, and it can be seen that the speed is more than doubled compared with 20 steps in the case of sequential execution.

【0064】[0064]

【発明の効果】以上説明したように,本発明によれば,
KL1プログラムなどの並列論理型言語で記述されたプ
ログラムを,並列論理型言語の特徴を利用して,VLI
W方式の並列計算機の命令列にコンパイルし,実行する
ことにより,高速に実行できるようになる。
As described above, according to the present invention,
A program written in a parallel logic language such as a KL1 program can be used for VLI by utilizing the characteristics of the parallel logic language.
High-speed execution can be achieved by compiling and executing the instruction sequence of the W-type parallel computer.

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

【図1】本発明の原理説明図である。FIG. 1 is a diagram illustrating the principle of the present invention.

【図2】本発明の原理説明図である。FIG. 2 is a diagram illustrating the principle of the present invention.

【図3】本発明の原理説明図である。FIG. 3 is a diagram illustrating the principle of the present invention.

【図4】本発明の実施例を説明するための並列論理型言
語のプログラムの例を示す図である。
FIG. 4 is a diagram showing an example of a parallel logic language program for explaining an embodiment of the present invention.

【図5】逐次実行命令列へのコンパイルの例を示す図で
ある。
FIG. 5 is a diagram showing an example of compilation into a sequential execution instruction sequence.

【図6】逐次実行命令列へのコンパイルの例を示す図で
ある。
FIG. 6 is a diagram showing an example of compilation into a sequential execution instruction sequence.

【図7】本発明の実施例で用いるVLIW並列計算機の
例を示す図である。
FIG. 7 is a diagram showing an example of a VLIW parallel computer used in an embodiment of the present invention.

【図8】本発明の実施例を説明するための命令間の依存
関係説明図である。
FIG. 8 is an explanatory diagram of a dependency relationship between instructions for explaining an embodiment of the present invention.

【図9】本発明の実施例によるコンパイル結果を示す図
である。
FIG. 9 is a diagram showing a compilation result according to an embodiment of the present invention.

【図10】ボディ部の逐次実行命令列へのコンパイルの
例を示す図である。
FIG. 10 is a diagram showing an example of compiling a body part into a sequence of sequential execution instructions.

【図11】ボディ部の逐次実行命令列へのコンパイルの
例を示す図である。
FIG. 11 is a diagram illustrating an example of compiling a body part into a sequential execution instruction sequence.

【図12】本発明の実施例によるコンパイル結果を示す
図である。
FIG. 12 is a diagram showing a compilation result according to an embodiment of the present invention.

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

10 実行するゴール 11 並列論理型言語のプログラム 12 コンパイラ 13 コンパイルコード 14 逐次実行命令列 15 VLIW命令列 16 VLIW並列計算機 10 Goal to be executed 11 Program of parallel logic language 12 Compiler 13 Compile code 14 Sequential execution instruction sequence 15 VLIW instruction sequence 16 VLIW parallel computer

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 並列論理型言語によって作成されたプロ
グラム(11)をVLIW並列計算機(16)で実行する並列論
理型言語の実行方法において,並列論理型言語のガード
部をコンパイルする際に,ゴールの引数と1つのクロー
ズの引数のユニフィケーションを行うコードを共通のV
LIW命令に組み込むようにコンパイルし,並列論理型
言語のガード部の実行において,VLIW並列計算機に
よりゴールの引数と1つのクローズの引数のユニフィケ
ーションを同時に行うことを特徴とする並列論理型言語
の実行方法。
1. A goal of compiling a guard part of a parallel logic language language in a parallel logic language language execution method for executing a program (11) created by a parallel logic language language on a VLIW parallel computer (16). The code that performs the unification of the arguments of
A method for executing a parallel logic language characterized by compiling so as to be embedded in a LIW instruction and performing unification of a goal argument and one closed argument at the same time by a VLIW parallel computer in executing a guard part of the parallel logic language ..
【請求項2】 並列論理型言語によって作成されたプロ
グラム(11)をVLIW並列計算機(16)で実行する並列論
理型言語の実行方法において,複数のボディゴールの引
数設定の処理を行うコードを共通のVLIW命令に組み
込むようにコンパイルし,VLIW並列計算機により,
選択されたクローズの引数の設定を各ボディゴールにつ
いて1つずつ行うのではなく,複数のボディゴールにつ
いて同時に行うことを特徴とする並列論理型言語の実行
方法。
2. In a parallel logic language execution method for executing a program (11) created by a parallel logic language language on a VLIW parallel computer (16), a common code for setting arguments of a plurality of body goals is shared. Compile to be incorporated into the VLIW instruction of
A method for executing a parallel logic language, characterized in that the selected closing arguments are not set for each body goal one at a time, but for a plurality of body goals simultaneously.
【請求項3】 並列論理型言語によって作成されたプロ
グラム(11)をVLIW並列計算機(16)で実行する並列論
理型言語の実行方法において,選択されたクローズのボ
ディゴールの引数として使われるリストまたはベクタの
構造体の作成処理のコードを,事前のデータ依存のない
処理のコードと組み合わせたVLIW命令にコンパイル
し,VLIW並列計算機による命令実行において,前記
リストまたはベクタの構造体を必要になった時点で作る
のではなく,データ依存のない個所であらかじめ作って
おくことを特徴とする並列論理型言語の実行方法。
3. A list or a list used as an argument of a selected closed body goal in a parallel logic language execution method for executing a program (11) created by a parallel logic language language on a VLIW parallel computer (16). When the list or vector structure is needed in the VLIW parallel computer by compiling the vector structure creation processing code into a VLIW instruction that is combined with the previous data independent processing code. A parallel logic language execution method characterized in that it is created in advance in a place that does not depend on data, instead of in.
JP27931591A 1991-10-25 1991-10-25 Execution method for parallel logic-type language Withdrawn JPH05120016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP27931591A JPH05120016A (en) 1991-10-25 1991-10-25 Execution method for parallel logic-type language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP27931591A JPH05120016A (en) 1991-10-25 1991-10-25 Execution method for parallel logic-type language

Publications (1)

Publication Number Publication Date
JPH05120016A true JPH05120016A (en) 1993-05-18

Family

ID=17609460

Family Applications (1)

Application Number Title Priority Date Filing Date
JP27931591A Withdrawn JPH05120016A (en) 1991-10-25 1991-10-25 Execution method for parallel logic-type language

Country Status (1)

Country Link
JP (1) JPH05120016A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2254002A1 (en) 1996-07-22 2010-11-24 Dai Nippon Printing Co., Ltd. Hologram-recorded medium and method of fabricating hologram-recorded media

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2254002A1 (en) 1996-07-22 2010-11-24 Dai Nippon Printing Co., Ltd. Hologram-recorded medium and method of fabricating hologram-recorded media
EP2254001A1 (en) 1996-07-22 2010-11-24 Dai Nippon Printing Co., Ltd. Reflection type color display device comprising reflection type hologram color filter

Similar Documents

Publication Publication Date Title
Midkiff Automatic parallelization: an overview of fundamental compiler techniques
Aiken et al. A development environment for horizontal microcode
US7308680B2 (en) Intermediate representation for multiple exception handling models
US6530079B1 (en) Method for optimizing locks in computer programs
Beck et al. From control flow to dataflow
Rinard et al. Commutativity analysis: A new analysis framework for parallelizing compilers
JP2001166949A (en) Method and device for compiling source code by using symbolic execution
US20050028141A1 (en) Compilation of unified parallel C-language programs
Costa Compile-time analysis for the parallel execution of logic programs in andorra-i
Ferrante et al. A program form based on data dependency in predicate regions
Six Optimized and formally-verified compilation for a VLIW processor
Beer Concepts, design, and performance analysis of a parallel prolog machine
Jagannathan Dataflow models
Lee et al. A constant propagation algorithm for explicitly parallel programs
Böhm et al. From non-determinism to goroutines: A fair implementation of curry in go
Campbell et al. Refining and defining the program dependence web
Hanus et al. A monadic implementation of functional logic programs
JPH05120016A (en) Execution method for parallel logic-type language
Evripidou et al. Incorporating input/output operations into dynamic data-flow graphs
Lindgren The Compilation and Execution of Recursion-Parallel Prolog on Shared Memory Multiprocessors
Ginsbach From constraint programming to heterogeneous parallelism
Selim et al. Carrying on the legacy of imperative languages in the future parallel computing era
Mountjoy et al. Modular operational semantic specification of transport triggered architectures
Suvanpong Evaluating Kiama abstract state machines for a Java implementation
Ellmenreich et al. Application of the polytope model to functional programs

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19990107