JPH10171653A - Branch estimation method for information processor and device using the method - Google Patents

Branch estimation method for information processor and device using the method

Info

Publication number
JPH10171653A
JPH10171653A JP9065997A JP6599797A JPH10171653A JP H10171653 A JPH10171653 A JP H10171653A JP 9065997 A JP9065997 A JP 9065997A JP 6599797 A JP6599797 A JP 6599797A JP H10171653 A JPH10171653 A JP H10171653A
Authority
JP
Japan
Prior art keywords
branch
result
weight
information
branch prediction
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
JP9065997A
Other languages
Japanese (ja)
Inventor
So Takamatsu
創 高松
Masaya Kitaguchi
雅也 北口
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.)
JFE Engineering Corp
Original Assignee
NKK Corp
Nippon Kokan 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 NKK Corp, Nippon Kokan Ltd filed Critical NKK Corp
Priority to JP9065997A priority Critical patent/JPH10171653A/en
Publication of JPH10171653A publication Critical patent/JPH10171653A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)

Abstract

PROBLEM TO BE SOLVED: To attain the branch estimation via a neural network and in response to every execution pattern of each execution program by updating occasionally the neuron weight set by the preceding branch result to the value set by the latest branch result. SOLUTION: An input pattern is updated as Xi+1 (t+1)=Xi every time the branch result is obtained. At the same time, a weight information pattern corresponding to the input pattern is produced based on the weight information that is obtained via a neural network. The weight information W1, W2...Wn of the weight information pattern are inputted to each neuron of the neural network that is constructed in a hierarchical structure, for example, and undergo such arithmetic processing as a product-sum operation and the addition/ subtraction to obtain the branch estimation result Yt. Then the weight information is updated based on the actual branch result (dt) and the result Yt as W (t+1)=[W(t)±νX(t)] every time the weight result is obtained.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、マイクロプロセッ
サ等の命令処理装置のパイプラインを用いたデータ処理
に係り、実行するプログラム毎にニューラルネットワー
クを用いて分岐予測を行う情報処理装置の分岐予測方式
及びそれを用いた装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to data processing using a pipeline of an instruction processing device such as a microprocessor, and a branch prediction method for an information processing device for performing a branch prediction using a neural network for each program to be executed. And an apparatus using the same.

【0002】[0002]

【従来の技術】一般に、処理能力を高めるために、マイ
クロプロセッサ等の命令処理装置内で複数の命令をオー
バーラップさせて処理する方式があり、例えば、1命令
の実行過程をパイプラインという複数のステージに分割
して、ステージごとに独立実行できるハードウエアを装
備し、これらの複数のステージを並列に稼働させるオー
バーラップ命令実行方式である。
2. Description of the Related Art In general, there is a method of processing a plurality of instructions in an instruction processing apparatus such as a microprocessor so as to overlap the processing in order to enhance the processing capability. This is an overlap instruction execution method in which hardware that can be divided into stages and can be executed independently for each stage is provided, and these stages are operated in parallel.

【0003】この方式においては、命令のフェッチ段と
実行段のような単純なものからフェッチ、デコード、ア
ドレス計算、データ演算の実行及び格納というように処
理ステージを細分化した複雑なものまで可能なアーキテ
クチュアである。
[0003] In this system, the processing can be as simple as an instruction fetch stage and an execution stage, or as complex as the processing stages are subdivided such as fetch, decode, address calculation, data operation execution and storage. It is an architecture.

【0004】図6(1)に示すパイプラインにおいて、
例えば、I(命令フェッチ),R(命令デコード/レジ
スタフェッチ),A(命令実行),M(メモリアクセ
ス),W(レジスタ書き出し)の5段のステージからな
る命令を処理する場合に、第1の命令のIステージを処
理し、次のRステージに移行した時に、第2の命令のI
ステージが同時に入力し、並列して処理される。さら
に、第1の命令がAステージ、第2の命令がRステージ
に進む時、第3の命令のIステージが入力して、最大5
つのステージの処理を同時に行い、それらの処理をオー
バーラップさせた分だけ同じ時間(クロック)における
処理能力は向上する。
In the pipeline shown in FIG.
For example, when processing an instruction having five stages of I (instruction fetch), R (instruction decode / register fetch), A (instruction execution), M (memory access), and W (register writing), the first When the I stage of the second instruction is processed and the process proceeds to the next R stage, the I stage of the second instruction is processed.
Stages are input simultaneously and processed in parallel. Furthermore, when the first instruction proceeds to the A stage and the second instruction proceeds to the R stage, the I instruction of the third instruction is input and a maximum of 5
Processing of two stages is performed at the same time, and the processing capability at the same time (clock) is improved by the overlap of the processing.

【0005】このパイプラインによる処理は、並列処理
を行っているため、例えば、第1の命令の途中のAステ
ージで分岐が発生し、分岐先アドレスが決定した時に
は、すでに第2,第3の命令のアドレスがCPUに取り
込まれている。そのため、予測して入力したアドレスと
異なる分岐先のアドレスが決定された場合に、取り込ん
だ分の命令は、図6(a)に示す構成例では、第2以降
の命令をすべてを廃棄することとなり、その後、再度、
決定されたアドレスの命令をCPUに取り込むパイプラ
イン・ストールが発生する。これは、分岐先が取り込ん
だものと異なっている度に、再度、取り込みを行わなけ
ればならなくなるこのような処理におけるペナルティ
は、ステージが多段になるほど大きくなる。
[0005] In this pipeline processing, since parallel processing is performed, for example, when a branch occurs at the A stage in the middle of the first instruction and the branch destination address is determined, the second and third processing are already performed. The address of the instruction has been captured by the CPU. Therefore, when a branch destination address different from the predicted and input address is determined, in the example of the configuration shown in FIG. 6A, all the instructions after the second instruction are discarded. And then again
A pipeline stall that takes in the instruction at the determined address into the CPU occurs. This is because the penalty in such a process that the fetch must be performed again every time the branch destination is different from the fetched one becomes larger as the number of stages increases.

【0006】例えば、処理時間の高速化を図るために、
このようなパイプラインの各ステージをさらに細かくし
た図6(b)に示すようなスーパーパイプラインが考え
られている。図示したスーパーパイプラインは、Iステ
ージを、I1ステージ,I2ステージの2つのステージに
分割したものであり、10段のスーパーパイプラインと
なる。
For example, in order to shorten the processing time,
A super pipeline as shown in FIG. 6B, in which each stage of such a pipeline is further refined, has been considered. The illustrated super pipeline is obtained by dividing the I stage into two stages, an I1 stage and an I2 stage, and is a 10-stage super pipeline.

【0007】前述したパイプラインでは、同時に5つの
命令がCPUに取り込まれるが、このスーパーパイプラ
インの場合には、10個の命令を同時にCPUに取り込
んで並列処理している。このスーパーパイプラインにお
いては、前述した分岐ペナルティが大きくなるので、よ
り的中率の高い分岐予測が必要になる。
In the above-described pipeline, five instructions are fetched by the CPU at the same time. In the case of the super pipeline, ten instructions are fetched by the CPU at the same time and are processed in parallel. In this super pipeline, the above-mentioned branch penalty becomes large, so that a branch prediction having a higher hit ratio is required.

【0008】従って、この方式を採用するためには、分
岐命令の有無の予測が重要な問題となる。
Therefore, in order to adopt this method, it is important to predict the presence or absence of a branch instruction.

【0009】従来の分岐予測においては、命令実行にお
ける過去数回の分岐命令の履歴を分岐情報として保持し
ておき、次の分岐命令が発生したとき、事前に定められ
た判定タグ情報に基づいて分岐の有無の予測を決定す
る。
In the conventional branch prediction, a history of several previous branch instructions in instruction execution is held as branch information, and when the next branch instruction is generated, based on predetermined determination tag information. Determine the prediction of the presence or absence of a branch.

【0010】図7に示すように、例えば、○(分岐あ
り),×(分岐なし)の2レベルの分岐予測を行う場合
に、まず、前回以前の各分岐命令毎に過去回数の分岐歴
を保存しておく。この例では、前回、前々回、その前回
の3回の○、×をヒストリバッファに記憶しておき、全
てのパターンについて分岐ヒストリタグで予測を行い、
判断ビットを作成する。これは、最大値3,最小値0の
範囲で、実際に分岐された場合には、1を足し、分岐し
なかった場合には、1を引く。
As shown in FIG. 7, for example, when a two-level branch prediction of ○ (with branch) and × (without branch) is performed, first, the branch history of the past number of times is stored for each previous branch instruction. Save it. In this example, the previous and next times and the previous three times ○ and × are stored in the history buffer, and all patterns are predicted with the branch history tag,
Create a decision bit. This means that in the range of the maximum value 3 and the minimum value 0, 1 is added when branching is actually performed, and 1 is subtracted when branching is not performed.

【0011】この例では、0,1であれば、分岐をしな
いものと判定し、2,3であれば分岐が行われるものと
判断する。例えば、過去の分岐命令が×,○,○であっ
た場合には、次は分岐するものと想定し、×,×,○の
次では分岐しないものと想定する。
In this example, if it is 0 or 1, it is determined that the branch is not taken, and if it is 2 or 3, it is determined that the branch is taken. For example, if the past branch instruction is x, o, o, it is assumed that the next branch will be taken, and that no branch will be taken after x, x, o.

【0012】通常、このような判定タグによる分岐予測
をパイプラインに用いて実施していた。
[0012] Usually, branch prediction using such a determination tag is performed using a pipeline.

【0013】[0013]

【発明が解決しようとする課題】前述したパイプライン
やスーパーパイプラインに用いる分岐予測は、経験則や
統計的に求められた判定タグにより行っている。つま
り、事前に固定的に準備された判定タグを用いているた
め、処理を行うプログラムの実行パターンによっては、
判定タグのパターンと適合しない場合があり、分岐予測
が的中する確率(以下、的中率と称する)が低下する恐
れがある。
The branch prediction used in the above-mentioned pipeline and super pipeline is performed by an empirical rule or a statistically determined judgment tag. In other words, since the determination tag prepared in advance is used, depending on the execution pattern of the program that performs the processing,
There is a case where the pattern does not match the pattern of the determination tag, and the probability that the branch prediction is correct (hereinafter, referred to as the hit rate) may be reduced.

【0014】従って、このように作成された判定タグで
は、必ずしも実行するプログラムに沿ったパターンに基
づいて分岐予測を行なうことができず、再度命令の取り
込みを行わねばならないパイプライン・ストールが発生
して、処理速度が遅くなっていた。
Therefore, in the judgment tag created in this way, it is not always possible to make a branch prediction based on a pattern in accordance with a program to be executed, and a pipeline stall has to be performed again to fetch instructions. And the processing speed was slow.

【0015】そこで本発明は、ニューラルネットワーク
を用いて、それぞれの実行プログラムの実行パターン毎
に適応して分岐予測を行う情報処理装置の分岐予測方式
及びそれを用いた装置を提供することを目的とする。
SUMMARY OF THE INVENTION It is an object of the present invention to provide a branch prediction method of an information processing apparatus for performing a branch prediction adaptively for each execution pattern of each execution program by using a neural network, and an apparatus using the same. I do.

【0016】[0016]

【課題を解決するための手段】本発明は上記目的を達成
するために、入力されたプログラムの実行パターンに沿
って処理を行う情報処理装置の分岐予測方式において、
前記プログラム毎に、処理の際に得られる分岐の有無の
結果を蓄積した履歴情報を学習情報に用い、最新の分岐
結果を正解情報として、前回の分岐結果に基づくニュー
ロンの重みを最新の分岐結果に基づく値に随時、更新す
ることにより、前記重みを前記プログラムの実行パター
ンに適応させて学習するニューラルネットワークを構築
し、前記ニューラルネットワークで次回の分岐有無の予
測を行う情報処理装置の分岐予測方式を提供する。
SUMMARY OF THE INVENTION In order to achieve the above object, the present invention provides a branch prediction system for an information processing apparatus which performs processing according to an execution pattern of an input program.
For each program, the history information obtained by storing the result of the presence or absence of the branch obtained at the time of processing is used as learning information, and the latest branch result is used as correct information, and the weight of the neuron based on the previous branch result is used as the latest branch result. Branch prediction method of an information processing apparatus that builds a neural network that learns by adapting the weight to the execution pattern of the program by updating the weight as needed based on the neural network, and predicts the presence or absence of the next branch using the neural network. I will provide a.

【0017】また、入力されたプログラムの実行パター
ンに沿って処理を行う情報処理装置の分岐予測装置にお
いて、重み情報を記憶可能なニューロンで構築されたニ
ューラルネットで構成され、入力された更新値により記
憶する重み情報を随時更新し、新たな重み情報を生成し
保持する重みバッファ手段と、分岐の発生を指示する信
号が入力され、指示された信号に基づき前回までの分岐
結果を出力する分岐予測バッファ手段と、前記重みバッ
ファ手段からの重み情報、前記分岐予測バッファ手段か
らの前回までの分岐結果及び、最新の分析結果から重み
情報を更新する更新値を生成する更新値生成手段と、前
記重みバッファ手段からの重み情報と、前記分岐予測バ
ッファ手段からの前回までの分岐結果とにより分岐予測
を生成する分岐予測生成手段段と、前記分岐予測に基づ
き、分岐する場合の論理アドレス若しくは分岐しない場
合の論理アドレスのいずれかを出力するアドレス出力手
段とを備える分岐予測装置を提供する。
Also, in a branch prediction device of an information processing device that performs processing in accordance with an execution pattern of an input program, the branch prediction device is configured by a neural network constructed of neurons capable of storing weight information, and is configured by an input update value. Weight buffer means for updating the stored weight information as needed, generating and holding new weight information, and a branch prediction for receiving a signal indicating a branch occurrence and outputting a previous branch result based on the specified signal. Buffer means; weight information from the weight buffer means; a branch result from the branch prediction buffer means up to the previous time; and update value generation means for generating an update value for updating weight information from the latest analysis result; A branch prediction generating a branch prediction based on the weight information from the buffer means and the previous branch result from the branch prediction buffer means. A generation unit stage, based on the branch prediction, which provides a branch prediction apparatus and an address output means for outputting one of the logical address when no logical address or branched if branched.

【0018】以上のような構成の情報処理装置の分岐予
測方式及びそれを用いた装置は、実行するプログラム毎
に、前回まで起こった分岐の履歴情報を学習情報とし、
実際の分岐結果を正解情報とするニューラルネットワー
クを構築し、その重み(重み情報)を分岐毎に更新さ
せ、そのプログラムの実行パターンに適応する形式に変
化して、それぞれのプログラムの実行パターン適応した
分岐予測を行う。
In the information processing apparatus having the above-described configuration, the branch prediction method and the apparatus using the same use, for each program to be executed, history information of a branch that has occurred up to the previous time as learning information,
A neural network that uses the actual branch result as the correct answer information is constructed, the weight (weight information) is updated for each branch, the form is changed to a form adapted to the execution pattern of the program, and the execution pattern of each program is adapted. Perform branch prediction.

【0019】[0019]

【発明の実施の形態】以下、図面を参照して本発明の実
施形態について詳細に説明する。
Embodiments of the present invention will be described below in detail with reference to the drawings.

【0020】図1を参照して、本発明による情報処理装
置の分岐予測方式の概略について説明する。
Referring to FIG. 1, an outline of a branch prediction method for an information processing apparatus according to the present invention will be described.

【0021】この分岐予測方式は、前述した従来の分岐
履歴に基づいた判定タグの代わりに、実行するプログラ
ム毎に、そのプログラムの前回から予め定めた回数前ま
での分岐結果を履歴させた情報からなる学習情報と、今
回の分岐結果からなる正解情報とを用いて、情報の変化
により次回の分岐を予測するものである。この情報の変
化をニューロンの重みの変化(重み情報)として捉え、
重み情報をプログラムの実行パターンに適応した形に変
化させるニューラルネットワークを判定予測ユニットと
して用いる方式である。
In this branch prediction method, instead of the above-described conventional determination tag based on a branch history, for each program to be executed, information obtained by history of branch results from a previous time to a predetermined number of times before that program is used. The next branch is predicted based on a change in the information using the learning information and the correct answer information that is the result of the current branch. This change in information is considered as a change in the weight of the neuron (weight information),
In this method, a neural network that changes weight information into a form adapted to a program execution pattern is used as a determination prediction unit.

【0022】このニューラルネットワークを判定予測ユ
ニットとして用いると、プログラムを実行させていくに
従い、重み情報は、実行パターンにより変化してそのプ
ログラムに適応していき、分岐予測の的中率が向上して
いく。
When this neural network is used as a decision prediction unit, as the program is executed, the weight information changes according to the execution pattern and adapts to the program, and the hit rate of branch prediction is improved. Go.

【0023】後述するヒストリバッファ内のタグに該当
する前回までの分岐結果Xi からなる入力パターンが作
成される。ここで、○を分岐した結果、×を分岐しなか
った結果を示すものとする。この入力パターンは、実際
に実行して、ゼロから作成してもよいし、予め好適する
であろうと思われる入力パターンを設定しておき、得ら
れた分岐結果dtに基づき書き換えていってもよい。
An input pattern consisting of the previous branch result Xi corresponding to a tag in the history buffer described later is created. Here, it is assumed that the result of branching "O" and the result of not branching "X" are shown. This input pattern may be actually executed and created from scratch, or an input pattern that seems to be suitable may be set in advance and rewritten based on the obtained branch result dt. .

【0024】この入力パターンは、分岐結果が得られる
度に、 Xi+1(t+1)=Xi として更新される。
The input pattern is updated as X i + 1 (t + 1) = X i every time a branch result is obtained.

【0025】また、ニューロネットワークにより得られ
る重み情報が、入力パターンの対応した重み情報パター
ンを作成する。
The weight information obtained by the neural network creates a weight information pattern corresponding to the input pattern.

【0026】この重み情報パターンの各重み情報W1,W
2,…,Wnは、例えば、階層構造に構築されたニューラル
ネットワークのそれぞれのニューロンに入力され、積和
演算や加減算の演算処理を行い、分岐予測結果Yt が得
れる。そして、実際の分岐結果dt と分岐予測結果Yt
から重み情報の更新が行われる。
Each weight information W1, W of this weight information pattern
2,..., Wn are input to, for example, each neuron of the neural network constructed in a hierarchical structure, and perform a product-sum operation or an addition / subtraction operation to obtain a branch prediction result Yt. Then, the actual branch result dt and the branch prediction result Yt
, The weight information is updated.

【0027】この重み結果が得られる毎に、 W(t+1)=g[ W(t)±ηX(t) ] として更新される。この式による更新は、 1)分岐予測に対して、正しい結果が得られた時Y(t)
=d(t)は、Wi(t+1)= Wi(t) となる。
Every time this weight result is obtained, it is updated as W (t + 1) = g [W (t) ± ηX (t)]. The update by this formula is as follows: 1) When a correct result is obtained for the branch prediction, Y (t)
= D (t) becomes Wi (t + 1) = Wi (t).

【0028】2)d(t)が1(○)になる時若しくは、
Y(t)に0(×)を出力した時、Wi(t+1)= Wi(t)+η
Xi(t) となる。
2) When d (t) becomes 1 (○) or
When 0 (×) is output to Y (t), Wi (t + 1) = Wi (t) + η
Xi (t).

【0029】3)d(t)が0(×)になる時若しくは、
Y(t)に1(○)を出力した時、Wi(t+1)= Wi(t)−η
Xi(t) となる。
3) When d (t) becomes 0 (x) or
When 1 (○) is output to Y (t), Wi (t + 1) = Wi (t) −η
Xi (t).

【0030】ここで、0≦η≦1は、重み更新速度を制
御する正のゲインの項を示す。
Here, 0 ≦ η ≦ 1 indicates a positive gain term for controlling the weight update speed.

【0031】このようにして、得られた分岐結果及び更
新された重み情報の更新を行い、実行するプログラムに
適合していく。
In this manner, the obtained branch result and the updated weight information are updated and adapted to the program to be executed.

【0032】次に図2には、第1の実施形態としての情
報処理装置、例えば、プロセッサの概略的な構成を示し
説明する。
Next, FIG. 2 shows a schematic configuration of an information processing apparatus as a first embodiment, for example, a processor and will be described.

【0033】この装置は、例えば、1チップ上に構築さ
れるプロセッサであり、公知な構成に、本発明の分岐予
測ユニットを搭載した構成例である。
This device is, for example, a processor built on one chip, and is an example of a configuration in which a branch prediction unit of the present invention is mounted on a known configuration.

【0034】このプロセッサは、他のシステムインター
フェイス(I/F)に接続し、データや命令等のやり取
りを行うためのリード/ライトバッファ1と、命令等を
記憶するバッファからなる命令キャッシュ2と、データ
を記憶するバッファからなるデータキャッシュ3、命令
キャッシュ2からの命令バスにより動作するプリフェッ
チユニット4と、分岐の発生を分岐予測ユニット7に出
力し、デコードされた命令を出力するデコーダ5と、デ
コーダ5の指示に従い所定処理を実行する論理算術演算
ユニット(ALU)6と、論理算術演算ユニット6及び
分岐予測ユニット7からの論理アドレスを記録し管理す
るメモリ管理ユニット8、本発明の特徴であり後述する
分岐予測を行う分岐予測ユニット7とで構成される。
This processor is connected to another system interface (I / F), and reads / writes a buffer 1 for exchanging data and instructions, and an instruction cache 2 comprising a buffer for storing instructions and the like. A data cache 3 comprising a buffer for storing data, a prefetch unit 4 operated by an instruction bus from the instruction cache 2, a decoder 5 for outputting the occurrence of a branch to the branch prediction unit 7 and outputting a decoded instruction, and a decoder A logical arithmetic operation unit (ALU) 6 for executing a predetermined process in accordance with the instruction of 5, a memory management unit 8 for recording and managing logical addresses from the logical arithmetic operation unit 6 and the branch prediction unit 7, which are features of the present invention and will be described later. And a branch prediction unit 7 for performing branch prediction.

【0035】このような構成により、デコーダ5からの
分岐の発生と、論理算術演算ユニット6からの分析結果
に基づき、分岐予測となる論理アドレスをメモリ管理ユ
ニット8に出力する。
With such a configuration, a logical address for branch prediction is output to the memory management unit 8 based on the occurrence of a branch from the decoder 5 and the analysis result from the logical arithmetic operation unit 6.

【0036】図3には、前述した分岐予測ユニット7の
具体的な構成例を示し説明する。
FIG. 3 shows a specific configuration example of the branch prediction unit 7 described above.

【0037】この分岐予測ユニット7は、ニューラルネ
ットで構成され、更新された重み情報の更新値から重み
情報を生成する重みバッファ10と、デコーダ5のデコ
ードされた命令(分岐の発生)が入力され、命令アドレ
ス若しくは命令コードによるタグVi を出力して該当す
る命令がバッファ内に登録されているかを示す命令タグ
12と、タグで示された命令に基づき、プールされる分
岐結果の中から1つの過去の分岐結果Xi を出力するヒ
ストリバッファ13と、前記重みバッファ10からの重
み情報Wi 、ヒストリバッファ13からの分析結果Xi
及び論理算術演算ユニット6からの実行ステージで決定
した分岐結果とから、重みバッファの更新値を生成する
演算器14と、同様に重み情報Wi と分析結果Xi とか
ら分岐予測結果をマルチプレクサ15に出力する演算器
16と、デコーダ5のデコードされた命令に基づき、分
岐発生時のアドレスオフセット値を算出するバランスオ
フセット部17と、通常のリニアにインクリメントされ
る命令アドレスを出力するプログラムカウンタ18と、
パイプラインを駆動するクロックに基づきプログラムカ
ウンタ18からの命令アドレスを加算する加算器19
と、プログラムカウンタ18からの命令アドレスとバラ
ンスオフセット部17からの命令アドレスとにより分岐
する場合のアドレスを出力する加算器20と、プログラ
ムカウンタ18からの分岐しない場合の命令アドレス
と、加算器20から分岐する場合の命令アドレスと、前
記分岐予測結果により所定の命令アドレスをメモリ管理
ユニットメモリ8に出力するマルチプレクサ15とで構
成される。
The branch prediction unit 7 is constituted by a neural network, and receives as input a weight buffer 10 for generating weight information from an updated value of the updated weight information, and a decoded instruction (occurrence of a branch) of the decoder 5. , An instruction tag 12 which outputs a tag Vi by an instruction address or an instruction code to indicate whether the corresponding instruction is registered in the buffer, and one of branch results pooled based on the instruction indicated by the tag. A history buffer 13 for outputting the past branch result Xi; weight information Wi from the weight buffer 10; and an analysis result Xi from the history buffer 13.
And an arithmetic unit 14 for generating an updated value of the weight buffer from the branch result determined in the execution stage from the logical arithmetic operation unit 6, and similarly outputs a branch prediction result to the multiplexer 15 from the weight information Wi and the analysis result Xi. An arithmetic unit 16 for calculating an address offset value at the time of occurrence of a branch based on the decoded instruction of the decoder 5, a program counter 18 for outputting a normal linearly incremented instruction address,
Adder 19 for adding an instruction address from program counter 18 based on a clock for driving the pipeline
And an adder 20 that outputs an address when branching is performed based on an instruction address from the program counter 18 and an instruction address from the balance offset unit 17; an instruction address when branching is not performed from the program counter 18; It comprises an instruction address for branching and a multiplexer 15 for outputting a predetermined instruction address to the memory management unit memory 8 based on the branch prediction result.

【0038】また前記命令タグ12とヒストリバッファ
13は、分岐予測バッファ11を構成する。
The instruction tag 12 and the history buffer 13 constitute a branch prediction buffer 11.

【0039】次に図4に示すフローチャートを参照し
て、このように構成された分岐予測ユニット7を備える
情報処理装置の具体的な作用について説明する。
Next, a specific operation of the information processing apparatus having the branch prediction unit 7 configured as described above will be described with reference to a flowchart shown in FIG.

【0040】本実施形態において、パイプラインは、I
F:命令フェッチ、ID:命令デコード、EX:実行及
び実効アドレス生成、MEM:メモリアクセス、WB:
書き込みの5段のステージに構成されているものを例と
する。
In this embodiment, the pipeline is I
F: instruction fetch, ID: instruction decode, EX: execution and effective address generation, MEM: memory access, WB:
An example in which five stages of writing are configured will be described.

【0041】まず、IFステージにおいて、プログラム
カウンタ(PC)をメモリ管理ユニット8及び分岐予測
ユニット7に送出する(ステップS1)。
First, in the IF stage, a program counter (PC) is sent to the memory management unit 8 and the branch prediction unit 7 (step S1).

【0042】次に、分岐が発生したか、つまり、分岐予
測バッファ11に対応するエントリは存在するか否か判
断する(ステップS2)。ここでエントリが存在しない
場合には(NO)、IDステージに移行し、フェッチし
た命令が分岐命令か判断する(ステップS3)。この判
断で分岐命令でなければ(NO)、通常通り命令を実行
し(ステップS4)、リターンする。しかし、分岐命令
であれば(YES)、EXステージに移行し、当該命令
と分岐結果を分岐予測ユニット7に登録し(ステップS
5)、リターンする。
Next, it is determined whether or not a branch has occurred, that is, whether or not an entry corresponding to the branch prediction buffer 11 exists (step S2). If the entry does not exist (NO), the process proceeds to the ID stage, and it is determined whether the fetched instruction is a branch instruction (step S3). If the instruction is not a branch instruction (NO), the instruction is executed as usual (step S4), and the routine returns. However, if the instruction is a branch instruction (YES), the process proceeds to the EX stage, and the instruction and the branch result are registered in the branch prediction unit 7 (step S).
5) Return.

【0043】また、ステップS2において、エントリが
存在する場合(YES)、分岐予測結果Yi =f[ΣW
iXi−θ]、Yi=1:分岐先PC、Yi=0:通常のP
Cに設定する(ステップS6)。そして、分岐予測PC
をメモリ管理ユニット8に送出する(ステップS7)。
次に分岐予測結果Yi が実際の分岐結果と一致したか否
か判断する(ステップS8)。この判断で分岐予測結果
Yi と分岐結果が一致すれば(YES)、EXステージ
に移行し、予測的中したものとして、そのまま実行し
(ステップS9)、リターンする。しかし、分岐予測結
果Yi と分岐結果が一致しなければ(NO)、重み情報
の更新を行うために、分岐予測結果Yiと分岐結果diの
組み合わせを判断する(ステップS10)。
If there is an entry in step S2 (YES), the branch prediction result Yi = f [ΣW
iXi-θ], Yi = 1: branch destination PC, Yi = 0: normal P
C is set (step S6). And the branch prediction PC
Is sent to the memory management unit 8 (step S7).
Next, it is determined whether the branch prediction result Yi matches the actual branch result (step S8). If it is determined that the branch prediction result Yi and the branch result match (YES), the process proceeds to the EX stage, and it is determined that the prediction was correct, the process is executed as it is (step S9), and the process returns. However, if the branch prediction result Yi and the branch result do not match (NO), a combination of the branch prediction result Yi and the branch result di is determined to update the weight information (step S10).

【0044】この判断において、Yi=1,di=0であ
った場合には、分岐するものと予測したが結果は分岐し
なかったことを意味し、Wi(t+1)= Wi(t)−ηXi(t)
により重み情報が更新される(ステップS11)。
In this judgment, when Yi = 1 and di = 0, it is predicted that the branch is taken, but the result is that the branch did not take place. Wi (t + 1) = Wi (t) −ηXi (t)
Updates the weight information (step S11).

【0045】また、Yi=diであった場合には、分岐予
測と予測した結果が一致したことを意味し、Wi(t+1)=
Wi(t)により重み情報が更新される(ステップS1
2)。そして、Yi=0,di=1であった場合には、分
岐しないものと予測したが結果は分岐したことを意味
し、Wi(t+1)= Wi(t)+ηXi(t)により重み情報が更
新される(ステップS13)。
If Yi = di, it means that the branch prediction matches the predicted result, and Wi (t + 1) =
Weight information is updated by Wi (t) (step S1).
2). When Yi = 0 and di = 1, it is predicted that no branch will occur, but the result indicates that the branch has taken place, and the weight information is obtained by Wi (t + 1) = Wi (t) + ηXi (t). Is updated (step S13).

【0046】図5には、本実施形態を用いて実際に実施
した際の種々のパターンと分岐予測が的中する確率(予
測的中率)の検証について示し説明する。
FIG. 5 shows the verification of various patterns and the probability of a successful branch prediction (prediction accuracy) when actually performed using the present embodiment.

【0047】これらのパターン例としては、図5(a)
には、代表的に10例を設定している。これらの結果か
ら、分岐(1若しくは0)が定期的に繰り返されるパタ
ーン1〜5に対しては、かなり高い確率で的中する。
FIG. 5A shows an example of these patterns.
, 10 cases are typically set. From these results, it is possible to hit the patterns 1 to 5 in which the branch (1 or 0) is periodically repeated with a considerably high probability.

【0048】また、ある長さで規定されたランダムなパ
ターン6〜9においては、長さ100のランダムパター
ンを除き、高い的中率と低い的中率が混在した結果とな
っている。特に同じパターンでも繰り返し行った回数に
より、的中率が大きく異なっているが、平均的に見る
と、80%を中心とした高い確率で的中している。
In the random patterns 6 to 9 defined by a certain length, a high hit rate and a low hit rate are mixed except for a random pattern having a length of 100. In particular, the hit rate differs greatly depending on the number of repetitions of the same pattern. However, on average, the hit rate is high at around 80%.

【0049】実際の分岐は、データによって異なり、常
にランダムに分岐されるものもあるが、ある程度周期的
に分岐する場合の方が多いものと推測される。そのた
め、これらのパターンの中から1つが表れるものと考え
る方が妥当である。従って、ビット率は、パターン全体
の平均から推測されるため、全体的な平均である85%
前後である。
The actual branch differs depending on the data, and some branches always occur at random, but it is presumed that there are more cases in which the branches branch periodically to some extent. Therefore, it is more appropriate to think that one of these patterns appears. Therefore, since the bit rate is estimated from the average of the entire pattern, the overall average is 85%.
Before and after.

【0050】さらに、図5(b)に示すような、常にラ
ンダムとなるパターンの場合には、的中率は50%前後
となっている。これは、完全なランダムの状態でデータ
が入力した場合、何らかのパターンに基づいて予測する
ことはできないため、的中率が50%を越えるような予
測はできない。しかし、本実施形態において、分岐予測
が不可能な場合であっても著しく的中率が低下しないこ
とを示している。
Further, in the case of a pattern that is always random as shown in FIG. 5B, the hit rate is around 50%. This is because when data is input in a completely random state, it cannot be predicted on the basis of any pattern, so that it cannot be predicted that the hit rate exceeds 50%. However, in the present embodiment, it is shown that the hit rate does not decrease significantly even when the branch prediction is impossible.

【0051】以上説明したように、本実施形態における
分岐予測をニューラルネットワークによる適応型の分岐
予測を行う情報処理装置の分岐予測方式及びそれを用い
た装置は、実行するプログラム毎に、前回まで起こった
分岐の履歴情報を学習情報とし、実際の分岐結果を正解
情報とするニューラルネットワークを構築し、その重み
(重み情報)を分岐毎に更新させ、そのプログラムの実
行パターンに適応する形式に変化させる。このように、
それぞれのプログラムの実行パターン適応した分岐予測
を実現することができる。
As described above, the branch prediction method of the information processing apparatus for performing the adaptive branch prediction by the neural network in the present embodiment and the apparatus using the same are different for each program to be executed. A neural network is constructed, in which the history information of the taken branch is used as learning information, and the actual result of the branch is used as the correct answer information, and the weight (weight information) is updated for each branch and changed to a form adapted to the execution pattern of the program. . in this way,
Branch prediction adapted to the execution pattern of each program can be realized.

【0052】次に、本発明による第2の実施形態につい
て説明する。
Next, a second embodiment according to the present invention will be described.

【0053】前述した第1の実施形態において、例え
ば、任意のランダムとなるパターンの場合には、的中率
は50%前後となっている。この様に、分岐予測の的中
率が低い(不正解回数が多い)場合や、ある回数分岐予
測を行っても的中する頻度が低い場合に、第2の実施形
態では、分岐予測を行う度に、重み情報Wiを予測判定
に使用した回数若しくは予測不正解回数を任意に設定し
た回数と比較して、重み情報Wiを更新するか否か決定
し、重み情報Wiの更新処理を行う重み情報更新部であ
る。ここで分岐予測結果Yiは、図3に示した演算器1
6から得られるものとする。
In the first embodiment described above, for example, in the case of an arbitrary random pattern, the hit rate is about 50%. As described above, in the second embodiment, the branch prediction is performed when the hit rate of the branch prediction is low (the number of incorrect answers is large) or when the frequency of hits is low even if the branch prediction is performed a certain number of times. Each time, the weight information Wi is compared with the number of times that the weight information Wi is used for the prediction determination or the number of times of incorrect predictions is arbitrarily set, and it is determined whether or not the weight information Wi is to be updated. It is an information updating unit. Here, the branch prediction result Yi is calculated by the arithmetic unit 1 shown in FIG.
6 shall be obtained.

【0054】図8には、本実施形態の重み情報更新部の
具体的な構成例を示す。
FIG. 8 shows a specific configuration example of the weight information updating unit of the present embodiment.

【0055】この重み情報更新部は、分岐予測(前回ま
での分岐結果)Xiに対する分岐予測結果Yiにより、前
回までの不正解回数CRiをカウントアップ若しくは、
カウントダウンし、不正解回数バッファ(以下、CRバ
ッファと称する)21に設定された不正解回数CRiを
更新する不正解回数更新部22と、分岐予測判定使用回
数バッファ(以下、CTバッファと称する)23に設定
される、前回までの分岐予測Xiを予測判定に使用した
回数CTiをカウントアップする分岐予測使用回数更新
部24と、CRバッファ21及びCTバッファ23から
の不正解回数CRi[l-1]と使用回数CTi[k]との出力に
基づき、重み情報Wiの変更信号を生成する重み情報変
更信号生成部25と、前記重み情報Wiの変更信号及び
分岐予測使用回数更新部24からの出力信号ADW[n:
0]により、重みバッファ26に設定された重み情報Wi
を書き換えて更新する重み情報書換え部27とで構成さ
れる。
The weight information updating unit counts up the number of incorrect answers CRi up to the previous time by using the branch prediction result Yi for the branch prediction (branch result up to the previous time) Xi, or
An incorrect answer count updating unit 22 that counts down and updates the incorrect answer count CRi set in an incorrect answer count buffer (hereinafter referred to as a CR buffer) 21, and a branch prediction determination use count buffer (hereinafter referred to as a CT buffer) 23. And the number of incorrect answers CRi [l−1] from the CR buffer 21 and the CT buffer 23, and a branch prediction use number update unit 24 that counts up the number of times CTi in which the previous branch prediction Xi was used for the prediction determination. Weight information change signal generation unit 25 that generates a change signal of weight information Wi based on the output of the weight information Wi and the number of use times CTi [k], and the output signal from the weight information Wi change signal and branch prediction use number update unit 24. ADW [n:
0], the weight information Wi set in the weight buffer 26
And a weight information rewriting unit 27 that rewrites and updates.

【0056】尚、図8以降の図面において、英語小文字
の”l”は、数字等との混乱を防ぐため、筆記体文字で
表記するものとする。
In FIGS. 8 and thereafter, the lowercase English letter "l" is written in cursive characters to prevent confusion with numbers and the like.

【0057】前記不正解回数更新部22においては、不
正解回数CRiが入力されるOR回路31と、分岐予測
結果Yiの反転信号及びOR回路31の出力信号を入力
するAND回路32と、AND回路32の出力信号(X
^(l-1))と分岐予測結果(0^l,Yi)との演算を行
い、前回までの不正解回数CRiの加減量(1or−1)
を出力する演算部33と、演算部33からの加減量とC
Rバッファ21からの前回までの不正解回数CRiとを
加算し出力する加算器34と、この加算器34からの更
新するべき不正解回数CRi若しくは、任意に設定され
た初期値(0,CW,0^(l-1))を重み情報変更信号
生成部25からの変更信号により、CRバッファ21へ
分岐予測Xiが不正解ならばCRiをカウントアップし、
正解ならばCRiをカウントダウン(下限を0とする)
として書き込む演算部35とで構成される。ここで、”
^”は、乗数を示す。
In the incorrect answer frequency updating unit 22, an OR circuit 31 to which the number of incorrect answers CRi is inputted, an AND circuit 32 to which an inverted signal of the branch prediction result Yi and an output signal of the OR circuit 31 are inputted, and an AND circuit 32 output signals (X
^ (l−1)) and the result of branch prediction (0 ^ l, Yi) are performed, and the number of incorrect answers CRi up to the previous time is adjusted (1 or −1).
And an adder / subtractor from the calculator 33 and C
An adder 34 for adding and outputting the number of incorrect answers CRi from the R buffer 21 up to the previous time, and an incorrect answer number CRi to be updated from the adder 34 or an arbitrarily set initial value (0, CW, 0 ^ (l−1)) is changed to the CR buffer 21 by the change signal from the weight information change signal generation unit 25. If the branch prediction Xi is incorrect, CRi is counted up.
If correct, count down CRi (lower limit is 0)
And an arithmetic unit 35 for writing as here,"
^ ”indicates a multiplier.

【0058】前記分岐予測使用回数更新部24は、分岐
予測Xiの使用回数CTi[k]をカウントするカウンタ3
6と、内部クロックで制御されるn+1ビットシフタ37
と、このn+1ビットシフタ37の出力信号とアドレス信
号ADとの反転信号を出力するNAND回路38と、前
記n+1ビットシフタ37の出力信号とNAND回路38
からの出力信号とにより、任意に設定された値jと前回
までカウントされた値iとが等しいか判定し、等しい場
合には”0”を立てて、重み情報Wiの書き換えしない
指示を行う信号ADW[n:0]を出力するAND回路39
とで構成される。
The branch prediction use count updating unit 24 includes a counter 3 for counting the use count CTi [k] of the branch prediction Xi.
6 and an (n + 1) -bit shifter 37 controlled by an internal clock
A NAND circuit 38 for outputting an inverted signal of the output signal of the n + 1 bit shifter 37 and the address signal AD, and an output signal of the n + 1 bit shifter 37 and the NAND circuit 38
Is determined from the output signal from the arbitrarily whether the value j arbitrarily set is equal to the value i counted up to the previous time, and if they are equal, "0" is set to instruct the weight information Wi not to be rewritten. AND circuit 39 that outputs ADW [n: 0]
It is composed of

【0059】前記重み情報書換え部27は、内部クロッ
クによりカウントアップを行うカウンタ40と、NOR
回路42による信号ADW[n:0]の反転信号により、カ
ウンタ40からの出力信号(重み情報)と重みバッファ
26から信号(重み情報Wj)のいずれかを選択し、重
みバッファ26に新たな重み情報Wiとして更新する演
算部41と、前記Wi変更信号により、演算部41から
出力される重み情報に書き換えを行うか否かを制御する
ゲート部43とで構成される。
The weight information rewriting unit 27 includes a counter 40 that counts up by an internal clock and a NOR
The output signal (weight information) from the counter 40 and the signal (weight information Wj) from the weight buffer 26 are selected by an inverted signal of the signal ADW [n: 0] by the circuit 42, and a new weight is added to the weight buffer 26. An arithmetic unit 41 for updating as information Wi and a gate unit 43 for controlling whether to rewrite the weight information output from the arithmetic unit 41 based on the Wi change signal.

【0060】図9に示すフローチャートを参照して、こ
の様に構成された重み情報更新部の動作について説明す
る。
The operation of the weight information updating unit thus configured will be described with reference to the flowchart shown in FIG.

【0061】初期値として、使用回数CTi=0、不正
解回数CRi=2^(I-1)に設定する。まず、前回までの
分岐予測Xiを分岐に用いた使用回数CTiに1を加算し
て、カウントアップする(ステップS21)。
As the initial values, the number of uses CTi = 0 and the number of incorrect answers CRi = 2 ^ (I−1) are set. First, 1 is added to the number of use times CTi in which the previous branch prediction Xi was used for branching, and the count is incremented (step S21).

【0062】次に、分岐予測Xiが正解か否か判定し
(ステップS22)、分岐予測Xiが正解であれば(Y
ES)、不正解回数CRi=0か確認し、不正解回数C
Riが0でなければ、不正解回数CRiを−1カウントダ
ウンして(ステップS23,S24)、重み情報の変更
をしないで終了する。
Next, it is determined whether or not the branch prediction Xi is correct (step S22). If the branch prediction Xi is correct (Y)
ES), check whether the number of incorrect answers CRi = 0, and check the number of incorrect answers C
If Ri is not 0, the number of incorrect answers CRi is decremented by -1 (steps S23 and S24), and the process ends without changing the weight information.

【0063】しかし、ステップS22で分岐予測Xiが
不正解であれば(NO)、不正解回数CRiを+1カウ
ントアップし(ステップS25)、不正解回数CRiが
2^lになったか否か判定する(ステップS26)。こ
の判定で不正解回数CRi=2^lであれば(YE
S)、重み情報Wiの更新処理に移行し、シフタから任
意の値j(0≦j≦n)を取得する(ステップS2
7)。この任意の値jは、使用回数CTiや不正解回数
CRiの限度を設定する値である。
However, if the branch prediction Xi is incorrect in step S22 (NO), the number of incorrect answers CRi is counted up by +1 (step S25), and it is determined whether or not the number of incorrect answers CRi is 2 ^ l. (Step S26). If the number of incorrect answers CRi = 2 ^ l in this determination, (YE
S), the process proceeds to the updating process of the weight information Wi, and an arbitrary value j (0 ≦ j ≦ n) is obtained from the shifter (step S2).
7). This arbitrary value j is a value for setting the limit of the number of uses CTi and the number of incorrect answers CRi.

【0064】また、ステップS26で不正解回数CRi
が2^l以外であれば(NO)、不正解回数CRi≧2
^(l-1)か否か判定し(ステップS28)、不正解回数
CRi≧2^(l-1)でなければ(NO)、終了する。しか
し、不正解回数CRi≧2^(l-1)であれば(YES)、
使用回数CTi≧2^kか否か判定する(ステップS2
9)。この判定で使用回数CTi≧2^kである(YE
S)、即ち、不正解回数CRi≧2^(l-1)且つ、使用回
数CTi≧2^kであれば、ステップS27の重み情報
Wiの更新処理に移行する。しかし使用回数CTi≧2^
kでなければ(NO)、終了する。
In step S26, the number of incorrect answers CRi
Is other than 2 ^ 1 (NO), the number of incorrect answers CRi ≧ 2
It is determined whether or not ^ (l-1) (step S28). If the number of incorrect answers CRi ≧ 2 ^ (l-1) is not satisfied (NO), the process ends. However, if the number of incorrect answers CRi ≧ 2 ^ (l−1) (YES),
It is determined whether or not the number of uses CTi ≧ 2 ^ k (step S2)
9). In this determination, the number of uses CTi ≧ 2 ^ k (YE
S), that is, if the number of incorrect answers CRi ≧ 2 ^ (l−1) and the number of uses CTi ≧ 2 ^ k, the process proceeds to the updating process of the weight information Wi in step S27. However, the number of uses CTi ≧ 2 ^
If not k (NO), the process ends.

【0065】次に、ステップS27で取得された任意の
値jと前回までにカウントされた値iと等しくなったか
否か判定する(ステップS30)。この判定でj=iな
らば(YES)、カウンタ40により指定される任意の
重み情報Wiを取得し(ステップS31)、j≠iなら
ば(NO)、重みバッファ26で前回までの重み情報W
jを取得する(ステップS32)。
Next, it is determined whether or not the arbitrary value j obtained in step S27 is equal to the value i counted up to the previous time (step S30). If j = i (YES), arbitrary weight information Wi specified by the counter 40 is obtained (step S31). If j ≠ i (NO), the weight buffer 26 stores the previous weight information W in the weight buffer 26.
j is acquired (step S32).

【0066】次に、重み情報Wiの変更信号により制御
される制御部43を通じて、重みバッファ26の重み情
報Wiを取得した重み情報に更新する(ステップS3
3)。そして、不正解回数CRi=2^(I-1)、使用回数
CTi=0に初期化して終了する(ステップS34,S
35)。
Next, the weight information Wi of the weight buffer 26 is updated to the acquired weight information through the control unit 43 controlled by the change signal of the weight information Wi (step S3).
3). Then, the number of incorrect answers CRi = 2 ^ (I−1) and the number of uses CTi = 0 are initialized and the process ends (steps S34 and S34).
35).

【0067】本実施形態では、分岐予測の不正解回数C
Ri及び、使用回数CTiを任意の回数に設定することに
より、分岐予測の不正解回数が著しく多い場合、若しく
は設定した回数の分岐予測を行っても正解頻度が低い場
合、即ち、予測的中率が低い場合に、好適する重み情報
Wiに適宜、更新することができ、予測的中率を高める
ことができる。
In the present embodiment, the number of incorrect answers C in the branch prediction
By setting Ri and the number of times of use CTi to arbitrary numbers, when the number of incorrect answers in branch prediction is extremely large, or when the frequency of correct answers is low even when the set number of branch predictions is performed, Is low, the appropriate weight information Wi can be updated as appropriate, and the predictive accuracy can be increased.

【0068】次に前述した第3実施形態について説明す
る。
Next, the third embodiment will be described.

【0069】図10には、本実施形態の重み情報更新部
の具体的な変形例を示す。この重み情報更新部の構成部
位において、図8に示した構成部位と同等の部位には同
じ参照符号を付して、その説明を省略する。本実施形態
は、前述した重み情報更新部の分岐予測使用回数更新部
24と、重み情報書換え部27とを簡素化した構成とな
っている。
FIG. 10 shows a specific modification of the weight information updating unit of the present embodiment. In the components of the weight information updating unit, the same components as those shown in FIG. 8 are denoted by the same reference numerals, and the description thereof will be omitted. This embodiment has a simplified configuration of the branch prediction use count updating unit 24 of the weight information updating unit and the weight information rewriting unit 27 described above.

【0070】前記分岐予測使用回数更新部24が本実施
形態では、アドレス信号AD[n:0]でカウント制御さ
れ、重み情報変更信号によりリセットされるカウンタ3
6のみで構成される。前記重み情報書換え部27は、内
部クロックでカウント制御されるカウンタ40と、カウ
ンタ40からの出力信号(任意の重み情報ΔW)と重み
バッファ26から信号(重み情報Wi)を加算し、前記
重み情報変更信号により、重みバッファの重み情報の更
新を行う加算器44とで構成される。
In this embodiment, the branch prediction use count updating unit 24 is controlled by the address signal AD [n: 0], and is reset by the weight information change signal.
6 only. The weight information rewriting unit 27 adds a counter 40 whose count is controlled by an internal clock, an output signal (arbitrary weight information ΔW) from the counter 40, and a signal (weight information Wi) from the weight buffer 26 to obtain the weight information. An adder 44 updates the weight information of the weight buffer with the change signal.

【0071】図11のフローチャートを参照して、この
様に構成された重み情報更新部の動作について説明す
る。ここで、本実施形態にステップS41〜ステップS
46間での動作は、図9に示したステップS21〜ステ
ップS25間での動作と同等であり、説明を省略する。
The operation of the weight information updating unit thus configured will be described with reference to the flowchart of FIG. Here, in the present embodiment, steps S41 to S
The operation between steps 46 is the same as the operation between steps S21 to S25 shown in FIG.

【0072】ステップS45において、不正解回数CR
iをカウントアップした後、不正解回数CRiが2^lに
なったか否か判定する(ステップS46)。この判定で
不正解回数CRi=2^lであれば(YES)、重み情
報の更新処理に移行し、カウンタ40の任意の値ΔWを
取得する(ステップS47)。
In step S45, the number of incorrect answers CR
After counting up i, it is determined whether or not the number of incorrect answers CRi has reached 2 ^ l (step S46). If the number of incorrect answers CRi = 2 ^ l in this determination (YES), the process shifts to the updating process of the weight information, and an arbitrary value ΔW of the counter 40 is obtained (step S47).

【0073】また、ステップS46で不正解回数CRi
が2^l以外であれば(NO)、不正解回数CRi≧2
^(l-1)か否か判定し(ステップS48)、不正解回数
CRi≧2^(l-1)でなければ(NO)、終了する。しか
し、不正解回数CRi≧2^(l-1)であれば(YES)、
使用回数CTi≧2^kか否か判定する(ステップS4
9)。この判定で使用回数CTi≧2^kである(YE
S)、即ち、不正解回数CRi≧2^(l-1)且つ、使用回
数CTi≧2^kであれば(YES)、ステップS47
の重み情報の更新処理に移行する。しかし使用回数CT
i≧2^kでなければ(NO)、終了する。
In step S46, the number of incorrect answers CRi
Is other than 2 ^ 1 (NO), the number of incorrect answers CRi ≧ 2
It is determined whether or not ^ (l−1) (step S48). If the number of incorrect answers CRi ≧ 2 ^ (l−1) (NO), the process ends. However, if the number of incorrect answers CRi ≧ 2 ^ (l−1) (YES),
It is determined whether or not the number of uses CTi ≧ 2 ^ k (step S4)
9). In this determination, the number of uses CTi ≧ 2 ^ k (YE
S), that is, if the number of incorrect answers CRi ≧ 2 ^ (l−1) and the number of uses CTi ≧ 2 ^ k (YES), step S47.
The process proceeds to the updating process of the weight information of. However, the number of uses CT
Unless i ≧ 2 ^ k (NO), the process ends.

【0074】次に、ステップS47で取得された任意の
値ΔWと重みバッファ26からの前回の重み情報Wiを
加算器44で加算し更新する(ステップS50)。そし
て、不正解回数CRi=2^(I-1)、使用回数CTi=0
に初期化して終了する(ステップS51,S52)。
Next, the adder 44 adds and updates the arbitrary value ΔW obtained in step S47 and the previous weight information Wi from the weight buffer 26 (step S50). Then, the number of incorrect answers CRi = 2 ^ (I−1) and the number of uses CTi = 0
And ends (steps S51 and S52).

【0075】本実施形態においては、前述した第2の実
施形態の効果と同等の効果を簡易な構成により得ること
ができる。
In this embodiment, the same effects as those of the second embodiment can be obtained with a simple configuration.

【0076】[0076]

【発明の効果】以上詳述したように本発明によれば、ニ
ューラルネットワークを用いて、それぞれの実行プログ
ラムの実行パターン毎に適応して分岐予測を行う情報処
理装置の分岐予測方式及びそれを用いた装置を提供する
ことができる。
As described above in detail, according to the present invention, a branch prediction method of an information processing apparatus for performing a branch prediction adaptively for each execution pattern of each execution program using a neural network, and using the same. Can be provided.

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

【図1】本発明による情報処理装置の分岐予測方式につ
いて説明するための概略図である。
FIG. 1 is a schematic diagram for explaining a branch prediction method of an information processing apparatus according to the present invention.

【図2】本発明による分岐予測方式を用いた情報処理装
置(プロセッサ)の概略的な構成を示す図である。
FIG. 2 is a diagram showing a schematic configuration of an information processing device (processor) using a branch prediction method according to the present invention.

【図3】図2に示した分岐予測ユニットの具体的な構成
例を示す図である。
FIG. 3 is a diagram illustrating a specific configuration example of a branch prediction unit illustrated in FIG. 2;

【図4】分岐予測ユニットを備える情報処理装置の作用
について説明するためのフローチャートである。
FIG. 4 is a flowchart illustrating an operation of the information processing apparatus including the branch prediction unit.

【図5】本発明の情報処理装置の分岐予測方式で行った
分岐予測の検証結果を示す図である。
FIG. 5 is a diagram showing a verification result of branch prediction performed by the branch prediction method of the information processing apparatus of the present invention.

【図6】図6(a)は、パイプラインの一例を示し、同
図(b)は、スーパーパイプラインの一例を示す図であ
る。
FIG. 6A illustrates an example of a pipeline, and FIG. 6B illustrates an example of a super pipeline.

【図7】従来の判定タグによる分岐予測を説明するため
の図である。
FIG. 7 is a diagram for explaining a conventional branch prediction using a determination tag.

【図8】第2の実施形態として重み情報更新部の具体的
な構成例を示す図である。
FIG. 8 is a diagram illustrating a specific configuration example of a weight information updating unit as a second embodiment.

【図9】第2の実施形態における重み情報の更新につい
て説明するためのフローチャートである。
FIG. 9 is a flowchart for describing updating of weight information in the second embodiment.

【図10】第3の実施形態として重み情報更新部の具体
的な構成例を示す図である。
FIG. 10 is a diagram illustrating a specific configuration example of a weight information updating unit as a third embodiment.

【図11】第3の実施形態における重み情報の更新につ
いて説明するためのフローチャートである。
FIG. 11 is a flowchart illustrating updating of weight information according to the third embodiment.

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

1…リード/ライトバッファ 2…命令キャッシュ 3…データキャッシュ 4…プリフェッチユニット 5…デコーダ 6…論理算術演算ユニット 7…分岐予測ユニット 8…メモリ管理ユニット 10…重みバッファ 11…分岐予測バッファ 12…命令タグ 13…ヒストリバッファ 14,16,19…演算器 15…マルチプレクサ 17…バランスオフセット部 18…プログラムカウンタ 20…加算器 DESCRIPTION OF SYMBOLS 1 ... Read / write buffer 2 ... Instruction cache 3 ... Data cache 4 ... Prefetch unit 5 ... Decoder 6 ... Logical arithmetic operation unit 7 ... Branch prediction unit 8 ... Memory management unit 10 ... Weight buffer 11 ... Branch prediction buffer 12 ... Instruction tag DESCRIPTION OF SYMBOLS 13 ... History buffer 14, 16, 19 ... Operation unit 15 ... Multiplexer 17 ... Balance offset part 18 ... Program counter 20 ... Adder

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 入力されたプログラムの実行パターンに
沿って処理を行う情報処理装置の分岐予測方式におい
て、 前記プログラム毎に、処理の際に得られる分岐の有無の
結果を蓄積した履歴情報を学習情報に用い、最新の分岐
結果を正解情報として、前回の分岐結果に基づくニュー
ロンの重みを最新の分岐結果に基づく値に随時、更新す
ることにより、前記重みを前記プログラムの実行パター
ンに適応させて学習するニューラルネットワークを構築
し、 前記ニューラルネットワークで次回の分岐有無の予測を
行うことを特徴とする情報処理装置の分岐予測方式。
1. A branch prediction method for an information processing apparatus that performs processing in accordance with an execution pattern of an input program, wherein, for each of the programs, history information storing results of the presence or absence of a branch obtained at the time of processing is learned. Using the latest branch result as the correct answer information, the weight of the neuron based on the previous branch result is updated as needed to a value based on the latest branch result, thereby adapting the weight to the execution pattern of the program. A branch prediction method for an information processing apparatus, comprising constructing a neural network to be learned, and predicting the presence or absence of the next branch using the neural network.
【請求項2】 請求項1記載の前記履歴情報は、前記プ
ログラム毎に、処理の際に得られる前回から予め定めた
回数前までの分岐の有無の結果を蓄積したものであるこ
とを特徴とする情報処理装置の分岐予測方式。
2. The program according to claim 1, wherein the history information is obtained by accumulating, for each of the programs, results of the presence or absence of a branch from a previous time to a predetermined number of times before the process. Prediction method of the information processing device to perform.
【請求項3】 前記情報処理装置の分岐予測方式におい
て、 前記プログラムの処理開始前に、予め所定の履歴情報を
学習情報として与え、処理開始以降に得られる分岐結果
により、ニューラルネットワークのニューロンの重みを
随時更新して学習し、分岐予測を行うことを特徴とする
請求項1記載の情報処理装置の分岐予測方式。
3. The branch prediction method of the information processing apparatus, wherein predetermined history information is given as learning information before the processing of the program is started, and the weight of neurons in the neural network is calculated based on a branching result obtained after the processing is started. 2. A branch prediction method for an information processing apparatus according to claim 1, wherein the branch prediction is performed by updating and learning at any time.
【請求項4】 入力されたプログラムの実行パターンに
沿って処理を行う情報処理装置の分岐予測装置におい
て、 重み情報を記憶可能なニューロンで構築されたニューラ
ルネットで構成され、入力された更新値により記憶する
重み情報を随時更新し、新たな重み情報を生成し保持す
る重みバッファ手段と、 分岐の発生を指示する信号が入力され、指示された信号
に基づき前回までの分岐結果を出力する分岐予測バッフ
ァ手段と、 前記重みバッファ手段からの重み情報、前記分岐予測バ
ッファ手段からの前回までの分岐結果及び、最新の分析
結果から重み情報を更新する更新値を生成する更新値生
成手段と、 前記重みバッファ手段からの重み情報と、前記分岐予測
バッファ手段からの前回までの分岐結果とにより分岐予
測を生成する分岐予測生成手段段と、 前記分岐予測に基づき、分岐する場合の論理アドレス若
しくは分岐しない場合の論理アドレスのいずれかを出力
するアドレス出力手段と、を具備することを特徴とする
分岐予測装置。
4. A branch prediction device for an information processing device for performing processing in accordance with an execution pattern of an input program, comprising: a neural network constructed of neurons capable of storing weight information; Weight buffer means for updating the stored weight information as needed, generating and retaining new weight information, and a branch prediction for receiving a signal for instructing the occurrence of a branch and outputting a previous branch result based on the designated signal Buffer means; weight information from the weight buffer means, a previous branch result from the branch prediction buffer means, and an update value generation means for generating an update value for updating the weight information from the latest analysis result; A branch prediction that generates a branch prediction based on weight information from a buffer unit and a previous branch result from the branch prediction buffer unit; And forming means stages, the branch based on the prediction, the branch prediction apparatus characterized by comprising: an address output means for outputting one of the logical address when the logical address or not branched in the case of branching.
【請求項5】 請求項4記載の前記分岐予測装置と、 外部のシステムに接続し、データや命令等のやり取りを
行うためのリード/ライトバッファ部と、 命令及びデータを記憶するバッファからなるキャッシュ
部と、 前記キャッシュ部から命令バスにより分岐の発生を指示
するデコーダ部と、 前記デコーダ部の指示に従い所定処理を実行し、論理ア
ドレスを出力する論理算術演算部と、 論理アドレスを記録し管理するメモリ管理部と、 を具備し、 前記論理算術演算部からの分岐結果と、前記デコード部
からの分岐の発生の指示に基づき、分岐予測の情報を生
成し出力することを特徴とする分岐予測装置を用いた処
理装置。
5. A cache comprising the branch prediction device according to claim 4, a read / write buffer unit connected to an external system for exchanging data and instructions, and a buffer for storing instructions and data. , A decoder for instructing the branch from the cache unit via an instruction bus, executing a predetermined process according to the instruction of the decoder unit, outputting a logical address, and recording and managing the logical address A memory management unit; and generating and outputting branch prediction information based on a branch result from the logical arithmetic operation unit and a branch generation instruction from the decoding unit. Processing equipment using
【請求項6】 前記重みバッファ手段において、 前回までの分岐結果に対する分岐予測結果により、前回
までの不正解回数からカウントアップ若しくはカウント
ダウンして、不正解回数を記憶するための不正解回数バ
ッファに設定された不正解回数を更新する不正解回数更
新手段と、 分岐予測判定使用回数バッファに設定される前回までの
分岐結果を予測判定に使用した回数をカウントアップす
る分岐予測使用回数更新手段と、 前記不正解回数と分岐結果使用回数との出力に基づき、
重み情報の変更信号を生成する重み情報変更信号生成手
段と、 前記重み情報の変更信号により、重みバッファに設定さ
れている重み情報を、前回までの重み情報若しくは新た
な重み情報信号に書き換えて更新する重み情報書換え手
段と、 を具備し、 分岐予測を行う度に、重み情報を予測判定に使用した回
数及び予測不正解回数を任意に設定した回数と比較し
て、重み情報を更新することを特徴とする請求項4記載
の分岐予測装置を用いた処理装置。
6. The incorrect number-of-times buffer for storing the number of incorrect answers by counting up or down from the number of incorrect answers up to the previous time, based on a branch prediction result for the previous branch result in the weight buffer means. Means for updating the number of incorrect answers obtained, and means for updating the number of times of use of branch prediction for counting up the number of times the previous branch result set in the buffer for use of branch prediction determination used for prediction determination is counted up, Based on the output of the number of incorrect answers and the number of use of branch results,
Weight information change signal generating means for generating a weight information change signal; and updating the weight information set in the weight buffer by the previous weight information or a new weight information signal by the weight information change signal. Updating weight information by comparing the number of times the weight information is used for prediction determination and the number of incorrectly predicted predictions with the number of times set arbitrarily, each time branch prediction is performed. A processing device using the branch prediction device according to claim 4.
【請求項7】 前回までの分岐結果を予測判定を行う毎
にカウントアップし、 前回までの分岐結果が的中(正解)したか否か判定し、
正解であれば前回まで累積された不正解回数を減算し
て、前回までの分岐結果を次回の予測判定に使用し、不
正解であれば、不正解回数をインクリメントして、予め
定めた不正解回数に達し、且つ、その前回までの分岐結
果を予測判定に用いた回数が予め定めた回数に達した時
に、ニューラルネットワークで設定される前回までの重
み情報を最新の分岐結果に基づく値に随時、更新するこ
とを特徴とする情報処理装置の分岐予測方式。
7. A branch result up to the previous time is counted up each time prediction judgment is performed, and it is determined whether or not the branch result up to the previous time was a hit (correct answer).
If the answer is correct, the number of incorrect answers accumulated up to the previous time is subtracted, and the branch result up to the previous time is used for the next prediction judgment.If the answer is incorrect, the number of incorrect answers is incremented, and a predetermined incorrect answer is incremented. When the number of times has been reached, and the number of times the previous branch result has been used for prediction determination has reached a predetermined number, the weight information up to the previous time set in the neural network is changed to a value based on the latest branch result as needed. And a branch prediction method for an information processing apparatus.
JP9065997A 1996-10-09 1997-03-19 Branch estimation method for information processor and device using the method Pending JPH10171653A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9065997A JPH10171653A (en) 1996-10-09 1997-03-19 Branch estimation method for information processor and device using the method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP8-268620 1996-10-09
JP26862096 1996-10-09
JP9065997A JPH10171653A (en) 1996-10-09 1997-03-19 Branch estimation method for information processor and device using the method

Publications (1)

Publication Number Publication Date
JPH10171653A true JPH10171653A (en) 1998-06-26

Family

ID=26407156

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9065997A Pending JPH10171653A (en) 1996-10-09 1997-03-19 Branch estimation method for information processor and device using the method

Country Status (1)

Country Link
JP (1) JPH10171653A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6970997B2 (en) 2001-05-23 2005-11-29 Nec Corporation Processor, multiprocessor system and method for speculatively executing memory operations using memory target addresses of the memory operations to index into a speculative execution result history storage means to predict the outcome of the memory operation
JP2017016524A (en) * 2015-07-03 2017-01-19 富士通株式会社 Memory system, memory control method, and program
JP2020135499A (en) * 2019-02-21 2020-08-31 株式会社日立製作所 Data processing device, storage device and prefetch method
JP2021525404A (en) * 2018-11-19 2021-09-24 グーグル エルエルシーGoogle LLC Multitasking recurrent neural network

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6970997B2 (en) 2001-05-23 2005-11-29 Nec Corporation Processor, multiprocessor system and method for speculatively executing memory operations using memory target addresses of the memory operations to index into a speculative execution result history storage means to predict the outcome of the memory operation
JP2017016524A (en) * 2015-07-03 2017-01-19 富士通株式会社 Memory system, memory control method, and program
JP2021525404A (en) * 2018-11-19 2021-09-24 グーグル エルエルシーGoogle LLC Multitasking recurrent neural network
JP2020135499A (en) * 2019-02-21 2020-08-31 株式会社日立製作所 Data processing device, storage device and prefetch method

Similar Documents

Publication Publication Date Title
US5687360A (en) Branch predictor using multiple prediction heuristics and a heuristic identifier in the branch instruction
US7434037B2 (en) System for target branch prediction using correlation of local target histories including update inhibition for inefficient entries
US5740415A (en) Instruction supplying apparatus with a branch target buffer having the contents so updated as to enhance branch prediction accuracy
US6353883B1 (en) Method and apparatus for performing predicate prediction
US4477872A (en) Decode history table for conditional branch instructions
JP4027620B2 (en) Branch prediction apparatus, processor, and branch prediction method
JP2744890B2 (en) Branch prediction data processing apparatus and operation method
US7831817B2 (en) Two-level branch prediction apparatus
EP0847004B1 (en) Information processing apparatus with branch prediction
JP2006520964A (en) Method and apparatus for branch prediction based on branch target
CN115993992A (en) Early fetching of branch target buffers
US6691080B1 (en) Task execution time estimating method
US7000093B2 (en) Cellular automaton processing microprocessor prefetching data in neighborhood buffer
JP5136405B2 (en) Arithmetic processing device and control method of arithmetic processing device
US5822576A (en) Branch history table with branch pattern field
JP4213181B2 (en) Branch prediction apparatus, method thereof, and processor
US11442727B2 (en) Controlling prediction functional blocks used by a branch predictor in a processor
JP3725547B2 (en) Limited run branch prediction
JP4141112B2 (en) Processor and processor system
JPH10171653A (en) Branch estimation method for information processor and device using the method
US6678638B2 (en) Processor having execution result prediction function for instruction
US10963260B2 (en) Branch predictor
US7428632B2 (en) Branch prediction mechanism using a branch cache memory and an extended pattern cache
JP2883035B2 (en) Pipeline processor
EP0666538A2 (en) Data processor with branch target address cache and method of operation