JP2007249710A - Local slack prediction method, local slack prediction mechanism - Google Patents
Local slack prediction method, local slack prediction mechanism Download PDFInfo
- Publication number
- JP2007249710A JP2007249710A JP2006073551A JP2006073551A JP2007249710A JP 2007249710 A JP2007249710 A JP 2007249710A JP 2006073551 A JP2006073551 A JP 2006073551A JP 2006073551 A JP2006073551 A JP 2006073551A JP 2007249710 A JP2007249710 A JP 2007249710A
- Authority
- JP
- Japan
- Prior art keywords
- slack
- instruction
- predicted
- local
- execution
- 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
Links
Images
Landscapes
- Advance Control (AREA)
- Executing Machine-Instructions (AREA)
Abstract
【課題】より簡易な構成でローカル・スラックの予測を行うことのできるローカル・スラックの予測方法、及びローカル・スラック予測機構を提供する。
【解決手段】プロセッサで実行される命令i0を、その命令i0の予測スラックの値分だけその実行レイテンシを増加させて実行するとともに、予測スラックがターゲット・スラックに到達したと推定される命令実行時の振る舞いが観測されるまで命令i0の実行毎に徐々に予測スラックを増加させていき、最終的に予測スラックをターゲット・スラックに一致させることで、ローカル・スラックを予測する。
【選択図】図1A local slack prediction method and a local slack prediction mechanism capable of predicting local slack with a simpler configuration.
An instruction i0 executed by a processor is executed with an execution latency increased by an amount corresponding to the predicted slack of the instruction i0, and at the time of executing an instruction estimated that the predicted slack has reached target slack. The predicted slack is gradually increased for each execution of the instruction i0 until the behavior of is observed, and finally the predicted slack is matched with the target slack to predict the local slack.
[Selection] Figure 1
Description
本発明は、プロセッサで実行される命令のローカル・スラックを予測する方法、及びその予測を行う機構に関する。 The present invention relates to a method for predicting local slack of instructions executed by a processor, and a mechanism for performing the prediction.
近年、クリティカル・パスに関する情報を用いて命令の実行のスケジューリングを行うことで、マイクロプロセッサの高速化や消費電力の削減を図る技術の研究が数多く行われている。クリティカル・パスとは、たとえ1サイクルでもそのパス上の命令の実行レイテンシ、すなわち命令の実行開始からその結果が利用可能となるまでのサイクル数を増加させるとプログラム全体の実行サイクル数が増加してしまう命令列であり、プログラムの実行時間に決定的な影響を与える。しかしながら、クリティカル・パス情報によっては、クリティカル・パス上に在るか否かの2通りに命令を分類することしかできない。またクリティカル・パス上に存在する命令の数は、そうでない命令の数よりも通常は絶対的に少ないものとなっている。そのため、クリティカル・パス情報を用いて命令を分類し、分類したカテゴリの別で命令の処理系を分けた場合、処理系間の負荷バランスが悪くなってしまうことになる。 In recent years, many researches have been made on techniques for speeding up microprocessors and reducing power consumption by scheduling execution of instructions using information on critical paths. A critical path means that the execution latency of an instruction on the path is increased even in one cycle, that is, if the number of cycles from the start of instruction execution until the result becomes available, the number of execution cycles of the entire program increases. This instruction sequence has a decisive influence on the execution time of the program. However, depending on the critical path information, it is only possible to classify instructions in two ways, whether or not they are on the critical path. Also, the number of instructions present on the critical path is usually absolutely smaller than the number of instructions that are not. For this reason, when instructions are classified using critical path information, and the instruction processing systems are divided according to the classified categories, the load balance between the processing systems is deteriorated.
そこでクリティカル・パス情報の代りに、命令のスラック情報を用いることが考えられている。命令のスラックとは、プログラム全体の実行サイクル数を増加させることなく増加可能な命令の実行レイテンシのサイクル数を意味している。 Therefore, it is considered that instruction slack information is used instead of critical path information. Instruction slack means the number of cycles of instruction execution latency that can be increased without increasing the number of execution cycles of the entire program.
ここで図12を用いて、命令のスラックについて説明する。同図(b)は、同図(a)に例示したプログラムの実行態様を示している。このプログラムは、命令i0〜i6の7つの命令からなっている。なお、「i0」〜「i6」は、各命令に対応したプログラム・カウンタの値を示している。同図において各命令i0〜i6に対応したノードの長さは、その命令の実行レイテンシを表しており、同図での実行レイテンシは、命令i1,i4が2サイクルと、その他の命令が1サイクルとなっている。また矢印は、命令間の依存関係を示しており、例えば命令i3は、命令i0と命令i2とに依存している。ちなみに、命令i1→i2→i4→i6は、クリティカル・バスとなっている。 Here, instruction slack will be described with reference to FIG. FIG. 2B shows the execution mode of the program illustrated in FIG. This program is composed of seven instructions i0 to i6. Note that “i0” to “i6” indicate the values of the program counter corresponding to each instruction. In the figure, the length of the node corresponding to each instruction i0 to i6 represents the execution latency of the instruction. In the figure, the execution latency of the instructions i1 and i4 is 2 cycles, and the other instructions are 1 cycle. It has become. An arrow indicates a dependency between instructions. For example, the instruction i3 depends on the instruction i0 and the instruction i2. Incidentally, the instructions i 1 → i 2 → i 4 → i 6 are critical buses.
ここで命令i0のスラックを考える。命令i0の実行レイテンシを3サイクル増加させると、それに直接的、間接的にそれぞれ依存する命令i3及び命令i5の実行がそれぞれ1サイクルずつ遅れることになる。しかしながら、その場合にも、命令i5は、プログラム中、もっとも最後に実行される命令i6と同時刻に実行されることになり、プログラム全体の実行サイクル数は増加しない。ただし、命令i0の実行レイテンシをそれ以上増加させると、命令i5の実行が命令i6よりも遅れてしまうようになる。したがって命令i0のスラックは、「0〜3」である。一方、命令i3の実行レイテンシ、或いは命令i5の実行レイテンシのいずれかを、それ単独で1サイクル増加させてもプログラム全体の実行サイクル数は増加せず、2サイクル増加させればプログラム全体の実行サイクル数が増加するため、これら命令i3,i5のスラックは「0〜1」となる。なおクリティカル・パス上の命令i1,i2,i4,i6のスラックは、当然ながらいずれも「0」となる。 Here, the slack of the instruction i0 is considered. When the execution latency of the instruction i0 is increased by 3 cycles, the execution of the instruction i3 and the instruction i5 that depend directly or indirectly on the instruction i0 is delayed by one cycle. However, even in that case, the instruction i5 is executed at the same time as the instruction i6 executed last in the program, and the number of execution cycles of the entire program does not increase. However, if the execution latency of the instruction i0 is further increased, the execution of the instruction i5 is delayed from the instruction i6. Therefore, the slack of the instruction i0 is “0-3”. On the other hand, even if the execution latency of the instruction i3 or the execution latency of the instruction i5 is increased by one cycle alone, the number of execution cycles of the entire program does not increase. Since the number increases, the slack of these instructions i3 and i5 is “0 to 1”. Of course, the slacks of the instructions i1, i2, i4, i6 on the critical path are all “0”.
こうした命令のスラックが分かれば、プログラム全体の実行時間に影響を与えることなく、その命令の実行レイテンシをどの程度まで増加させられるかが分かるため、許容可能な各命令の実行レイテンシの増加度合に応じて、命令をより細かく分類することが可能となる。例えばスラックの最大値が「0」の命令、「1〜2」の命令、「3」以上の命令といった分類によって、命令を3つのカテゴリに分類することができる。 If you know the slack of these instructions, you can see how much the instruction execution latency can be increased without affecting the execution time of the entire program. This makes it possible to classify the instructions more finely. For example, the instructions can be classified into three categories by classification such as an instruction having a maximum slack value of “0”, an instruction of “1-2”, and an instruction of “3” or more.
また命令を2つのカテゴリに分ける場合にせよ、例えばスラックの最大値が「0〜2」の命令と「3」以上の命令といったような分類の仕方も可能であるため、上記クリティカル・パスを用いる場合のようなカテゴリ間の命令数の偏りを緩和することが可能にもなる。 Even when the instructions are divided into two categories, for example, it is possible to classify the instructions such as an instruction having a maximum slack value of “0 to 2” and an instruction having “3” or more, so the above critical path is used. It is possible to alleviate the deviation in the number of instructions between categories as in the case.
こうしたスラック情報を最大限に利用するには、各命令のスラックの最大値、すなわちグローバル・スラックを知る必要がある。しかしながら、グローバル・スラックは、依存する命令の実行レイテンシの増加により、動的に変化してしまう。例えば上述した命令i5のグローバル・スラックは、図12(b)の状態では「1」となっている。ところが、命令i0の実行レイテンシを3サイクル増加させれば、命令i5の実行レイテンシが1サイクルでも増加すればプログラム全体の実行サイクル数の増加を招くようになる。よって、このときの命令i5のグローバル・スラックは「0」となってしまう。またグローバル・スラックを判定するには、命令の実行レイテンシの増加がプログラムの最終的な実行サイクル数に与える影響をそのプログラムを実行している間に調べなければならない。そのため、グローバル・スラックの利用は、その実現が非常に困難となっている。 In order to make maximum use of such slack information, it is necessary to know the maximum slack value of each instruction, that is, global slack. However, global slack changes dynamically as the execution latency of dependent instructions increases. For example, the global slack of the instruction i5 described above is “1” in the state of FIG. However, if the execution latency of the instruction i0 is increased by 3 cycles, if the execution latency of the instruction i5 is increased even by one cycle, the number of execution cycles of the entire program is increased. Therefore, the global slack of the instruction i5 at this time is “0”. In order to determine global slack, the influence of an increase in instruction execution latency on the final number of execution cycles of a program must be examined while the program is being executed. Therefore, the use of global slack is very difficult to realize.
そこで、命令のグローバル・スラックではなく、ローカル・スラックを利用することが考えられている。命令のローカル・スラックとは、プログラム全体の実行サイクル数だけではなく、後続命令の実行にも影響を与えないスラックの最大値を意味している。例えば図12(b)の状態では、グローバル・スラックが「3」である命令i0の実行レイテンシを3サイクル増加させても、プログラム全体の実行サイクル数は増加しないが、それに依存する命令i3,i5の実行が遅延してしまう。一方、命令i0の実行レイテンシを2サイクル増加させても、後続の命令i3,i5の実行に遅れは生じない。よって、命令i0のローカル・スラックは「2」となる。こうした命令のローカル・スラックであれば、その命令の実行レイテンシの増加が、その命令に依存する後続命令に与える影響に着目するだけで求めることができる。 Therefore, it is considered to use local slack instead of global slack of instructions. The local slack of an instruction means not only the number of execution cycles of the entire program but also the maximum value of slack that does not affect the execution of subsequent instructions. For example, in the state of FIG. 12B, even if the execution latency of the instruction i0 whose global slack is “3” is increased by 3 cycles, the number of execution cycles of the entire program does not increase, but the instructions i3 and i5 depending on it. Execution will be delayed. On the other hand, even if the execution latency of the instruction i0 is increased by 2 cycles, there is no delay in the execution of the subsequent instructions i3 and i5. Therefore, the local slack of the instruction i0 is “2”. Such local slack of an instruction can be obtained simply by paying attention to the influence of an increase in the execution latency of the instruction on subsequent instructions depending on the instruction.
従来、こうした命令のローカル・スラックの予測手法として、ある命令がレジスタ・データ或いはメモリ・データを定義した時刻と、その定義されたデータを最初に参照した時刻の差から、そのときの当該命令のローカル・スラックを求め、それを次回の同命令の実行時のローカル・スラックの予測値とする手法が提案されている。 Conventionally, as a method for predicting the local slack of such an instruction, a difference between the time when an instruction defines register data or memory data and the time when the defined data is first referenced is determined. A method has been proposed in which local slack is obtained and used as a predicted value of local slack at the next execution of the same instruction.
図13は、こうした従来の予測手法を実現するためのローカル・スラック予測機構のハードウェア構成を示している。同図に示すように、この予測機構を採用するプロセッサ50は、フェッチ・ユニット11、デコード・ユニット12、命令ウィンドウ(I−win)13、レジスタ・ファイル(RF)14、実行ユニット(EU)15及びリオーダ・バッファ(ROB)16を備えて構成されている。一方、ローカル・スラック予測機構として、命令がレジスタ・データ及びメモリ・データを定義した時刻がそれぞれ記憶保持されるレジスタ定義表51及びメモリ定義表52と、求められた各命令のローカル・スラックの予測値を記憶保持するためのスラック表53とが設けられている。レジスタ定義表51は、物理レジスタ番号をインデクスとし、各インデクスにはその物理レジスタ番号に対応するレジスタにデータを定義した命令(命令のアドレスのインデクス部)とその定義の時刻とが記録保持される。またメモリ定義表52は、メモリの参照アドレスをインデクスとし、各インデクスにはその参照アドレスにデータを定義した命令(命令のアドレスのインデクス部)とその定義の時刻が記録保持される。スラック表53は、命令のアドレスをインデクスとし、各インデクスには、先の実行時における命令のローカル・スラックの演算値が記憶保持される。これら表に加え、予測機構には、データの定義時刻と参照時刻との差を求めるための演算器54が設けられてもいる。
FIG. 13 shows a hardware configuration of a local slack prediction mechanism for realizing such a conventional prediction method. As shown in the figure, the
ここで図12(b)の命令i0を例に、こうした従来の予測機構のローカル・スラックの予測動作を説明する。命令i0がレジスタ(メモリ)にデータを書き込みを行うとき、レジスタ定義表51(メモリ定義表52)には「i0」自身(命令のアドレス・インデクス)と共に現在の時刻「0」が記録される。その後、そのデータを命令i3が使用するとき、レジスタ定義表51(メモリ定義表52)から、そのデータを定義した命令i0とそのデータの定義された時刻「0」とが読み出される。そして現在時刻「3」と読み出されたデータの定義時刻「0」との差分が演算器54により求められ、更にその値から「1」を引いた「2」が、先の実行時の命令i0のローカル・スラックとしてスラック表53に記憶される。そして、再び命令i0がフェッチされたとき、スラック表53が参照され、i0に対応するエントリに記憶された「2」が同命令i0のローカル・スラックの予測値として使用される。 Here, the local slack prediction operation of the conventional prediction mechanism will be described by taking the instruction i0 of FIG. 12B as an example. When the instruction i0 writes data to the register (memory), the current time “0” is recorded in the register definition table 51 (memory definition table 52) together with “i0” itself (address and index of the instruction). Thereafter, when the instruction i3 uses the data, the instruction i0 defining the data and the defined time “0” of the data are read from the register definition table 51 (memory definition table 52). Then, the difference between the current time “3” and the definition time “0” of the read data is obtained by the computing unit 54, and “2” obtained by subtracting “1” from the value is the previous execution instruction It is stored in the slack table 53 as i0 local slack. When the instruction i0 is fetched again, the slack table 53 is referred to, and “2” stored in the entry corresponding to i0 is used as the predicted value of local slack of the instruction i0.
こうした従来の予測手法によれば、ある程度正確なローカル・スラックの予測が確かに可能ではあるが、スラック表に加え、2つの定義表と演算器とが必要であり、予測機構のハードウェア・コストは極めて高いものとなる。またプログラムの実行と並行して、定義表の参照/更新、時刻の引き算を高速度で行わなければならず、予測機構の動作による消費電力の増大が無視し難いものとなる虞もある。 According to such a conventional prediction method, it is possible to predict local slack with some accuracy, but in addition to the slack table, two definition tables and a calculator are required, and the hardware cost of the prediction mechanism is required. Is extremely expensive. In parallel with the execution of the program, the definition table must be referenced / updated and the time subtraction must be performed at a high speed, and the increase in power consumption due to the operation of the prediction mechanism may be difficult to ignore.
本発明は、こうした実状に鑑みてなされたものであり、その解決しようとする課題は、より簡易な構成でローカル・スラックの予測を行うことのできるローカル・スラック予測方法及び予測機構を提供することにある。 The present invention has been made in view of such a situation, and a problem to be solved is to provide a local slack prediction method and a prediction mechanism capable of predicting local slack with a simpler configuration. It is in.
上記課題を解決するため、本発明の請求項1に係るローカル・スラックの予測方法では、プロセッサで実行される命令を、その命令のローカル・スラックの予測値である予測スラックの値分だけその実行レイテンシを増加させて実行するとともに、前記命令の実行時の振る舞いに基づいて、現状におけるローカル・スラックの適正値であるターゲット・スラックに前記予測スラックが到達したか否かを推定し、到達したとの推定がなされるまで前記予測スラックを前記命令の実行毎に徐々に増加させていくようにしている。
In order to solve the above-mentioned problem, in the local slack prediction method according to
上記予測方法では、命令のローカル・スラックの予測値(予測スラック)がその実行毎に徐々に増加されていく。こうして予測スラックを増加していけば、その値はやがては、現状のローカル・スラックの適正値(ターゲット・スラック)に到達するようになる。一方、命令の実行時のプロセッサの振る舞いから、予測スラックのターゲット・スラックへの到達を推定するとともに、その到達したとの推定が成立した時点で、予測スラックの増加が止められる。その結果、予測スラックを直接的に計算せずとも、ローカル・スラックを予測することができるようになる。 In the prediction method, the predicted value of local slack (predicted slack) of an instruction is gradually increased every time the instruction is executed. If the predicted slack is increased in this way, the value eventually reaches the appropriate value (target slack) of the current local slack. On the other hand, the arrival of predicted slack to the target slack is estimated from the behavior of the processor at the time of execution of the instruction, and the increase in predicted slack is stopped at the time when it is estimated that the arrival has been reached. As a result, local slack can be predicted without directly calculating predicted slack.
なお、上記のようなターゲット・スラックへの予測スラックの到達の推定は、請求項2に記載のように、その推定の成立条件として、
(A)当該命令の実行時に分岐予測ミスが発生したこと、
(B)当該命令の実行時にキャッシュ・ミスが発生したこと、
(C)後続命令に対するオペランド・フォワーディングが発生したこと、
(D)後続命令に対するストア・データ・フォワーディングが発生したこと、
(E)当該命令が命令ウィンドウに存在する命令の中で最も古い命令となっていること、
(F)当該命令がリオーダ・バッファに存在する命令の中で最も古い命令となっていること、
(G)当該命令が、前記命令ウィンドウに存在する命令の中で最も古い命令に実行結果を渡す命令となっていること、
(H)当該命令が、同一のサイクルに実行される命令の中で最も多くの後続命令に実行結果を渡す命令となっていること、
(I)当該命令の実行結果を渡すことで、実行可能な状態となる後続命令の数が、予め定められた判定値以上となっていること、のうちのいずれかを含めるようにしている。
In addition, the estimation of the arrival of predicted slack to the target slack as described above, as described in
(A) A branch prediction error occurred during execution of the instruction,
(B) A cache miss occurred during execution of the instruction;
(C) Operand forwarding for the subsequent instruction has occurred,
(D) that store data forwarding has occurred for subsequent instructions;
(E) the instruction is the oldest instruction in the instruction window;
(F) the instruction is the oldest instruction in the reorder buffer;
(G) The instruction is an instruction that passes an execution result to the oldest instruction among the instructions existing in the instruction window;
(H) The instruction is an instruction that passes the execution result to the most subsequent instructions among the instructions executed in the same cycle;
(I) By passing the execution result of the instruction, it is included that the number of succeeding instructions that can be executed is greater than or equal to a predetermined determination value.
ここで上記(A)、(B)の振る舞いは、予測スラックがターゲット・スラックを上回り、後続命令の実行が遅延した状態で観測される。また上記(C)、(D)の振る舞いは、予測スラックがターゲット・スラックと一致したときに観測される。よってこれらの振る舞いが観測されたときには、予測スラックがターゲット・スラックに到達したと推定することができる。 Here, the behaviors (A) and (B) are observed in a state where the predicted slack exceeds the target slack and the execution of the subsequent instruction is delayed. The behaviors (C) and (D) are observed when the predicted slack matches the target slack. Therefore, when these behaviors are observed, it can be estimated that the predicted slack has reached the target slack.
一方、上記(E)〜(I)の振る舞いは、従来より、命令がクリティカル・パス上にあるか否かの判定条件として用いられている。予測スラックがターゲット・スラックに到達すると、命令の実行レイテンシをそれ以上1サイクルでも増加させると後続命令の実行に遅延が生じるという、クリティカル・パス上の命令と似た状況となるため、上記到達の推定条件としても用いることが可能である。 On the other hand, the above behaviors (E) to (I) are conventionally used as a determination condition as to whether or not an instruction is on the critical path. When the predicted slack reaches the target slack, if the instruction execution latency is further increased by one cycle, the execution of subsequent instructions will be delayed, resulting in a situation similar to the instruction on the critical path. It can also be used as an estimation condition.
なお、それまで予測スラックがターゲット・スラックに一致した状況となっているときにターゲット・スラックが動的に減少すると、予測スラックがターゲット・スラックを上回ってしまい、後続命令の実行が遅延されるという予測ミスのペナルティが発生してしまう。その点、請求項3に記載のように、予測スラックがターゲット・スラックに到達したとの推定がなされたときには同予測スラックを減少させるようにすれば、そうしたターゲット・スラックの動的な減少にも対応することができるようになる。 If the target slack decreases dynamically when the predicted slack matches the target slack until then, the predicted slack exceeds the target slack, and the execution of subsequent instructions is delayed. A misprediction penalty occurs. In this respect, if the predicted slack is reduced when it is estimated that the predicted slack has reached the target slack, the dynamic reduction of the target slack can be reduced. It will be possible to respond.
上記推定の成立、不成立をもって直ちに予測スラックを増加・減少させると、ターゲット・スラックが頻繁に増減を繰り返す場合に予測ミスのペナルティの発生頻度が高くなる虞がある。そうした場合にも、請求項4に記載のように、予測スラックがターゲット・スラックに到達したとの推定の成立条件の不成立回数が規定の回数となったことを条件に予測スラックを増加させ、同成立条件の成立回数が規定の回数となったことを条件に予測スラックを減少させるようにすれば、ターゲット・スラックが頻繁に増減したときの予測ミス・ペナルティの頻度の増加を抑えることができる。
If the predicted slack is increased or decreased immediately after the above estimation is established or not established, there is a risk that the frequency of occurrence of a misprediction penalty increases when the target slack frequently increases and decreases. Even in such a case, as described in
この場合、請求項5に記載のように、予測スラックを増加させるために必要な成立条件の不成立回数を、同予測スラックを減少させるために必要な成立条件の成立回数よりも大きく設定すれば、予測スラックの増加は慎重に、その減少は迅速に行われるようになる。そのため、ターゲット・スラックが頻繁に増減を繰り返したときの予測ミス・ペナルティの頻度の増加を効果的に抑制することができる。こうした効果は、請求項6に記載のように、予測スラックがターゲット・スラックに到達したとの推定の成立条件の不成立回数が規定の回数となったことを条件に予測スラックを増加させる一方、予測スラックの減少は、成立条件の成立を条件に行うようにしても、同様に得ることができる。
In this case, as described in
なお命令の種別によっては、動的な変化度合やその変化の頻度などのローカル・スラックの挙動に違いがある。そこでローカル・スラックをより精度良く予測するには、請求項8や請求項9に記載のように、予測スラックの上限値や、その1回当たりの更新量(増加量や減少量)を、命令の種別毎に異ならせることが望ましい。また請求項4〜6の予測方法のように、上記推定の成立条件の成立回数、又は不成立回数が規定の回数となったことを条件に予測スラックを更新する場合には、請求項7に記載のように、そうした規定の回数を命令の種別毎に異ならせることで、より高い精度で予測を行うことができるようになる。ちなみに、そうした命令の種別としては、例えば請求項10に記載のように、ロード命令、ストア命令、分岐命令及びその他命令の4つのカテゴリに分けることが考えられる。
Depending on the type of instruction, there is a difference in local slack behavior such as the dynamic change degree and the frequency of the change. Accordingly, in order to predict local slack with higher accuracy, the upper limit value of predicted slack and the amount of update (increase or decrease) per time are specified as described in
ところで命令のローカル・スラックは、その命令の実行に至るまでのプログラムの分岐経路によって大きく変化することがある。その点、請求項11に記載のように、当該命令の実行に至るプログラムの分岐パターンの別に予測スラックを個別に設定するようにすれば、命令の実行に至るまでのプログラムの分岐経路毎に個別にローカル・スラックが予測されることとなり、ローカル・スラックをより高い精度で予測することができるようになる。
By the way, the local slack of an instruction may change greatly depending on the branch path of the program leading to the execution of the instruction. In that respect, if predictive slack is individually set for each branch pattern of the program leading to the execution of the instruction as described in
一方、上記課題を解決するため、本発明の請求項12に係るローカル・スラック予測機構では、プロセッサで実行される命令のローカル・スラックを予測する機構として、各命令のローカル・スラックの予測値である予測スラックが記録保持されるスラック表と、命令の実行に際して前記スラック表を参照してその命令の前記予測スラックを取得するとともに、その取得した予測スラックの分だけ実行レイテンシを増加させる実行レイテンシ設定手段と、前記命令の実行時の振る舞いに基づき、同命令の現状のローカル・スラックの適正値であるターゲット・スラックに前記予測スラックが到達したか否かを推定する推定手段と、前記推定手段により前記予測スラックが前記ターゲット・スラックに到達したとの推定がなされるまで、前記予測スラックを前記命令の実行毎に徐々に増加させる予測スラック更新手段と、を備えるようにしている。 On the other hand, in order to solve the above-mentioned problem, in the local slack prediction mechanism according to claim 12 of the present invention, as a mechanism for predicting the local slack of the instruction executed by the processor, the predicted value of the local slack of each instruction is used. A slack table in which a certain predicted slack is recorded and stored, and the execution latency setting for acquiring the predicted slack of the instruction by referring to the slack table when executing the instruction and increasing the execution latency by the acquired predicted slack. An estimation means for estimating whether or not the predicted slack has reached target slack, which is an appropriate value of the current local slack of the instruction, based on the behavior at the time of execution of the instruction, and the estimation means Until the predicted slack has reached the target slack, the predicted slack is estimated. Slack so that and an predicted slack update means gradually increasing for each execution of the instruction.
上記構成では、予測スラック更新手段によって命令の予測スラックが、その命令の実行毎に徐々に増加され、実行レイテンシ設定手段によってその命令の実行レイテンシもその実行毎に同様に徐々に増加される。こうして予測スラックがターゲット・スラックに到達すると、命令の実行時のプロセッサの振る舞いがそれを示すものとなり、推定手段によりその旨の推定がなされ、その結果、上記予測スラック更新手段による予測スラックの増加が止められるようになる。そして以上により、直接計算することなく、予測スラックが求められる。 In the above configuration, the predicted slack of the instruction is gradually increased by the predicted slack updating means every time the instruction is executed, and the execution latency of the instruction is also gradually increased by the execution latency setting means every time the instruction is executed. When the predicted slack reaches the target slack in this way, the behavior of the processor at the time of execution of the instruction indicates that, and the estimation means estimates that. As a result, the predicted slack update means increases the predicted slack. You can stop. As described above, predicted slack is obtained without performing direct calculation.
なお、推定手段によるターゲット・スラックへの予測スラックの到達の推定は、例えば請求項13に記載のように、上記(A)〜(I)のいずれか1つ、あるいはそのうちの複数をその推定の成立条件とすることで行うことができる。
The estimation of the arrival of predicted slack to the target slack by the estimating means is performed by estimating any one of the above (A) to (I) or a plurality of them as described in
また請求項14に記載のように、予測スラックがターゲット・スラックに到達したとの推定の成立条件が成立となったときにそのカウンタ値が増加/減少され、推定の成立条件が不成立となったときにそのカウンタ値が減少/増加される信頼性カウンタを設けるとともに、前記信頼性カウンタのカウンタ値が増加判定値となったことを条件に前記予測スラックを増加させ、同信頼性カウンタのカウンタ値が減算判定値となったことを条件に前記予測スラックを減少させるように予測スラック更新手段をすれば、ターゲット・スラックが頻繁に増減を繰り返したときの予測ミス・ペナルティの発生頻度の増加を好適に抑制することができる。なお、そうした状態での予測ミス・ペナルティの発生頻度の増大をより効果的に抑制するには、請求項15に記載のように、信頼性カウンタでの推定の成立条件の成立時におけるカウンタ値の増加/減少量を、同推定の成立条件の不成立時における同カウンタ値の減少/増加量よりも大きく設定することが望ましい。
Further, as described in
更に命令の種別によるローカル・スラックの動的変化の様相の差違に対応してより精度良くローカル・スラックの予測を行うには、例えば請求項17に記載のように、更新手段による各命令の予測スラックの1回当たりの更新量(増加量、減少量)を、その命令の種別によって異ならせることが望ましい。また更新手段によって更新される各命令の前記予測スラックには上限値を設定する場合には、請求項18に記載のようにその上限値を命令の種別によって異ならせることも有効である。更には、請求項14や請求項15に記載の信頼性カウンタが設けられる場合には、請求項16に記載のように、カウンタ値の増加量及び減少量を命令の種別により異ならせることが有効である。ちなみに命令の種別としては、例えば請求項19に記載のように、ロード命令、ストア命令、分岐命令及びその他命令の4つのカテゴリに分類することが考えられる。
Furthermore, in order to predict local slack with higher accuracy in response to a difference in the aspect of dynamic change of local slack depending on the type of instruction, for example, the prediction of each instruction by the updating means as described in claim 17 It is desirable to vary the amount of slack update (increase and decrease) per time depending on the type of instruction. Further, when an upper limit value is set for the predicted slack of each instruction updated by the updating means, it is also effective to make the upper limit value different depending on the type of instruction as described in
また請求項20に記載のように、プログラムの分岐履歴を記録する分岐履歴レジスタを設けるとともに、その分岐履歴レジスタを参照して得られる分岐パターンの別に命令の予測スラックをスラック表に個別に記録するようにすることも、予測精度の向上には有効である。
A branch history register for recording a branch history of a program is provided as described in
本発明のローカル・スラックの予測方法及び予測機構では、命令のローカル・スラックの予測値(予測スラック)を計算で直接的に求めるのではなく、命令の実行時の振る舞いを観測しながら、適正値に到達するまで予測スラックを徐々に増加させることで求めている。そのため、予測スラックの直接演算に要する複雑な機構は不要であり、より簡易な構成でローカル・スラックの予測を行うことができる。 According to the local slack prediction method and the prediction mechanism of the present invention, an appropriate value is obtained while observing the behavior at the time of execution of an instruction, instead of directly calculating a predicted value of local slack (predicted slack) of an instruction. By gradually increasing the predicted slack until it reaches Therefore, a complicated mechanism required for direct calculation of predicted slack is unnecessary, and local slack can be predicted with a simpler configuration.
以下、本発明を具体化した一実施形態を図1〜図11を参照して詳細に説明する。
まず、本実施形態におけるローカル・スラックの予測方法の基本動作を説明する。本予測方法では、命令実行時のプロセッサの振る舞いを観測しつつ、命令のローカル・スラックの予測値の値を増加又は減少させるように更新していくことで、その予測値をローカル・スラックの実際の値に近づけていくようにしている。なお、以下の説明では、命令のローカル・スラックの予測値を「予測スラック」と記載し、命令のローカル・スラックの実際の値を「ターゲット・スラック」と記載する。
Hereinafter, an embodiment of the present invention will be described in detail with reference to FIGS.
First, the basic operation of the local slack prediction method in this embodiment will be described. In this prediction method, while observing the behavior of the processor at the time of instruction execution, the predicted value is updated to increase or decrease the predicted value of the local slack of the instruction. It tries to be close to the value of. In the following description, the predicted value of the local slack of the instruction is described as “predicted slack”, and the actual value of the local slack of the instruction is described as “target slack”.
こうした本予測方法の基本動作を説明する。本予測方法ではまず、命令のフェッチに際してその命令の予測スラックを取得し、その取得した予測スラックの分だけその命令の実行レイテンシを増加させる。例えば実行レイテンシが本来「1サイクル」の命令について、その予測スラックが「2」であったときには、その命令の実行レイテンシは「3サイクル」に増加させる。なお、何れの命令についても、プログラムの開始後にその命令が始めてフェッチされたときには、そのローカル・スラックは「0」と予測する。すなわち、すべての命令についてその予測スラックの初期値は「0」に設定されている。その後、実行時における命令の振る舞いを観測し、予測スラックがターゲット・スラックに到達したと推定されるまで、予測スラックを徐々に増加させていく。 The basic operation of this prediction method will be described. In this prediction method, first, when fetching an instruction, the predicted slack of the instruction is acquired, and the execution latency of the instruction is increased by the acquired predicted slack. For example, for an instruction whose execution latency is originally “1 cycle”, when the predicted slack is “2”, the execution latency of the instruction is increased to “3 cycles”. For any instruction, when the instruction is fetched for the first time after the start of the program, the local slack is predicted to be “0”. That is, the initial value of the predicted slack is set to “0” for all instructions. Thereafter, the behavior of the instruction at the time of execution is observed, and the predicted slack is gradually increased until it is estimated that the predicted slack has reached the target slack.
予測スラックがターゲット・スラックに到達したか否かの判定は、以下の態様で行われる。予測スラックを増加させていった結果、その値がターゲット・スラックに一致した値に達した状況では、その命令の実行レイテンシを更に1サイクルでも増加させると、それに依存する後続命令の実行に遅延が生じてしまう状態となっている。また予測スラックがターゲット・スラックを上回った状況では、既に後続命令の実行に遅延が生じた状態となっている。こうした状態では、実行時に命令は、(A)分岐予測ミス、(B)キャッシュ・ミス、(C)後続命令に対するオペランド・フォワーディング、(D)後続命令に対するストア・データ・フォワーディング、などの振る舞いを示すと考えられる。これらの命令の振る舞い(A)〜(D)について、以下に説明する。 The determination as to whether the predicted slack has reached the target slack is performed in the following manner. As a result of increasing the predicted slack, when the value reaches a value that matches the target slack, if the execution latency of the instruction is further increased by one cycle, the execution of the subsequent instruction depending on it will be delayed. It is in a state that occurs. In a situation where the predicted slack exceeds the target slack, the execution of the subsequent instruction is already delayed. Under these conditions, the instruction during execution exhibits behavior such as (A) branch prediction miss, (B) cache miss, (C) operand forwarding for subsequent instructions, (D) store data forwarding for subsequent instructions, etc. it is conceivable that. The behavior (A) to (D) of these instructions will be described below.
まず上記(A)の分岐予測ミスについて説明する。パイプライン処理を行なうプロセッサは、多数の命令を流れ作業的に同時に実行するため、分岐命令で以後に実行される命令列が変更されると、既に処理を開始した後続命令をすべて破棄しなくてはならず、処理効率が低下する。これを防ぐため、以前に当該分岐命令が実行されたときの分岐の発生状況から命令が分岐するか否かを予測し、その予測結果に従って分岐予測先の命令を投機実行するようにしている。ここで予測スラックがターゲット・スラックを上回った状況を考える。こうした状況では、先行命令の実行レイテンシが過剰に増加されて、それに依存する後続命令の実行に遅延が生じる。このような場合、適正な分岐予測ができなくなり、分岐の予測結果を誤り易くなる。そのため、分岐予測ミスが発生したときには、予測スラックがターゲット・スラックを上回ってしまっている可能性が高いと考えることができる。 First, the branch prediction error (A) will be described. Since a processor that performs pipeline processing simultaneously executes a large number of instructions in a work flow, if the instruction sequence to be executed later is changed by a branch instruction, all subsequent instructions that have already started processing must be discarded. In other words, the processing efficiency decreases. In order to prevent this, it is predicted whether or not the instruction will branch based on the state of occurrence of the branch when the branch instruction was previously executed, and the branch prediction destination instruction is speculatively executed according to the prediction result. Consider the situation where predicted slack exceeds target slack. In such a situation, the execution latency of the preceding instruction is excessively increased, causing a delay in the execution of the succeeding instruction that depends on it. In such a case, proper branch prediction cannot be performed, and branch prediction results are likely to be erroneous. For this reason, when a branch prediction error occurs, it can be considered that there is a high possibility that the predicted slack exceeds the target slack.
次に、上記(B)のキャッシュ・ミスについて説明する。多くのプロセッサでは、使用頻度の高いデータ等を、高速なキャッシュ・メモリに蓄積しておくことで、低速な記憶装置へのアクセスを低減し、プロセッサの処理を高速化するようにしている。先行命令の予測スラックがターゲット・スラックを上回った状態となると、こうしたキャッシュ動作を適正に行うことができなくなり、キャッシュ・ミスが発生し易くなる。したがって、キャッシュ・ミスが発生したときにも、予測スラックがターゲット・スラックを上回ってしまっている可能性が高いと考えることができる。 Next, the cache miss (B) will be described. In many processors, frequently used data and the like are stored in a high-speed cache memory, thereby reducing access to a low-speed storage device and increasing the processing speed of the processor. If the predicted slack of the preceding instruction exceeds the target slack, such a cache operation cannot be performed properly, and a cache miss is likely to occur. Therefore, even when a cache miss occurs, it can be considered that there is a high possibility that the predicted slack exceeds the target slack.
続いて上記(C)及び(D)の後続命令に対するオペランド・フォワーディング及びストア・データ・フォワーディングについて説明する。先行命令とその先行命令の定義したデータを参照する後続命令との実行間隔が短いと、データの書き込み完了前に後続命令がそのデータを読み込もうとしてデータ・ハザードが発生してしまうことがある。そのため、多段パイプラインを有するプロセッサの多くでは、バイパス回路を設けて、書き込み前のデータを後続命令に直接与えるオペランド・フォワーディングやストア・データ・フォワーディングを行うことで、そうしたデータ・ハザードを回避するようにしている。こうしたフォワーディングは、先行命令の定義したデータを参照する後続命令が、先行命令の直後に連続して実行されるときに発生する。したがって、オペランド・フォワーディングやストア・データ・フォワーディングが発生したときには、予測スラックがターゲット・スラックと一致していると判断することができる。 Next, operand forwarding and store data forwarding for the subsequent instructions (C) and (D) will be described. If the execution interval between the preceding instruction and the subsequent instruction that refers to the data defined by the preceding instruction is short, a data hazard may occur when the subsequent instruction tries to read the data before the data writing is completed. Therefore, in many processors with multistage pipelines, a bypass circuit is provided to avoid such data hazards by performing operand forwarding or store data forwarding that directly gives the data before writing to subsequent instructions. I have to. Such forwarding occurs when a subsequent instruction that refers to data defined by the preceding instruction is executed immediately after the preceding instruction. Therefore, when operand forwarding or store data forwarding occurs, it can be determined that the predicted slack matches the target slack.
本予測方法では、命令実行時の振る舞いが,上記(A)〜(D)のいずれかに該当するとき、予測スラックがターゲット・スラックに到達したと推定し,そうでないときには未到達であると判定するようにしている。こうした予測スラックがターゲット・スラックに到達したとの推定の成立条件を上記(A)〜(D)の論理和条件とし、ターゲット・スラック到達条件と記載する。なお上記(A)〜(D)のような命令実行時の振る舞いを検出する機構は、分岐予測、キャッシュ、フォワーディングを行うプロセッサであれば、通常、元より備えられている。そのため、ローカル・スラック予測のためにそうした検出機構を新規追加せずとも、上記到達条件の成立の有無を確認することが可能である。 In this prediction method, when the behavior at the time of instruction execution corresponds to one of the above (A) to (D), it is estimated that the predicted slack has reached the target slack, and otherwise it is determined that it has not been reached. Like to do. The condition for establishing that such predicted slack has reached the target slack is defined as the OR condition of the above (A) to (D) and described as the target slack arrival condition. A mechanism for detecting the behavior at the time of instruction execution as in the above (A) to (D) is usually provided from the beginning if it is a processor that performs branch prediction, cache, and forwarding. Therefore, it is possible to confirm whether or not the arrival condition is satisfied without newly adding such a detection mechanism for local slack prediction.
図1に、こうした本予測方法の基本動作に基づいて、先の図12(a)のプログラムを繰り返し実行する過程を示す。図1(a)〜(c)は、プログラムの1〜3回目の実行時の様子をそれぞれ示している。なお、ここでは、命令i0のみをローカル・スラックの予測対象とし、その予測スラックを1回につき「1」ずつ増加させるものとしている。 FIG. 1 shows a process of repeatedly executing the program of FIG. 12A based on the basic operation of this prediction method. FIGS. 1A to 1C show the states of the first to third executions of the program, respectively. Here, only the instruction i0 is set as a prediction target for local slack, and the predicted slack is increased by “1” at a time.
さてプログラムの1回目の実行では、命令i0の予測スラックは初期値「0」であり、ターゲット・スラック「2」に未到達であるため、命令i0の予測スラックが「1」増加される。その結果、同図(b)に示すように、2回目のプログラムの実行では、命令i0の予測スラックは「1」となり、実行レイテンシが1サイクル分増加された状態で命令i0が実行される。このときにも、予測スラックはターゲット・スラックに未到達であるため、予測スラックは更に「1」増加される。これにより、3回目のプログラムの実行では、命令i0の予測スラックは「2」ととなり、同命令i0に引き続き後続の命令i3が実行されるようになる。そしてその結果、後続の命令i3の実行に際しては、オペランド・フォワードが行われるようになり、上記ターゲット・スラック到達条件を満たすようになるため、命令i0の予測スラックはそれ以上増加されずに「2」のまま維持される。以上のように、命令実行時の振る舞いからターゲット・スラックへの到達が確認されるまで、予測スラックを徐々に増加させることで、命令i0のローカル・スラックを予測することができる。 In the first execution of the program, the predicted slack of the instruction i0 is the initial value “0”, and the target slack “2” has not yet been reached, so the predicted slack of the instruction i0 is increased by “1”. As a result, as shown in FIG. 5B, in the second program execution, the predicted slack of the instruction i0 is “1”, and the instruction i0 is executed with the execution latency increased by one cycle. Also at this time, since the predicted slack has not reached the target slack, the predicted slack is further increased by “1”. As a result, in the third program execution, the predicted slack of the instruction i0 is “2”, and the instruction i3 subsequent to the instruction i0 is executed. As a result, when the subsequent instruction i3 is executed, operand forward is performed, and the target slack arrival condition is satisfied. Therefore, the predicted slack of the instruction i0 is not increased any more and “2 Is maintained. As described above, the local slack of the instruction i0 can be predicted by gradually increasing the predicted slack until the arrival at the target slack is confirmed from the behavior at the time of instruction execution.
(予測スラックの減少)
上記のような本予測方法の基本動作は、ターゲット・スラックが静的に一定の値に維持されているという前提であれば、それだけでも十分に機能する。ただし、命令のターゲット・スラックは、動的にその値が増減する。ターゲット・スラック到達後、そのターゲット・スラックがより大きい値に変化した場合には、上記到達条件が再び不成立となり、予測スラックは変化後のターゲット・スラックに向けて再び増加するようになるため、特に問題は生じない。一方、ターゲット・スラックが予測スラックよりも小さい値に変化してしまった場合には、上記基本動作だけでは予測スラックをその変化に追従させることができなくなってしまう。
(Decrease in predicted slack)
The basic operation of the present prediction method as described above works satisfactorily as long as it assumes that the target slack is statically maintained at a constant value. However, the value of the target slack of the instruction is dynamically increased or decreased. When the target slack changes to a larger value after reaching the target slack, the above arrival condition is not satisfied again, and the predicted slack increases again toward the changed target slack. There is no problem. On the other hand, when the target slack has changed to a value smaller than the predicted slack, the predicted slack cannot follow the change only with the basic operation.
この上記基本動作の問題を、図2(a)に基づき説明する。図2(a)には、ある命令の予測スラックがターゲット・スラックに一旦到達した後の時刻t1において、ターゲット・スラックが予測スラックを下回る値に減少したときの予測スラック及びターゲット・スラックの推移が示されている。同図に示すように、プログラムの開始後、予測スラックは、ターゲット・スラックに到達するまで増加され、その到達後は到達時の値に維持される。この状態で時刻t1においてターゲット・スラックが減少すると、予測スラックは、ターゲット・スラックを上回るようになる。しかしながら、上記基本動作では、そうした状態となっても予測スラックは、その後も更新されずに現状の値に維持される。そして予測スラックがターゲット・スラックを上回った分、後続命令の実行が遅延されてしまうようになり、プロセッサの処理に悪影響を与えるようになる。 The problem of the basic operation will be described with reference to FIG. FIG. 2A shows the transition of predicted slack and target slack when the target slack decreases to a value lower than the predicted slack at time t1 after the predicted slack of a certain instruction reaches the target slack. It is shown. As shown in the figure, after the start of the program, the predicted slack is increased until reaching the target slack, and is maintained at the value at the time of arrival after reaching the target slack. In this state, when the target slack decreases at time t1, the predicted slack exceeds the target slack. However, in the basic operation, the predicted slack is maintained at the current value without being updated after that even in such a state. As the predicted slack exceeds the target slack, the execution of subsequent instructions is delayed, which adversely affects the processing of the processor.
こうした問題は、ターゲット・スラックが予測スラックを下回ったときには予測スラックを減少させることで解決可能である。こうした予測スラックの減少を実現する手法としては、スラック予測を行わなかったときの後続命令の実行時刻を利用する方法が考えられる。すなわち、後続命令が本来実行される筈だった時刻と実際に実行された時刻との差を求めれば、先行命令のスラック予測のミスによる後続命令の実行時刻の遅延量が分かり、その分、先行命令の予測スラックを減少させれば、予測スラックとターゲット・スラックを一致させることができるようになる。また、ターゲット・スラックを直接計算し、現状の予測スラックと比較するといった方法も考えられる。しかしながら、これらの手法では、資源制約、データ依存、制御依存等の命令の実行時刻を決定する様々な要素を考慮して、後続命令の本来の実行時刻やターゲット・スラックを計算しなければならず、容易に実現することはできないものとなっている。 These problems can be solved by reducing the predicted slack when the target slack falls below the predicted slack. As a method for realizing such a decrease in predicted slack, a method of using the execution time of the subsequent instruction when slack prediction is not performed can be considered. In other words, if the difference between the time when the subsequent instruction was supposed to be executed and the time when it was actually executed is obtained, the amount of delay in the execution time of the subsequent instruction due to a slack prediction error of the preceding instruction can be found. By reducing the predicted slack of instructions, the predicted slack and target slack can be matched. Another possible method is to directly calculate the target slack and compare it with the current predicted slack. However, in these methods, the original execution time and target slack of subsequent instructions must be calculated in consideration of various factors that determine the execution time of instructions such as resource constraints, data dependency, and control dependency. It cannot be easily realized.
そこでここでは、上述のターゲット・スラック到着条件を利用して予測スラックがターゲット・スラックを上回っている(厳密には、予測スラックがターゲット・スラックと一致する場合も含む)か否かを判定し、ターゲット・スラックを下回るようになるまで予測スラックを減少させるという手法を採用する。こうした手法では、命令の本来の実行時刻やターゲット・スラックそのものの計算のような複雑な計算等を行わずとも、極めて容易にターゲット・スラックの動的な減少に対応することができる。 Therefore, here, it is determined whether the predicted slack exceeds the target slack using the above-described target slack arrival conditions (strictly, including the case where the predicted slack matches the target slack), Use a technique that reduces predicted slack until it falls below the target slack. Such a method can cope with the dynamic decrease of the target slack very easily without performing complicated calculation such as the original execution time of the instruction or calculation of the target slack itself.
図2(b)に、こうした手法を採用した場合のローカル・スラックの動的な減少に対する予測スラックの推移を示す。この場合にも、プログラムの開始後、予測スラックは、ターゲット・スラックに到達するまで増加される。ただし、この場合には、ターゲット・スラックに到達すると予測スラックは、一旦は減少されるが、それによりターゲット・スラックを下回るようになるため、即座に増加に転じ、再びターゲット・スラックに到達するようになる。したがってこの場合には、ターゲット・スラックに一旦到達した後、予測スラックは、小幅な増減を繰り返しながら、ターゲット・スラックの直下を推移することになる。その後、時刻t1において、ターゲット・スラックが予測スラックを下回る値に減少すると、予測スラックは、その減少したターゲット・スラックを下回るまで減少していく。そしてターゲット・スラックを下回った後は、ターゲット・スラックの直下において再び小幅な増減を繰り返すようになる。 FIG. 2B shows the transition of predicted slack with respect to the dynamic decrease of local slack when such a method is adopted. Again, after the start of the program, the predicted slack is increased until the target slack is reached. However, in this case, when the target slack is reached, the predicted slack is once reduced, but then becomes lower than the target slack, so it immediately increases and reaches the target slack again. become. Therefore, in this case, once the target slack is reached, the predicted slack changes immediately below the target slack while repeating small increases and decreases. Thereafter, when the target slack decreases to a value lower than the predicted slack at time t1, the predicted slack decreases until it falls below the decreased target slack. After falling below the target slack, a slight increase / decrease is repeated again immediately below the target slack.
このように上記手法を採用すれば、ローカル・スラックの動的な減少にも対応することが可能となる。
(信頼性の導入)
上記のような予測スラックの減少手法の採用により、ローカル・スラックの動的な減少にも予測スラックを追従させることができる。ただし、図3(a)のようにターゲット・スラックが頻繁に増加と減少とを繰り返す場合には、予測ミスのペナルティが頻繁に発生しまうようになる。すなわち、上述の予測スラックの減少手法をそのまま採用した場合、ターゲット・スラックに未到達であれば、予測スラックは即座に増加される。ところが、その直後にターゲット・スラックが減少すると、予測スラックはターゲット・スラックを上回ってしまうことになる。そしてターゲット・スラックが増減を繰り返すと、予測スラックはそれに連動して増減し、ターゲット・スラックが減少する度に後続命令の実行の遅延が発生するようになる。
By adopting the above method in this way, it is possible to cope with a dynamic decrease in local slack.
(Introduction of reliability)
By adopting the method for reducing predicted slack as described above, predicted slack can be made to follow the dynamic reduction of local slack. However, when the target slack repeatedly increases and decreases as shown in FIG. 3A, a penalty of misprediction frequently occurs. In other words, when the predicted slack reduction method described above is employed as it is, if the target slack is not reached, the predicted slack is immediately increased. However, if the target slack decreases immediately thereafter, the predicted slack will exceed the target slack. When the target slack repeatedly increases and decreases, the predicted slack increases and decreases accordingly, and a delay in execution of the subsequent instruction occurs each time the target slack decreases.
そこでここでは、ターゲット・スラック到達条件の判定に基づく予測スラックの増減操作に、信頼性という概念を導入する。すなわち、上記到達条件の単一の判定結果に応じて直ちに予測スラックを増減するのではなく、同到達条件の成立回数・不成立回数がある規定の回数となったときに始めて実際に予測スラックを増減させるようにする。具体的には、命令の予測スラック毎に信頼性カウンタを設け、そのカウンタ値を、命令がターゲット・スラック到達条件を満たしていれば減少させ、満たしていなければ増加させるようにする。そして、そのカウンタ値が「0」(減少判定値)となったら予測スラックを減少させ、ある閾値(増加判定値)を越えたら予測スラックを増加させるようにする。なお予測スラックの増加を慎重に行うため、予測スラックを増加させたときには、信頼性カウンタのカウンタ値は「0」にリセットすることとする。こうした信頼性カウンタを用いた予測スラックの増減を行えば、予測スラックの増加は、上記到達条件の連続した不成立回数が規定の回数となったことを条件に行われ、予測スラックの減少は、同到達条件の連続した成立回数が規定の回数となったことを条件に行われるようになる。 Therefore, here, the concept of reliability is introduced in the operation of increasing / decreasing the predicted slack based on the determination of the target slack arrival condition. That is, instead of immediately increasing or decreasing the predicted slack according to the single determination result of the above reaching condition, the predicted slack is actually increased or decreased only when a certain number of times that the reaching condition is satisfied or not is reached. Let's make it. Specifically, a reliability counter is provided for each predicted slack of the instruction, and the counter value is decreased if the instruction satisfies the target slack arrival condition, and is increased if the instruction does not satisfy the target slack arrival condition. Then, the predicted slack is decreased when the counter value becomes “0” (decrease determination value), and the predicted slack is increased when a certain threshold value (increase determination value) is exceeded. In order to carefully increase the predicted slack, the counter value of the reliability counter is reset to “0” when the predicted slack is increased. When predictive slack is increased or decreased using such a reliability counter, the predicted slack is increased on the condition that the number of consecutive failure of the arrival condition has become the specified number, and the decrease in predicted slack is the same. This is performed under the condition that the number of consecutive arrival conditions reaches the specified number.
もっとも、予測スラックがローカル・スラックを上回ったときの後続命令の実行の遅延発生を回避する上では、予測スラックの増加は慎重に、予測スラックの減少は迅速に行うことが望ましい。そのためには、上記達成条件成立時のカウンタ値の減少量を、不成立時の同カウンタ値の増加量よりも大きくすればよい。あるいは、命令がターゲット・スラック到達条件を満たしていれば、カウンタ値を「0」にリセットし、1度の到達条件の成立で強制的に予測スラックを減少させるようにしてもよい。 However, in order to avoid delay in execution of subsequent instructions when the predicted slack exceeds the local slack, it is desirable to increase the predicted slack carefully and to decrease the predicted slack quickly. For this purpose, the decrease amount of the counter value when the achievement condition is satisfied may be made larger than the increase amount of the counter value when the achievement condition is not satisfied. Alternatively, if the instruction satisfies the target slack arrival condition, the counter value may be reset to “0”, and the predicted slack may be forcibly decreased when the arrival condition is satisfied once.
図3(b)に、信頼性を導入したときの予測カウンタの推移を示す。ここでは、到達条件成立時に信頼性カウンタを「0」にリセットするようにしている。この場合、予測スラックは、ターゲット・スラックに向けて、信頼性を導入しない場合に比して緩やかに増加していく。一方、ターゲット・スラックに到達する、あるいはそれを越えると、予測スラックは、即座に減少する。その結果、同図のようにターゲット・スラックが頻繁に増減を繰り返しても、予測スラックがターゲット・スラックを超過する頻度は低減されるようになる。 FIG. 3B shows the transition of the prediction counter when reliability is introduced. Here, the reliability counter is reset to “0” when the reaching condition is satisfied. In this case, the predicted slack increases gradually toward the target slack as compared with the case where reliability is not introduced. On the other hand, when the target slack is reached or exceeded, the predicted slack decreases immediately. As a result, even if the target slack repeatedly increases and decreases as shown in the figure, the frequency at which the predicted slack exceeds the target slack is reduced.
(ローカル・スラック予測機構の構成)
次に、上述した予測方法を実現する、本実施形態のローカル・スラック予測機構について説明する。図4は、本実施形態のローカル・スラック予測機構のハードウェア構成を説明する。
(Configuration of local slack prediction mechanism)
Next, the local slack prediction mechanism of the present embodiment that realizes the above-described prediction method will be described. FIG. 4 illustrates the hardware configuration of the local slack prediction mechanism of the present embodiment.
同図4に示すように、本実施形態のローカル・スラック予測機構の適用されたプロセッサ10は、フェッチ・ユニット11、デコード・ユニット12、命令ウィンドウ(I−win)13、レジスタ・ファイル(RF)14、実行ユニット(EU)15及びリオーダ・バッファ(ROB)16を備えて構成されている。このプロセッサ10を構成する各ユニットの機能は次の通りとなっている。フェッチ・ユニット11は、主記憶装置からの命令の読み込みを行う。デコード・ユニット12は、読み込まれた命令の内容の解析(デコード)し、命令ウィンドウ13及びリオーダ・バッファ16にそれぞれ格納する。命令ウィンドウ13は、実行前の命令を一時的に格納するバッファであり、プロセッサの制御回路は、このバッファから命令を取り出して、実行ユニット15に順次投入する。一方、リオーダ・バッファ16は、命令を格納するFIFO式のスタックであり、格納された命令の中で格納の順が最も早い命令の実行が終了すると、その命令が取り出される(コミットされる)。なおレジスタ・ファイル14は、命令の実行に必要なデータや命令の実行結果、実行中、実行予定の命令のアドレス・インデクス等をそれぞれ格納する各種レジスタの実体となっている。
As shown in FIG. 4, the
さて本実施形態のローカル・スラック予測機構は、予測スラックを記憶保持するスラック表20によって構成されている。このスラック表は、命令のPC(その命令を格納する主記憶装置のメモリ・アドレス)をインデクスとし、対応する命令の予測スラックと、信頼性カウンタのカウンタ値とがエントリとして記憶保持される。 The local slack prediction mechanism of the present embodiment is configured by a slack table 20 that stores and holds predicted slack. In this slack table, the instruction PC (memory address of the main storage device storing the instruction) is used as an index, and the predicted slack of the corresponding instruction and the counter value of the reliability counter are stored and held as entries.
フェッチ・ユニット11は、命令のフェッチ時に、その命令のPCをインデクスとしてスラック表20を参照し、該当命令の予測スラックを取得するとともに、その取得した予測スラックの分、該当命令の実行レイテンシを増加させる。そして命令のコミット時に、実行時の命令の振る舞いに基づき、その命令に対応したスラック表20の各エントリの値の更新が行われる。なお、スラック表20の各エントリの更新に関して、次のパラメータが定数として予め設定されている。
・Vmax:予測スラックの最大値、
・Vmin:予測スラックの最小値(=0)、
・Vinc:予測スラックの1回あたりの増加量、
・Vdec:予測スラックの1回あたりの減少量、
・Cmax:信頼性カウンタのカウンタ値の最大値、
・Cmin:信頼性カウンタのカウンタ値の最小値(=0)、
・Cth:信頼性カウンタの閾値(増加判定値)、
・Cinc:信頼性カウンタのカウンタ値の1回あたりの増加量、
・Cdec:信頼性カウンタのカウンタ値の1回あたりの減少量。
When fetching an instruction, the fetch
Vmax: the maximum value of predicted slack,
Vmin: the minimum value of predicted slack (= 0),
・ Vinc: Increase in predicted slack per time,
Vdec: the amount of decrease in predicted slack per time,
Cmax: Maximum value of the reliability counter,
Cmin: minimum value of the counter value of the reliability counter (= 0),
Cth: reliability counter threshold (increase judgment value),
Cinc: increase amount of the counter value of the reliability counter per time,
Cdec: the amount of decrease in the counter value of the reliability counter per time.
スラック表20のエントリの更新の態様を説明する。上述したターゲット・スラック到達条件が成立していれば、信頼性カウンタのカウンタ値を「0」にリセットし,そうでなければ増加量Cincだけ同カウンタ値を増加させる。ここでカウンタ値が閾値Cth以上になったら、予測スラックを上記増加量Vincだけ増加させるとともに、カウンタ値を「0」にリセットする。一方、信頼性カウンタのカウンタ値が「0」となったら、予測スラックを上記減少量Vdecだけ減少させる。なお本実施形態では、ターゲット・スラック到達条件が成立すれば信頼性を「0」にリセットするようにしており、上記カウンタ値の減少量Cdecを上記閾値Cthと同値としている。また本実施形態では、予測スラックを増加させる際に、信頼性カウンタのカウンタ値が「0」にリセットされるため、カウンタ値の最大値Cmaxは、上記閾値Cthと同値となっている。 A manner of updating entries in the slack table 20 will be described. If the target slack arrival condition is satisfied, the counter value of the reliability counter is reset to “0”, otherwise, the counter value is increased by the increase amount Cinc. Here, when the counter value becomes equal to or greater than the threshold value Cth, the predicted slack is increased by the increase amount Vinc, and the counter value is reset to “0”. On the other hand, when the counter value of the reliability counter becomes “0”, the predicted slack is decreased by the decrease amount Vdec. In this embodiment, the reliability is reset to “0” when the target slack arrival condition is satisfied, and the amount of decrease Cdec of the counter value is set equal to the threshold value Cth. In the present embodiment, when the predicted slack is increased, the counter value of the reliability counter is reset to “0”, so the maximum value Cmax of the counter value is the same value as the threshold value Cth.
(ローカル・スラック予測機構の評価)
続いて、以上説明した本実施形態のローカル・スラック予測機構の評価結果について説明する。発明者等は、スーパスカラ・プロセッサ用のシミュレータ(Simple Scalar Tool Set)を用いて、上記スラック表20のエントリの更新に係る各パラメータを変化させながら、表1に示される測定条件で予測機構の評価を行っている。この評価には、「MIPS R100000」の拡張命令セットである「Simple Scalar/PISA」が使用されている。またこの評価には、ベンチマーク・プログラムとして、「SPECint2000 」の「bzip2 」、「gcc 」、「gzip」、「mcf 」、「paser 」、「perl」、「votex 」、及び「vpr 」の8つのプログラムが使用されている。
(Evaluation of local slack prediction mechanism)
Subsequently, the evaluation result of the local slack prediction mechanism of the present embodiment described above will be described. The inventors evaluated the prediction mechanism under the measurement conditions shown in Table 1 while changing each parameter related to the update of the entry in the slack table 20 using a simulator for the superscalar processor (Simple Scalar Tool Set). It is carried out. For this evaluation, “Simple Scalar / PISA” which is an extended instruction set of “MIPS R100000” is used. In this evaluation, eight benchmark programs, “bzip2”, “gcc”, “gzip”, “mcf”, “paser”, “perl”, “votex”, and “vpr”, are used as benchmark programs. The program is being used.
なお、スラック表20の各エントリの更新に関するパラメータのうち、変更可能なものは、予測スラックの最大値Vmax、予測スラックの1回あたりの増加量Vinc、減少量Vdec、信頼性カウンタの閾値Cth、及び信頼性カウンタのカウンタ値の1回あたりの増加量Cinc、減少量Cdecの6つである。ただし、これらのすべてを可変値とすると、組合せは膨大な数になるため、幾つかのパラメータをある値に固定して評価を行っている。まず増加量Cincと閾値Cthとの両パラメータの値が変わっても、それらの比が変わらなければ予測スラックの増加の頻度は同じであるため、増加量Cincは「1」に固定し、閾値Cthのみを可変とした。また予測スラックをできる限りターゲット・スラックに近づけるため、予測スラックの1回当たりの増加量Vincは「1」に固定した。さらに予測スラックを可能な限り迅速に減少させるため、予測スラックの1回当たりの減少量Vdecを同予測スラックの最大値Vmaxと同値に固定した。したがって、この評価での可変パラメータは、予測スラックの最大値Vmaxと信頼性カウンタの閾値Cthの2つとなっている。 Of the parameters related to the update of each entry in the slack table 20, those that can be changed are the predicted slack maximum value Vmax, the predicted slack increase amount Vinc, the decrease amount Vdec, the reliability counter threshold Cth, And an increase amount Cinc and a decrease amount Cdec per time of the counter value of the reliability counter. However, if all of these are variable values, the number of combinations becomes enormous. Therefore, evaluation is performed with some parameters fixed to certain values. First, even if the values of both the increase amount Cinc and the threshold value Cth change, the increase rate of the predicted slack is the same unless the ratio thereof changes, so the increase amount Cinc is fixed to “1” and the threshold value Cth. Only variable. Further, in order to make the predicted slack as close as possible to the target slack, the increment Vinc per predicted slack was fixed to “1”. Further, in order to reduce the predicted slack as quickly as possible, the amount of decrease Vdec per predicted slack is fixed to the same value as the maximum value Vmax of the predicted slack. Therefore, there are two variable parameters in this evaluation: the maximum value Vmax of predicted slack and the threshold value Cth of the reliability counter.
こうした評価においては、スラック命令の数、予測スラックの総積算値、IPC(Instruction Per Clock :1サイクル当たりの命令実行数)が評価値として測定されている。ここでのスラック命令とは、予測スラックに基づいて実行レイテンシが1サイクル以上増加された命令である。なおIPCは、プロセッサの処理性能を測る指標値となる。 In such evaluation, the number of slack instructions, the total estimated value of predicted slack, and IPC (Instruction Per Clock: the number of instructions executed per cycle) are measured as evaluation values. The slack instruction here is an instruction whose execution latency is increased by one cycle or more based on predicted slack. Note that the IPC is an index value for measuring the processing performance of the processor.
図5は、評価におけるスラック命令数とIPCの測定結果を示している。同図の縦軸は、最大値Vmax及び閾値Cthの値の各組合せにおける、全実行命令数に対するスラック命令数の比率と、スラック予測を一切行わなかったときのIPCに対する測定IPCの比率とを示している。また最大値Vmaxの各値(「1」,「5」,「10」,「15」)のそれぞれにおける4本組の縦棒は、図中左側からそれぞれ閾値Cthが「1」,「5」,「10」,「15」の場合での測定結果をそれぞれ表すものとなっている。 FIG. 5 shows the number of slack instructions and IPC measurement results in the evaluation. The vertical axis in the figure shows the ratio of the number of slack instructions to the total number of executed instructions and the ratio of the measured IPC to the IPC when no slack prediction is performed in each combination of the maximum value Vmax and the threshold value Cth. ing. In addition, the four vertical bars in each of the maximum value Vmax (“1”, “5”, “10”, “15”) have thresholds Cth of “1”, “5” from the left side in the figure, respectively. , “10” and “15”, the measurement results are respectively shown.
同図に示されるように、閾値Cthを増加させるとスラック命令数は減少する。これは閾値Cthの増加により、予測スラックの増加条件が厳しくなり、予測スラックの増加頻度が低くなるためである。ただし、閾値Cthを増加すれば、予測スラックがターゲット・スラックを上回る頻度が低くなるため、IPCは向上するようになる。この結果から、上記信頼性の導入によって、上記スラック予測ミスのペナルティによる命令処理性能の低下を抑えられることが確認された。一方、予測スラックの最大値Vmaxを増加させると、予測スラックがより大きい値を取ることが可能となるため、スラック予測ミスのペナルティが大きくなり、処理性能(IPC)は低下するようになる。 As shown in the figure, when the threshold value Cth is increased, the number of slack instructions decreases. This is because the increase condition of the predicted slack becomes severe due to the increase of the threshold value Cth, and the increase frequency of the predicted slack becomes low. However, if the threshold value Cth is increased, the frequency at which the predicted slack exceeds the target slack is reduced, so that the IPC is improved. From this result, it was confirmed that the introduction of the reliability can suppress a decrease in instruction processing performance due to the slack prediction miss penalty. On the other hand, if the maximum value Vmax of predicted slack is increased, the predicted slack can take a larger value, so that the penalty for slack prediction mistakes increases and the processing performance (IPC) decreases.
図6に、上記測定結果での予測スラックとIPCとの関係を示す。なお同図の縦軸は、パラメータ(Vmax,Cth)=(1,1)の場合を基準(100%)とした予測スラックの総積算値のベンチマーク平均値の比率を、横軸は、スラック予測を一切行わなかったときを基準(100%)としたIPCのベンチマーク平均値の比率をそれぞれ示している。なお、同図の各点に付された数字は、閾値Cthの値を示している。 FIG. 6 shows the relationship between predicted slack and IPC in the above measurement results. The vertical axis in the figure represents the ratio of the benchmark average value of the total integrated value of predicted slack with the parameter (Vmax, Cth) = (1, 1) as the reference (100%), and the horizontal axis represents slack prediction. The ratios of the benchmark average values of IPC are shown with reference to the time when 100% was not performed at all (100%). In addition, the number attached | subjected to each point of the figure has shown the value of threshold value Cth.
同図に示されるように、予測スラックの最大値Vmaxを増加させると、処理性能は低下するが、予測スラックは大幅に増大する。また最大値Vmaxとともに閾値Cthを増加させることで、IPCがほとんど低下せずに、予測スラックが増加するパラメータの組合せも幾つか確認された。例えばパラメータ(Vmax,Cth)=(1,1)の場合に対して、(5,15)の場合には、IPCの低下をわずか0.3%に留めながらも、予測スラックは約2.2倍となっている。 As shown in the figure, when the maximum value Vmax of predicted slack is increased, the processing performance is reduced, but the predicted slack is greatly increased. In addition, by increasing the threshold value Cth together with the maximum value Vmax, some combinations of parameters that increase predicted slack without substantially decreasing IPC were confirmed. For example, when the parameter (Vmax, Cth) = (1, 1), in the case of (5, 15), the predicted slack is about 2.2 while the IPC decrease is only 0.3%. It has doubled.
以上の結果から明らかなように、処理性能は、スラック命令数や予測スラックとトレード・オフの関係にあり、適用対象での要求に応じて、各パラメータの最適値は異なることとなる。 As is clear from the above results, the processing performance is in a trade-off relationship with the number of slack instructions and predicted slack, and the optimum value of each parameter varies depending on the request of the application target.
(機能ユニットの消費電力の削減)
次に、以上説明した本実施形態のローカル・スラック予測機構の応用例として、その予測結果の利用によりプロセッサの機能ユニット(実行ユニット)の消費電力を削減する手法について説明する。
(Reduction of power consumption of functional units)
Next, as an application example of the local slack prediction mechanism of the present embodiment described above, a method for reducing the power consumption of the functional unit (execution unit) of the processor by using the prediction result will be described.
図7は、ローカル・スラックの予測結果を利用して機能ユニットの消費電力を削減可能に構成したプロセッサの一例を示している。同図に例示したプロセッサでは、消費電力は高いものの高速動作する実行ユニット15aと、動作は遅いものの消費電力は低い実行ユニット15bとの2種類の実行ユニットを備えている。そして、予測スラックの小さい命令は高速の実行ユニット15aに、予測スラックの大きい命令は低速の実行ユニット15bにと、命令を実行させるユニットを振り分けることで、処理性能を低下させずに機能ユニットの消費電力を削減することができる。
FIG. 7 shows an example of a processor configured to be able to reduce the power consumption of the functional unit using the prediction result of local slack. The processor illustrated in FIG. 2 includes two types of execution units: an execution unit 15a that operates at high speed with high power consumption, and an
発明者等は、こうした応用例の評価を行っている。この評価には、整数演算用の機能ユニット(iALU)として、高速・高電力消費のユニットと低速・低電力消費のユニットとの2種類をユニットを備えるプロセッサのモデルが用いられている。両ユニットの電源電圧はそれぞれ「1.1V」、「0.7V」となっており、実行レイテンシはそれぞれ「1サイクル」、「2サイクル」となっている。そして予測スラックが「1」の命令を低速なiALUに、予測スラックが「0」の命令を高速なiALUにそれぞれ振り分けるようにした。ただし、命令の実行時に、低速なiALUに空きが無ければ高速なiALUに、高速なiALUに空きが無ければ高速なiALUに、予測スラックに拘わらず、命令を割り当てることとした。 The inventors have evaluated such application examples. In this evaluation, as a function unit (iALU) for integer arithmetic, a processor model including two types of units, a high speed / high power consumption unit and a low speed / low power consumption unit, is used. The power supply voltages of both units are “1.1 V” and “0.7 V”, respectively, and the execution latencies are “1 cycle” and “2 cycles”, respectively. An instruction with predicted slack “1” is assigned to a low-speed iALU, and an instruction with predicted slack “0” is assigned to a high-speed iALU. However, at the time of execution of an instruction, an instruction is assigned to a high-speed iALU if there is no free space in the low-speed iALU, and to a high-speed iALU if there is no free space in the high-speed iALU, regardless of predicted slack.
またこの評価では、パラメータ(Vmax,Cth)=(1,15)として、スラック表のエントリの変更に係るすべてのパラメータを固定した条件で、全6個のiALUのうち、高速なiALUの数と低速なiALUの数との比率を変更しながら、IPC及び
iALU全体のエネルギ遅延積(EDP:Energy Delay Product)を測定した。EDPは、機能ユニットの電力消費量を測る指標値となっている。なお、以下では、高速なiALUをn個有する、すなわち低速なiALUをm(=6−n)個有するモデルを、(nf,ms)モデルと記載する。
Also, in this evaluation, the parameter (Vmax, Cth) = (1, 15), and all the parameters related to the change of the slack table entry are fixed. While changing the ratio with the number of low-speed iALU, the energy delay product (EDP) of the entire IPC and iALU was measured. The EDP is an index value for measuring the power consumption of the functional unit. Hereinafter, a model having n high-speed iALUs, that is, having m (= 6-n) low-speed iALUs will be referred to as an (nf, ms) model.
図8及び図9に、各モデルでの各ベンチマークでのIPC及びEDPの測定結果を示す。図8の縦軸は、(6f,0s)モデル(全iALUが高速なモデル)でのIPCを基準(100%)としたIPCの比率を、図9の縦軸は、同じく(6f,0s)モデル(全iALUが高速なモデル)でのEDPを基準(100%)としたEDPの比率をそれぞれ示している。また両図における各ベンチマーク・プログラムにおける6本組の縦棒は、図中左側から(5f,1s)、(4f,2s)、(3f,3s)、(2f,4s)、(1f,5s)、(0f,6s)の各モデルでの測定結果をそれぞれ表すものとなっている。 8 and 9 show the measurement results of IPC and EDP in each benchmark in each model. The vertical axis in FIG. 8 represents the ratio of IPCs based on the IPC in the (6f, 0s) model (a model in which all iALUs are high-speed) (100%), and the vertical axis in FIG. 9 is the same as (6f, 0s). The ratio of EDP based on EDP as a reference (100%) in a model (a model in which all iALUs are high speed) is shown. The six vertical bars in each benchmark program in both figures are (5f, 1s), (4f, 2s), (3f, 3s), (2f, 4s), (1f, 5s) from the left side in the figures. , (0f, 6s) represents the measurement results in each model.
両図に示されるように、いずれのベンチマーク・プログラムでも、同様の傾向が見られる。すなわち、高速なiALUの数の減少させると、ほとんどの場合、EDPは単調に減少していくようになる。ただし、ローカル・スラックの予測結果に基づいて命令の振り分けを行ったことで、高速なiALUの数の減少に伴うIPCの低下は好適に抑制されている。例えば(0f,6s)モデル、すなわち全iALUが低速なモデルでは、ベンチマーク平均のIPCの低下が「20.2%」、EDPの削減率は「41.6%」となっている。これに対して(1f,6s)モデルでは、EDPの削減率が「34.5%」もあるにも拘わらず、IPCの低下は「10.5%」に留まっている。更に(3f、3s)モデルでは、IPCの低下をわずか「3.8%」としながらも、EDPの削減率は「20.3%」にもなる。 As shown in both figures, the same trend is seen in all benchmark programs. That is, when the number of high-speed iALUs is decreased, in most cases, EDP decreases monotonously. However, since the instructions are distributed based on the prediction result of local slack, the decrease in IPC accompanying the decrease in the number of high-speed iALUs is suitably suppressed. For example, in the (0f, 6s) model, that is, a model in which all iALUs are low speed, the benchmark average IPC decrease is “20.2%”, and the EDP reduction rate is “41.6%”. On the other hand, in the (1f, 6s) model, although the EDP reduction rate is “34.5%”, the decrease in IPC is only “10.5%”. Furthermore, in the (3f, 3s) model, the reduction rate of IPC is only “3.8%”, but the reduction rate of EDP is also “20.3%”.
なお上記評価では、機能ユニットの消費電力のみに着目しており、スラック表の動作に要する消費電力については全く考慮していないため、プロセッサ全体の消費電力の削減効果は上記の結果よりは低くなる。ただし、スラック表の動作に要する消費電力を十分に低く抑えることさえできれば、プロセッサ全体の消費電力の削減にも十分な効果を期待することができる。もっとも、機能ユニットはチップ上における代表的なホットスポットの一つであり、たとえプロセッサ全体の消費電力の削減が適わずとも、機能ユニットの消費電力が抑えられれば、チップ上のホットスポットの分散させることができるという効果は得ることができる。 Note that the above evaluation focuses only on the power consumption of the functional unit, and does not consider the power consumption required for the operation of the slack table at all, so the effect of reducing the power consumption of the entire processor is lower than the above result. . However, as long as the power consumption required for the operation of the slack table can be kept sufficiently low, a sufficient effect can be expected to reduce the power consumption of the entire processor. However, the functional unit is one of the typical hot spots on the chip. Even if the power consumption of the entire processor is not suitable, if the power consumption of the functional unit is suppressed, the hot spots on the chip are dispersed. The effect that it can be obtained.
なお、本実施形態のローカル・スラック予測機構では、フェッチ・ユニット11は、上記実行レイテンシ設定手段としての機能も兼ねている。またスラック表20(厳密にはそのエントリの更新に係る動作回路)が、上記推定手段及び予測スラック更新手段としての機能も兼ね備えるようにしている。
In the local slack prediction mechanism of this embodiment, the fetch
以上説明した本実施形態のローカル・スラックの予測方法、及びローカル・スラック予測機構によれば、次の効果を奏することができる。
(1)予測スラックを計算で直接的に求めるのではなく、命令の実行時の振る舞いを観測しながら、ターゲット・スラックに到達するまで予測スラックを徐々に増加させることで求めているため、予測スラックの直接演算に要する複雑な機構は不要であり、より簡易な構成でローカル・スラックの予測を行うことができる。
According to the local slack prediction method and local slack prediction mechanism of the present embodiment described above, the following effects can be obtained.
(1) Predicted slack is not calculated directly by calculation, but is calculated by gradually increasing the predicted slack until the target slack is reached while observing the behavior during execution of the instruction. The complicated mechanism required for the direct calculation is not required, and local slack can be predicted with a simpler configuration.
(2)プロセッサが元より備える検出機構で検出可能な上記条件(A)〜(D)の命令実行時の振る舞いをローカル・スラック到達条件としたため、ローカル・スラック予測のために格別な検出機構を追加設置せずとも、予測スラックのターゲット・スラックへの到達を確認することができる。 (2) Since the behavior at the time of instruction execution of the above conditions (A) to (D) that can be detected by the detection mechanism provided by the processor is the local slack arrival condition, a special detection mechanism is provided for local slack prediction. Even without additional installation, the arrival of the predicted slack to the target slack can be confirmed.
(3)ターゲット・スラック到達条件の成立をもって、予測スラックを減少させるようにしているため、予測スラックの過剰評価による後続命令の実行遅延の発生を好適に抑制することができる。 (3) Since the predicted slack is reduced when the target slack arrival condition is satisfied, it is possible to suitably suppress the execution delay of the subsequent instruction due to the excessive evaluation of the predicted slack.
(4)信頼性カウンタを設置し、予測スラックの増加は慎重に、減少は迅速に行うようにしているため、ターゲット・スラックが頻繁に増減を繰り返す場合にも、予測スラックの過剰評価による後続命令の実行遅延が発生する頻度を低く抑えることができる。 (4) Since a reliability counter is installed and the predicted slack is carefully increased and decreased rapidly, the subsequent instruction due to overestimation of the predicted slack even when the target slack repeatedly increases and decreases The frequency of occurrence of execution delay can be kept low.
続いて、上記ローカル・スラックの予測方法、及び予測機構の更なる機能の拡張について説明する。
(スラック表のインデクス手法の拡張)
プログラム内の分岐命令の振る舞いは多くの場合、その分岐を実行するまでに、どのような関数や命令を実行してきたか(これ以降、制御フローと呼ぶ)に依存する。この性質を利用して、分岐命令の結果をより高い精度で予測する手法が提案されている。従来、こうした分岐予測手法は、命令の投機実行の精度向上に利用されているが、ローカル・スラックの予測においても、同様の原理を導入することで、予測精度の更なる向上を期待できる。以下、制御フローを考慮して、スラック予測を更に精度良く行う手法について説明する。
Next, the local slack prediction method and the expansion of further functions of the prediction mechanism will be described.
(Extension of index method for slack table)
In many cases, the behavior of a branch instruction in a program depends on what function or instruction has been executed (hereinafter referred to as a control flow) until the branch is executed. A technique for predicting the result of a branch instruction with higher accuracy using this property has been proposed. Conventionally, such a branch prediction method has been used to improve the accuracy of speculative execution of instructions. However, in the prediction of local slack, further improvement of the prediction accuracy can be expected by introducing the same principle. Hereinafter, a method for performing slack prediction with higher accuracy in consideration of the control flow will be described.
プログラムは、分岐命令を用いて、どのような関数や命令を実行するのかを決定しているため、プログラム中の分岐条件に着目することで制御フローを単純化することが可能である。具体的には、分岐条件が成立したなら「1」、成立しなかったら「0」として、プログラム中の分岐条件の成立、不成立の履歴(分岐履歴)を記録する。例えば分岐条件がフェッチ順に、成立(1)→成立(1)→不成立(0)→成立(1)であったときの分岐履歴は、新しいもの程下位に記録した場合に「1101」と表される。分岐履歴をスラック予測に利用するために、分岐履歴とその命令のPCとからスラック表へのインデクスを生成する。このようにすれば、PCと制御フローの双方を考慮して、スラックを予測することができるようになる。例えば、PCが同じでも、制御フローが異なれば、スラック表の別々のエントリを使用するので、制御フローに応じた予測ができるようになる。 Since the program uses a branch instruction to determine what function or instruction is executed, the control flow can be simplified by paying attention to the branch condition in the program. Specifically, “1” is recorded if the branch condition is satisfied, and “0” is stored if the branch condition is not satisfied. For example, the branch history when the branch condition is established (1) → established (1) → not established (0) → established (1) in the fetch order is expressed as “1101” when the newer one is recorded in the lower order. The In order to use the branch history for slack prediction, an index to the slack table is generated from the branch history and the PC of the instruction. In this way, slack can be predicted in consideration of both the PC and the control flow. For example, even if the PC is the same, if the control flow is different, different entries in the slack table are used, so that prediction according to the control flow can be performed.
図10に、制御フローを考慮したスラック予測を行うローカル・スラック予測機構のハードウェア構成の一例を示す。この構成では、図4に例示のものに加え、更に分岐履歴レジスタ21A、分岐履歴レジスタ21B、及び2つのインデクス生成回路22A,22Bが新たに追加されている。分岐履歴レジスタ21A及び分岐履歴レジスタ21Bは、分岐履歴を記録するレジスタとなっている。
FIG. 10 shows an example of a hardware configuration of a local slack prediction mechanism that performs slack prediction in consideration of the control flow. In this configuration, in addition to the example shown in FIG. 4, a branch history register 21A, a
また両インデクス生成回路22A,22Bは、入力の違いを除いて同一の回路構成とされている。命令のフェッチ時には、分岐履歴レジスタ21Aとその命令のPCとを入力として、インデクス生成回路22Aがスラック表20へのインデクスを生成し、スラック表20の参照を行う。一方、命令のコミット時には、分岐履歴レジスタ21Bとその命令のPCとを入力として、インデクス生成回路22Bがスラック表20へのインデクスを生成し、スラック表20のエントリの更新を行う。以下、これら分岐履歴レジスタ21A,21B及びインデクス生成回路22A,22Bについて更に詳細に説明する。
The
まず分岐履歴レジスタ21A,21Bの分岐履歴の更新動作について説明する。
分岐履歴レジスタ21Aは、プロセッサの分岐予測結果に基づき分岐履歴を記録する。具体的な更新動作は、分岐命令がフェッチされると分岐履歴レジスタ22Aの保持する値を1ビット左にシフトするとともに、フェッチ・ユニット11においてその分岐命令の分岐条件が成立と予測されていれば「1」を、不成立と予測されていれば「0」を、分岐履歴レジスタ21Aの最下位ビットに書き込む、という手順で行われる。
First, the update operation of the branch history of the branch history registers 21A and 21B will be described.
The branch history register 21A records a branch history based on the branch prediction result of the processor. Specifically, when a branch instruction is fetched, the value held in the branch history register 22A is shifted to the left by one bit, and if the branch condition of the branch instruction is predicted to be satisfied in the fetch
一方、分岐履歴レジスタ21Bは、プロセッサの分岐実行結果をもとにして、分岐履歴を記録する。具体的な更新動作は、分岐命令がコミットされると、分岐履歴レジスタ21Bの保持する値を1ビット左にシフトし、その分岐命令の分岐条件が成立したならば「1」を、不成立ならば「0」を、分岐履歴レジスタ21Bの最下位ビットに書き込む、という手順で行われる。
On the other hand, the
このように、分岐履歴の取り方が2通り存在する理由は、スラックの参照をフェッチ時に行い、スラック表の更新をコミット時に行うという、両分岐履歴レジスタ21A,21Bの分岐履歴を利用する時期の違いにある。フェッチ時には、分岐命令は未だ実行されておらず、プロセッサは、分岐条件が成立するかしないかを予測して、命令をメモリから読みだしている。そのため、フェッチ時に使用される分岐履歴レジスタ21Aには、分岐予測に基づいて分岐履歴を記録していくしかない。一方、コミット時には、分岐命令は既に実行されており、実行結果に基づいて分岐の履歴を記録することができる。 As described above, there are two ways of taking the branch history. The reason for using the branch history of both branch history registers 21A and 21B is that the slack reference is performed at the fetch time and the slack table is updated at the commit time. There is a difference. At the time of fetching, the branch instruction has not yet been executed, and the processor predicts whether or not the branch condition is satisfied and reads the instruction from the memory. Therefore, the branch history register 21A used at the time of fetching can only record the branch history based on the branch prediction. On the other hand, at the time of commit, the branch instruction has already been executed, and the branch history can be recorded based on the execution result.
次に、図11を参照して、インデクス生成回路22A,22Bによるインデクス生成態様の詳細を説明する。図11(a)は、上記実施形態でのインデクス生成、すなわち命令のPCのみを使用したインデクス生成手法を示している。この場合、PCの一部のビットを切り出して、それをスラック表20へのインデクスとして使用するようにしている。
Next, the details of the index generation mode by the
図11(b)は、分岐履歴とPCとを使用したインデクス生成の一例を、図11(c)は、同じく分岐履歴とPCとを使用したインデクス生成のもう一つの例を、それぞれ示している。なお実際のプロセッサへの搭載に際しては、双方のインデクス生成回路22A,22Bで共通のインデクス生成手法を採用する必要がある。その理由は、双方のインデクス生成回路22A,22Bで別々のインデクス生成手法を採用すると、スラック表20の更新時と参照時で別々のインデクスが生成されてしまい、スラックを正しく予測できないためである。
FIG. 11B shows an example of index generation using the branch history and the PC, and FIG. 11C shows another example of index generation using the branch history and the PC. . When mounting on an actual processor, it is necessary to adopt a common index generation method for both
図11(b)の場合には、分岐履歴のi個のビットとPCから切り出したj個のビットとを連結して、インデクスを生成するようにしている。一方、図11(c)の場合には、分岐履歴のi個のビットとPCから切り出した同数(i個)のビットとの排他論理和(exclusive or)をビット毎に取るとともに、そのビット列とPCから更に切り出したj個のビットとを連結して、インデクスを生成するようにしている。 In the case of FIG. 11B, an index is generated by concatenating i bits of the branch history and j bits cut out from the PC. On the other hand, in the case of FIG. 11C, an exclusive OR of i bits of the branch history and the same number (i) of bits extracted from the PC is taken for each bit, and the bit string An index is generated by concatenating j bits further cut out from the PC.
なお図11(c)のように、分岐履歴が単調な場合(全て成立、あるいは、全て不成立)でも、PCから切り出したビットとの排他的論理和を取ることで、インデクスの上位ビットが単調とはならないようにすることができ、スラック表20のエントリを有効に活用できるようになる。 As shown in FIG. 11C, even when the branch history is monotonous (all established or all not established), the upper bits of the index are monotonic by taking the exclusive OR with the bits cut out from the PC. The entries in the slack table 20 can be used effectively.
例えば図11(b)及び(c)に示されるように、分岐履歴を4ビットとし、PCから切り出す下位ビットを2ビットとする場合で、PCから切り出す下位2ビットだけが同じとなる2つの命令(命令1、命令2)のスラックを更新する場合を考えてみる。なお、以下の説明では、命令1及び命令2のPCのうち、インデクスの生成に関係ないビットを省略して表し、また省略しないビットのうちの上位4ビットと下位2ビットとをスペースで区切って表示する。ここで命令1のPCが「・・・0011 01・・・」であり、命令2のPCが「・・・1100 01・・・」であったとする。命令1と命令2の分岐履歴がいずれも全て成立(1111)となった場合、図11(b)の手法では、スラック表20へのインデクスが、両命令で同じ値(1111 01)となってしまう。一方、図11(c)の手法では、スラック表20へのインデクスは、命令1では「1100 01」と、命令2では「0011 01」と、この場合にも異なった値となる。
For example, as shown in FIGS. 11B and 11C, when the branch history is 4 bits and the lower bits cut out from the PC are 2 bits, only the lower 2 bits cut out from the PC are the same. Consider the case where the slack of (
このように図11(c)の手法の方が、エントリを有効活用する上で有利ではあるが、余分な計算が必要されるため、スラック表への要求、すなわちスラック予測のより高い精度を所望するか、機構の簡易さを所望するかによって採用する手法を選択する。いずれにせよ、制御フローを考慮した分岐パターン別の予測スラックを個別記録を行えば、スラック予測の精度を更に向上可能となる。 As described above, the method shown in FIG. 11C is advantageous in making effective use of the entry. However, since extra calculation is required, a request for the slack table, that is, higher accuracy of slack prediction is desired. The method to be adopted is selected depending on whether the simplicity of the mechanism is desired. In any case, the accuracy of slack prediction can be further improved by separately recording predicted slack for each branch pattern in consideration of the control flow.
(ターゲット・スラック到達条件の拡張)
ターゲット・スラック到達条件として使用可能な命令実行時の振る舞いとしては、上述した(A)〜(D)以外にも、例えば以下に列記する(E)〜(I)が考えられる。これらの一部又は全部を、ターゲット・スラック到達条件に追加することで、スラックの予測をより正確に行える可能性がある。
(E)当該命令が、命令ウィンドウ13(図4、図10参照)において最も古い命令となる(当該命令が命令ウィンドウ13内に最も長い間、留まっている)こと。
(F)リオーダ・バッファ16(図4、図10参照)において最も古い命令となる(当該命令がROB内に最も長い間、留まっている)こと。
(G)当該命令が、前記命令ウィンドウに存在する命令の中で最も古い命令に実行結果を渡す命令となっていること。
(H)当該命令が、同一のサイクルに実行される命令の中で最も多くの後続命令に実行結果を渡す命令となっていること。例えば同一のサイクルに2つの命令が実行され、そのうちの一方が2つの後続命令に実行結果を渡し、残りが5つの後続命令に実行結果を渡したのであれば、後者の命令がターゲット・スラック到達条件を満たしていると判定される。
(I)当該命令の実行結果を渡すことで、実行可能な状態となる後続命令の数が、予め定められた判定値以上となっていること。ここでの実行可能な状態とは、入力データが揃い、いつでも実行を開始できる状態をいう。
(Expansion of target slack arrival conditions)
In addition to the above-described (A) to (D), for example, (E) to (I) listed below can be considered as behaviors at the time of instruction execution that can be used as the target slack arrival conditions. By adding some or all of these to the target slack arrival condition, there is a possibility that slack can be predicted more accurately.
(E) The instruction becomes the oldest instruction in the instruction window 13 (see FIGS. 4 and 10) (the instruction remains in the
(F) The oldest instruction in the reorder buffer 16 (see FIGS. 4 and 10) (the instruction remains in the ROB for the longest time).
(G) The instruction is an instruction that passes the execution result to the oldest instruction among the instructions existing in the instruction window.
(H) The instruction is an instruction that passes the execution result to the largest number of subsequent instructions among the instructions executed in the same cycle. For example, if two instructions are executed in the same cycle and one of them passes the execution result to two subsequent instructions and the other passes the execution result to five subsequent instructions, the latter instruction reaches the target slack. It is determined that the condition is satisfied.
(I) The number of subsequent instructions that can be executed by passing the execution result of the instruction is equal to or greater than a predetermined determination value. The executable state here means a state where input data is ready and execution can be started at any time.
これら(E)〜(I)について次の命令i1〜i6、すなわち、
・命令i1: A = 5 + 3 ;
・命令i2: B = 8 − 3 ;
・命令i3: C = 3 + A ;
・命令i4: D = A + C ;
・命令i5: E = 9 + B ;
・命令i6: F = 7 − B ;
を実行する場合を例に説明する。
For these (E) to (I), the following instructions i1 to i6, that is,
Instruction i1: A = 5 + 3;
Instruction i2: B = 8−3;
Instruction i3: C = 3 + A;
Instruction i4: D = A + C;
Instruction i5: E = 9 + B;
Instruction i6: F = 7−B;
An example of executing is described.
まず最初のサイクルで命令i1と命令i2とが同時に実行されたとすると、命令i1は命令i3と命令i4に実行結果を渡し、命令i2は命令i5と命令i6に実行結果を渡す。そのため、実行結果を渡す後続命令数はどちらも2つとなるが、命令i4は未だ入力データが揃っていないので、命令i1の実行結果によって実行可能な状態になった命令数は1つ、命令i2の実行結果によって実行可能な状態になった命令数は2つである。なお、上記条件(I)での判定値が「1」であれば、同条件(I)を満たすのは命令i1と命令i2、判定値が「2」であれば、命令i2のみとなる。 Assuming that the instruction i1 and the instruction i2 are simultaneously executed in the first cycle, the instruction i1 passes the execution result to the instruction i3 and the instruction i4, and the instruction i2 passes the execution result to the instruction i5 and the instruction i6. Therefore, the number of subsequent instructions that pass the execution result is two, but since the input data of the instruction i4 has not been prepared yet, the number of instructions that can be executed by the execution result of the instruction i1 is one, the instruction i2 The number of instructions that can be executed by the execution result of is two. If the determination value under the condition (I) is “1”, only the instruction i1 and the instruction i2 satisfy the condition (I). If the determination value is “2”, only the instruction i2 is satisfied.
これらの条件(E)〜(I)は、従来、クリティカル・パスを検出するための条件としての使用が提案されたものであるが、ローカル・スラック到達条件としても、十分に利用可能なものである。 These conditions (E) to (I) have been proposed to be used as conditions for detecting a critical path in the past, but can be sufficiently used as local slack arrival conditions. is there.
(スラック表の更新に関するパラメータの拡張)
上記実施形態では、スラック表の更新に係るパラメータのうち、予測スラック及び信頼性カウンタの1回あたりの減少量Vdec,Cdecをそれぞれ予測スラックの最大値Vmax及び閾値Cthと同値に固定していた。また予測スラック及び信頼性カウンタの1回あたりの増加量Vinc,Cincを共に「1」に固定するようにしていた。しかしながら、性能低下を抑えることが重要な場合や、予測できるスラックの量をできるだけ大きくしたい場合など、状況に応じて上記パラメータの最適値は変わる。そのため、必ずしも上記のようにパラメータを固定する必要はなく、スラック予測の適用される分野に応じて適宜決定することが望ましい。
(Expansion of parameters related to slack table update)
In the above-described embodiment, among the parameters relating to the update of the slack table, the decrease amounts Vdec and Cdec per time of the predicted slack and the reliability counter are fixed to the same values as the maximum value Vmax and the threshold value Cth of the predicted slack, respectively. Further, the increments Vinc and Cinc of the prediction slack and the reliability counter per time are both fixed to “1”. However, the optimum value of the parameter varies depending on the situation, for example, when it is important to suppress performance degradation or when it is desired to increase the amount of slack that can be predicted as much as possible. Therefore, it is not always necessary to fix the parameters as described above, and it is desirable to appropriately determine the parameters according to the field to which slack prediction is applied.
上記実施形態では、上記スラック表の更新に係る各パラメータはそれぞれ、命令の種別に依らず、一律の値とされていた。例えば、ロード命令であっても、分岐命令であっても、信頼性の閾値Cthには同じ値が用いられている。 In the above embodiment, each parameter related to the update of the slack table is a uniform value regardless of the type of instruction. For example, the same value is used for the reliability threshold Cth regardless of whether it is a load instruction or a branch instruction.
しかしながら、実際には、命令の種別によっては、動的な変化度合やその変化の頻度などのローカル・スラックの挙動に違いがある。典型的な例として分岐命令をあげることができる。分岐命令は、他の命令と比べ、ローカル・スラックの変化する量が非常に激しい。分岐予測が成功したときには、後続命令への影響は非常に小さく、ローカル・スラックは大きくなる傾向にあるが、分岐予測が失敗したときには、誤って実行してしまった命令は全て破棄され、非常に大きなペナルティを被るため、ローカル・スラックが「0」となる。これは、分岐予測の成功と失敗が入れ替わると、ローカル・スラックが急激に変化することを意味する。したがって、分岐命令の場合、信頼性カウンタの閾値Cthや1回当たりの減少量Cdecは他の命令よりも大きくすることが望ましい。 However, in practice, depending on the type of instruction, there is a difference in local slack behavior such as the dynamic change degree and the frequency of the change. A typical example is a branch instruction. Branch instructions have a much more variable amount of local slack than other instructions. When branch prediction is successful, the impact on subsequent instructions is very small and local slack tends to be large, but when branch prediction fails, all instructions that were executed incorrectly are discarded, Because it incurs a large penalty, the local slack is “0”. This means that the local slack changes rapidly when the success and failure of branch prediction are switched. Therefore, in the case of a branch instruction, it is desirable that the threshold value Cth of the reliability counter and the amount of decrease Cdec per time be larger than those of other instructions.
また分岐命令以外の種別に属する命令においても、プロセッサ内での動作に特徴があれば、その特徴に適したパラメータの適正値が種別毎にそれぞれ存在すると考えられる。そこで、命令をいくつかのカテゴリにわけ、カテゴリ毎にスラック表の更新に係るパラメータを個別に設定することで、予測精度が更に向上する可能性がある。例えば、プロセッサ内での動作の違いに着目すると、命令を次の4つのカテゴリ、すなわちロード命令のカテゴリ、ストア命令のカテゴリ、分岐命令のカテゴリ、及びその他命令のカテゴリ、に分類することができる。 In addition, even in an instruction belonging to a type other than the branch instruction, if there is a characteristic in the operation in the processor, it is considered that an appropriate value of a parameter suitable for the characteristic exists for each type. Therefore, there is a possibility that the prediction accuracy may be further improved by dividing the instructions into several categories and individually setting parameters related to the slack table update for each category. For example, focusing on the difference in operation within the processor, the instructions can be classified into the following four categories: a load instruction category, a store instruction category, a branch instruction category, and other instruction categories.
こうして分類した命令の各カテゴリについて、それぞれパラメータを個別に設定する。更新時にはまず、その命令がどのカテゴリに属するかを判定する。この判定は、命令のオペコードを見れば容易に行うことができる。そして、その命令が属するカテゴリの固有のパラメータを用いて、スラック表を更新する。なお、命令のカテゴリの分類態様としては、ロード命令とストア命令とを同じカテゴリとしたり、加算と減算を別々のカテゴリに分けるようにしたり、といった態様も考えられる。命令のどの様に分類するかは、スラック予測の適用される範囲によって変わってくる。なお、このように命令の種別毎に個別のパラメータを使用することとすると、ローカル・スラック予測機構の構成が複雑化するため、これを抑えるには、カテゴリの数を必要最小限まで減らす必要がある。 Parameters are individually set for each category of instructions thus classified. When updating, it is first determined to which category the instruction belongs. This determination can be easily made by looking at the operation code of the instruction. Then, the slack table is updated using the parameters specific to the category to which the instruction belongs. In addition, as a classification mode of the instruction category, a mode in which the load instruction and the store instruction are set to the same category, and addition and subtraction are divided into different categories is also conceivable. How instructions are classified depends on the range to which slack prediction is applied. If individual parameters are used for each type of instruction in this way, the configuration of the local slack prediction mechanism becomes complicated. To suppress this, it is necessary to reduce the number of categories to the minimum necessary. is there.
10…プロセッサ、11…フェッチ・ユニット、12…デコード・ユニット、13…命令ウィンドウ、14…レジスタ・ファイル、15,15A,15B…実行ユニット、16…リオーダ・バッファ、20,53…スラック表、21A,21B…分岐履歴レジスタ、22A,22B…インデクス生成回路、51…レジスタ定義表、52…メモリ定義表、54…演算器。
DESCRIPTION OF
Claims (20)
前記命令の実行時の振る舞いに基づいて、現状におけるローカル・スラックの適正値であるターゲット・スラックに前記予測スラックが到達したか否かを推定し、
到達したとの推定がなされるまで前記予測スラックを前記命令の実行毎に徐々に増加させていく
ことを特徴とするローカル・スラックの予測方法。 The instruction executed by the processor is executed by increasing its execution latency by the predicted slack value that is the predicted value of the local slack of the instruction,
Based on the behavior at the time of execution of the instruction, it is estimated whether the predicted slack has reached the target slack that is an appropriate value of the current local slack,
The method for predicting local slack, wherein the predicted slack is gradually increased for each execution of the instruction until it is estimated that the target has been reached.
(A)当該命令の実行時に分岐予測ミスが発生したこと、
(B)当該命令の実行時にキャッシュ・ミスが発生したこと、
(C)後続命令に対するオペランド・フォワーディングが発生したこと、
(D)後続命令に対するストア・データ・フォワーディングが発生したこと、
(E)当該命令が命令ウィンドウに存在する命令の中で最も古い命令となっていること、
(F)当該命令がリオーダ・バッファに存在する命令の中で最も古い命令となっていること、
(G)当該命令が、前記命令ウィンドウに存在する命令の中で最も古い命令に実行結果を渡す命令となっていること、
(H)当該命令が、同一のサイクルに実行される命令の中で最も多くの後続命令に実行結果を渡す命令となっていること、
(I)当該命令の実行結果を渡すことで、実行可能な状態となる後続命令の数が、予め定められた判定値以上となっていること、
のうちのいずれかを含む
ことを特徴とする請求項1に記載のローカル・スラックの予測方法。 As a condition for the estimation that the predicted slack has reached the target slack,
(A) A branch prediction error occurred during execution of the instruction,
(B) A cache miss occurred during execution of the instruction;
(C) Operand forwarding for the subsequent instruction has occurred,
(D) that store data forwarding has occurred for subsequent instructions;
(E) the instruction is the oldest instruction in the instruction window;
(F) the instruction is the oldest instruction in the reorder buffer;
(G) The instruction is an instruction that passes an execution result to the oldest instruction among the instructions existing in the instruction window;
(H) The instruction is an instruction that passes the execution result to the most subsequent instructions among the instructions executed in the same cycle;
(I) The number of subsequent instructions that can be executed by passing the execution result of the instruction is equal to or greater than a predetermined determination value.
The local slack prediction method according to claim 1, further comprising:
ことを特徴とする請求項1又は2に記載のローカル・スラックの予測方法。 3. The local slack prediction method according to claim 1, wherein the prediction slack is decreased when it is estimated that the prediction slack has reached the target slack.
ことを特徴とする請求項3に記載のローカル・スラックの予測方法。 The increase in the predicted slack is performed on the condition that the number of times that the estimated condition that the predicted slack has reached the target slack is not satisfied is a specified number of times, and the decrease in the predicted slack is the above The local slack prediction method according to claim 3, wherein the local slack prediction method is performed under a condition that the number of times the condition is satisfied becomes a specified number.
ことを特徴とする請求項4に記載のローカル・スラックの予測方法。 The number of times that the satisfaction condition is not satisfied to increase the predicted slack is set larger than the number of times that the satisfaction condition is required to decrease the predicted slack. Local slack prediction method.
ことを特徴とする請求項3に記載のローカル・スラックの予測方法。 The increase in the predicted slack is performed on the condition that the number of times that the estimated condition that the predicted slack has reached the target slack is not satisfied is a specified number of times, and the decrease in the predicted slack is the above The local slack prediction method according to claim 3, wherein the local slack prediction method is performed on condition that the condition is satisfied.
請求項4〜6のいずれか1項に記載のローカル・スラックの予測方法。 The local slack prediction method according to claim 4, wherein the specified number of times is made different depending on a type of instruction.
請求項1〜7のいずれか1項に記載のローカル・スラックの予測方法。 The local slack prediction method according to any one of claims 1 to 7, wherein an update amount of the prediction slack per time is varied depending on a type of instruction.
請求項1〜8のいずれか1項に記載のローカル・スラックの予測方法。 The local slack prediction method according to claim 1, wherein an upper limit value of the predicted slack is varied depending on a type of instruction.
請求項7〜9のいずれか1項に記載のローカル・スラックの予測方法。 The local slack prediction method according to any one of claims 7 to 9, wherein the instruction types are classified into four categories: a load instruction, a store instruction, a branch instruction, and other instructions.
請求項1〜10のいずれか1項に記載のローカル・スラックの予測方法。 The local slack prediction method according to any one of claims 1 to 10, wherein the prediction slack is individually set for each branch pattern of a program leading to execution of the instruction.
各命令のローカル・スラックの予測値である予測スラックが記録保持されるスラック表と、
命令の実行に際して前記スラック表を参照してその命令の前記予測スラックを取得するとともに、その取得した予測スラックの分だけ実行レイテンシを増加させる実行レイテンシ設定手段と、
前記命令の実行時の振る舞いに基づき、同命令の現状のローカル・スラックの適正値であるターゲット・スラックに前記予測スラックが到達したか否かを推定する推定手段と、
前記推定手段により前記予測スラックが前記ターゲット・スラックに到達したとの推定がなされるまで、前記予測スラックを前記命令の実行毎に徐々に増加させる予測スラック更新手段と、
を備えることを特徴とするローカル・スラック予測機構。 In a local slack prediction mechanism that predicts local slack of instructions executed by a processor,
A slack table in which predicted slack, which is a predicted value of local slack for each instruction, is recorded and retained;
An execution latency setting means for acquiring the predicted slack of the instruction with reference to the slack table upon execution of the instruction and increasing the execution latency by the acquired predicted slack;
Based on the behavior at the time of execution of the instruction, estimating means for estimating whether the predicted slack has reached the target slack which is an appropriate value of the current local slack of the instruction;
Predicted slack updating means for gradually increasing the predicted slack for each execution of the instruction until the estimation means estimates that the predicted slack has reached the target slack;
A local slack prediction mechanism characterized by comprising:
(A)当該命令の実行時に分岐予測ミスが発生したこと、
(B)当該命令の実行時にキャッシュ・ミスが発生したこと、
(C)後続命令に対するオペランド・フォワーディングが発生したこと、
(D)後続命令に対するストア・データ・フォワーディングが発生したこと、
(E)当該命令が命令ウィンドウに存在する命令の中で最も古い命令となっていること、
(F)当該命令がリオーダ・バッファに存在する命令の中で最も古い命令となっていること、
(G)当該命令が、前記命令ウィンドウに存在する命令の中で最も古い命令に実行結果を渡す命令となっていること、
(H)当該命令が、同一のサイクルに実行される命令の中で最も多くの後続命令に実行結果を渡す命令となっていること、
(I)当該命令の実行結果を渡すことで、実行可能な状態となる後続命令の数が、予め定められた判定値以上となっていること、
のうちのいずれかを前記推定の成立条件として、前記ターゲット・スラックへの前記予測スラックの到達を推定する
ことを特徴とする請求項12に記載のローカル・スラック予測機構。 The estimation means includes
(A) A branch prediction error occurred during execution of the instruction,
(B) A cache miss occurred during execution of the instruction;
(C) Operand forwarding for the subsequent instruction has occurred,
(D) that store data forwarding has occurred for subsequent instructions;
(E) the instruction is the oldest instruction in the instruction window;
(F) the instruction is the oldest instruction in the reorder buffer;
(G) The instruction is an instruction that passes an execution result to the oldest instruction among the instructions existing in the instruction window;
(H) The instruction is an instruction that passes the execution result to the most subsequent instructions among the instructions executed in the same cycle;
(I) The number of subsequent instructions that can be executed by passing the execution result of the instruction is equal to or greater than a predetermined determination value.
The local slack prediction mechanism according to claim 12, wherein arrival of the predicted slack to the target slack is estimated using any one of the above as a condition for establishing the estimation.
前記予測スラック更新手段は、前記信頼性カウンタのカウンタ値が増加判定値となったことを条件に前記予測スラックを増加させ、同信頼性カウンタのカウンタ値が減少判定値となったことを条件に前記予測スラックを減少させる
ことを特徴とする請求項12又は13に記載のローカル・スラック予測機構。 The counter value is increased / decreased when the condition for establishing that the predicted slack has reached the target slack is satisfied, and the counter value is decreased when the condition for establishing the estimation is not satisfied. / Provide an increased reliability counter,
The predicted slack updating means increases the predicted slack on the condition that the counter value of the reliability counter becomes an increase determination value, and on the condition that the counter value of the reliability counter becomes a decrease determination value. The local slack prediction mechanism according to claim 12 or 13, wherein the predicted slack is reduced.
ことを特徴とする請求項14に記載のローカル・スラック予測機構。 The increase / decrease amount of the counter value when the condition for establishment of the estimation is satisfied in the reliability counter is set larger than the decrease / increase amount of the counter value when the condition for establishment of the estimation is not satisfied. 15. The local slack prediction mechanism according to claim 14, wherein:
請求項14又は15に記載のローカル・スラック予測機構。 The local slack prediction mechanism according to claim 14 or 15, wherein an increase amount and a decrease amount of the counter value are made different depending on a type of instruction.
ことを特徴とする請求項12〜16のいずれか1項に記載のローカル・スラック予測機構。 The local slack prediction according to any one of claims 12 to 16, wherein an update amount of each predicted slack of each instruction by the updating means is different depending on a type of the instruction. mechanism.
請求項12〜17のいずれか1項に記載のローカル・スラック予測機構。 18. The local slack according to claim 12, wherein an upper limit value is set in the predicted slack of each instruction updated by the updating unit, and the upper limit value is made different depending on a type of the instruction. Slack prediction mechanism.
請求項16〜18のいずれか1項に記載のローカル・スラック予測機構。 The local slack prediction mechanism according to any one of claims 16 to 18, wherein the instructions are classified into four categories: a load instruction, a store instruction, a branch instruction, and other instructions.
前記スラック表には、前記分岐履歴レジスタを参照して得られる分岐パターンの別に同命令の予測スラックを個別に記録されてなる
請求項12〜19のいずれか1項に記載のローカル・スラック予測機構。 It has a branch history register that records the branch history of the program,
20. The local slack prediction mechanism according to claim 12, wherein prediction slack of the same instruction is separately recorded in the slack table for each branch pattern obtained by referring to the branch history register. .
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2006073551A JP2007249710A (en) | 2006-03-16 | 2006-03-16 | Local slack prediction method, local slack prediction mechanism |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2006073551A JP2007249710A (en) | 2006-03-16 | 2006-03-16 | Local slack prediction method, local slack prediction mechanism |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2007249710A true JP2007249710A (en) | 2007-09-27 |
Family
ID=38593920
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2006073551A Pending JP2007249710A (en) | 2006-03-16 | 2006-03-16 | Local slack prediction method, local slack prediction mechanism |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2007249710A (en) |
-
2006
- 2006-03-16 JP JP2006073551A patent/JP2007249710A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR101376900B1 (en) | Next fetch predictor training with hysteresis | |
| JP5137948B2 (en) | Storage of local and global branch prediction information | |
| JP5649613B2 (en) | Method, apparatus, microprocessor and system for enhancing performance monitoring architecture for critical path based analysis | |
| US20070234014A1 (en) | Processor apparatus for executing instructions with local slack prediction of instructions and processing method therefor | |
| EP3039532B1 (en) | A data processing apparatus and method for controlling performance of speculative vector operations | |
| JP2000347863A (en) | Method and system for counting non-speculative event inside speculative processor | |
| WO1998041923A1 (en) | Penalty-based cache storage and replacement techniques | |
| KR20210035311A (en) | Filtered branch prediction structure of the processor | |
| JP2009540411A (en) | Fast and inexpensive store-load contention scheduling and transfer mechanism | |
| EP3391224B1 (en) | Method and apparatus for data mining from core traces | |
| US10628160B2 (en) | Selective poisoning of data during runahead | |
| CN112384894A (en) | Storing contingent branch predictions to reduce latency of misprediction recovery | |
| US20050216713A1 (en) | Instruction text controlled selectively stated branches for prediction via a branch target buffer | |
| US10613866B2 (en) | Method of detecting repetition of an out-of-order execution schedule, apparatus and computer-readable medium | |
| US7454666B1 (en) | Real-time address trace generation | |
| Mutlu et al. | Understanding the effects of wrong-path memory references on processor performance | |
| US20070288732A1 (en) | Hybrid Branch Prediction Scheme | |
| JP5902208B2 (en) | Data processing device | |
| JP2007249710A (en) | Local slack prediction method, local slack prediction mechanism | |
| CN112470122A (en) | Branch target buffer with early return prediction | |
| JP2023540036A (en) | Alternate path for branch prediction redirection | |
| JP2007293814A (en) | Processor device and processing method therefor | |
| CN120196527B (en) | Processor performance hardware optimization method, system, electronic device and storage medium | |
| Godala | Criticality-Aware Front-end | |
| TWI798339B (en) | Method, module, apparatus, analyser, computer program and storage medium using commit window move element |