JP5573038B2 - Multi-thread processor and program - Google Patents
Multi-thread processor and program Download PDFInfo
- Publication number
- JP5573038B2 JP5573038B2 JP2009172204A JP2009172204A JP5573038B2 JP 5573038 B2 JP5573038 B2 JP 5573038B2 JP 2009172204 A JP2009172204 A JP 2009172204A JP 2009172204 A JP2009172204 A JP 2009172204A JP 5573038 B2 JP5573038 B2 JP 5573038B2
- Authority
- JP
- Japan
- Prior art keywords
- thread
- instruction
- counter
- program
- executed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 230000006870 function Effects 0.000 claims description 10
- 238000000034 method Methods 0.000 description 31
- 238000010586 diagram Methods 0.000 description 14
- 239000000872 buffer Substances 0.000 description 10
- 101150071111 FADD gene Proteins 0.000 description 5
- 238000001514 detection method Methods 0.000 description 5
- 238000004458 analytical method Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 238000004590 computer program Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003139 buffering effect Effects 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 238000007667 floating Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000001356 surgical procedure Methods 0.000 description 1
Images
Landscapes
- Advance Control (AREA)
Description
本発明は、マルチスレッドプロセッサ及びプログラムに関する。 The present invention relates to a multithread processor and a program.
IT技術の進展に伴い、コンピュータが処理するデータ量は増加の一途にある。これら大量ののデータを高速に処理するため、様々なタイプのプロセッサが提案されている。
例えば、VLIW(Very Long Instruction Word)と称されるプロセッサでは、複数の命令語(例えば、演算命令、ロード命令など)を1つの超長命令(VLIW)にパックし、これら複数の命令語を同時に実行する。この場合、プログラムのコンパイル時に、命令間の順序関係やデータ依存関係を解析し、同時に実行することが可能な命令群を抽出する。
これにより、ランタイムオーバーヘッド無しに、複数命令の同時実行による性能向上を実現している。
With the advancement of IT technology, the amount of data processed by computers is constantly increasing. Various types of processors have been proposed to process such a large amount of data at high speed.
For example, in a processor called VLIW (Very Long Instruction Word), a plurality of instruction words (for example, operation instruction, load instruction, etc.) are packed into one very long instruction (VLIW), and the plurality of instruction words are simultaneously transmitted. Run. In this case, when compiling the program, the order relation and data dependency relation between instructions are analyzed, and an instruction group that can be executed simultaneously is extracted.
This realizes performance improvement by simultaneous execution of multiple instructions without runtime overhead.
一方、アウトオブオーダ実行型のプロセッサの場合は、同時に実行することが可能な命令群の解析を、プログラムのランタイムにおいてハードウェアで実行する。また、多数の実行前の命令を格納するバッファを持ち、実行に必要なオペランドが揃った命令から順に実行する。この方式によれば、プログラム順序に制約されることなく、同時に実行することが可能な命令群を抽出して同時に実行することができる。しかし、1つのプログラム(スレッド)において、同時に実行可能な命令数には限りがあり、平均的には、2〜3命令/1サイクルが上限とされており、これ以上に性能を向上することが困難となっていた。 On the other hand, in the case of an out-of-order execution type processor, analysis of instruction groups that can be executed simultaneously is executed by hardware at the runtime of the program. It also has a buffer that stores a number of instructions before execution, and executes them in order from the instruction with the operands necessary for execution. According to this method, an instruction group that can be executed simultaneously can be extracted and executed simultaneously without being restricted by the program order. However, the number of instructions that can be executed simultaneously in a single program (thread) is limited, and on average, the upper limit is 2 to 3 instructions / 1 cycle, which can further improve performance. It was difficult.
このため、近年では、複数のスレッドを同時実行することにより、更なる性能向上を実現するマルチスレッドプロセッサが提案されている。マルチスレッドプロセッサでは、複数のスレッドにより、演算器やメモリの読み書きを行う機構を共有する、一方で、ソフトウェアから可視なレジスタや状態レジスタをスレッド毎に別々に用意することにより、1つのプロセッサ上で、複数スレッドの同時実行を可能としている。
マルチスレッドプロセッサにおけるスレッドの切り替え方式として、複数のスレッドをクロックサイクル単位に切り替える細粒度マルチスレッディング方式(Fine grained multithreading)、複数のスレッドの内から、同時に実行可能な命令を抽出して実行する同時マルチスレッディング方式(Simultaneous multithreading)、及びキャッシュミスのような長いストールが発生した場合にのみ、実行するスレッドを切り替える粗粒度マルチスレッディング(Coarse grained multithreading)方式などが提案されている。
For this reason, in recent years, a multi-thread processor has been proposed that realizes further performance improvement by simultaneously executing a plurality of threads. In a multi-thread processor, a mechanism for reading and writing an arithmetic unit and a memory is shared by a plurality of threads. On the other hand, a register and a status register that are visible from software are separately prepared for each thread. , Multiple threads can be executed simultaneously.
As a thread switching method in a multithread processor, a fine grained multithreading method that switches multiple threads in units of clock cycles, and a simultaneous multithreading method that extracts and executes instructions that can be executed simultaneously from multiple threads (Simultaneous multithreading) and a coarse grained multithreading method that switches a thread to be executed only when a long stall such as a cache miss occurs has been proposed.
この分野の公知例として、例えば、特許文献1には、粗粒度マルチスレッディング方式を採用したマルチスレッドプロセッサの例が開示されている。この特許文献1に開示された技術では、長時間のストールを発生させるキャッシュミスなどの事象の発生をハードウェアで検知し、これをトリガーとして、実行するスレッドの切り替えを行い、異なるスレッドの実行を継続する。これにより、プロセッサが長時間に渡ってストールしてしまうことを防ぎ、単位時間当たりの処理性能を向上させることができる。また、長時間に渡り、ストールなどのスレッドを切り替える事象が発生しない場合には、所定の一定時間が経過した時点で、他のスレッドに切り替える機構も実装している。
As a known example in this field, for example,
ところで、上記背景技術にあっては、他方で、より高性能なプロセッサを実現する必要性から、プロセッサで実行する個々の命令の内容も、より複雑化しており、浮動小数演算などのような複雑な命令が出現している。これらの命令では、演算結果が得られるまでの遅延が長いため、命令のオペランド間に依存がある場合などには、依存が無い命令を遅延サイクル内に配置する工夫が考えられる。しかし、遅延が長い命令の場合には、遅延サイクルを埋めるのに十分な、依存が無い命令を確保することが困難なケースも存在する。
このため、前述の特許文献1に開示された技術と同様に、命令間の依存関係をハードウェアで検知し、この検出をトリガーとして、実行するスレッドの切り替えを行い、異なるスレッドの実行を継続する実装が考えられる(図6参照)。
On the other hand, in the above background art, on the other hand, because of the necessity of realizing a higher-performance processor, the contents of individual instructions executed by the processor are also becoming more complicated, such as complex operations such as floating point arithmetic An order has appeared. Since these instructions have a long delay until an operation result is obtained, it is conceivable to arrange an instruction having no dependency in a delay cycle when there is a dependency between operands of the instruction. However, in the case of an instruction with a long delay, there is a case where it is difficult to secure an instruction having no dependency sufficient to fill the delay cycle.
For this reason, similar to the technique disclosed in
図6は、従来のマルチスレッドプロセッサの1構成例を示す構成図である。
同図に示す従来のマルチスレッドプロセッサは、スレッドの命令流を制御するプログラムカウンタ91(PC0〜PC3 )と、実行するスレッドを選択するスレッド選択部92と、命令メモリから命令を読み出す命令フェッチ部93と、命令を実行する命令実行部94と、命令間のオペランド依存関係を検出する依存検知部95と、から構成される。
図6に示すプロセッサは、近年の他のプロセッサと同様に、動作周波数の向上を実現するため複数のパイプラインステージから構成されている。
FIG. 6 is a block diagram showing one configuration example of a conventional multi-thread processor.
The conventional multi-thread processor shown in FIG. 1 includes a program counter 91 (PC0 to PC3) that controls the instruction flow of a thread, a
The processor shown in FIG. 6 is composed of a plurality of pipeline stages in order to improve the operating frequency like other processors in recent years.
図7は、従来のマルチスレッドプロセッサで実行されるプログラムの1例を示す説明図である。
同図に例示するプログラムは、演算結果が得られるまでの遅延が長い浮動少数点命令(fmul/fadd/fsub)を実行するものであり、fmulのデスティネーション(r[1] と、faddのソースオペランド(r[1])間に依存関係が存在する場合である。
FIG. 7 is an explanatory diagram showing an example of a program executed by a conventional multi-thread processor.
The program illustrated in the figure executes a floating-point instruction (fmul / fadd / fsub) with a long delay until an operation result is obtained. The fmul destination (r [1] and the source of fadd are executed. This is a case where a dependency relationship exists between the operands (r [1]).
図8は、従来のマルチスレッドプロセッサでプログラムを実行した場合のスレッド切り替え方法の1例を示す説明図である。
図6に示すプロセッサで、図7に例示するプログラムを実行すると、実行するスレッドは、図8に示すように切り替わる。
図6に示すプロセッサでは、命令実行部で実行中の命令(図8に示すスレッド1のfmul)のデスティネーション番号と、命令フェッチ部がフェッチ済みの命令(図8に示すスレッド1のfadd)のソースオペランド番号を、依存検知部95(図6)が比較することにより、依存検知部95は、命令間の依存関係を検知する。
FIG. 8 is an explanatory diagram showing an example of a thread switching method when a program is executed by a conventional multi-thread processor.
When the program shown in FIG. 7 is executed by the processor shown in FIG. 6, the thread to be executed is switched as shown in FIG.
In the processor shown in FIG. 6, the destination number of the instruction being executed in the instruction execution unit (fmul of
依存が検知されたタイミング(図8に示す3サイクル目)では、データ依存関係が存在するために実行できない命令(図8に示すスレッド1のfadd)がフェッチ済みである。このため、図8に示す3サイクル目において、実行するスレッドを、スレッド1からスレッド2へと切り替えたとしても、スレッド2のfmovが命令フェッチ部93(図6)からフェッチできるのは、図8の4サイクル目になってからとなる。このため、図6に示すマルチスレッドプロセッサでは、1サイクルの間、有効な命令を実行することができないことになる。
At the timing when the dependency is detected (third cycle shown in FIG. 8), an instruction that cannot be executed because the data dependency exists (fadd of
図9は、図6に示す従来のマルチスレッドプロセッサを改良したマルチスレッドプロセッサの1構成例を示す構成図である。
同図に示すマルチスレッドプロセッサは、図6に示すマルチスレッドプロセッサを拡張したマルチスレッドプロセッサであり、前述のスレッド切り替えに伴って、1サイクルの間、有効な命令を実行することができなくなる状態の発生を防ぐための実装を備える。
図9に示すマルチスレッドプロセッサでは、図6に示すマルチスレッドプロセッサに、スレッド毎の命令バッファ96と、命令選択部97とが追加されており、依存検知部95の接続先としては、スレッド選択部91に加えて、命令選択部97が追加されている。
FIG. 9 is a block diagram showing a configuration example of a multi-thread processor obtained by improving the conventional multi-thread processor shown in FIG.
The multithread processor shown in the figure is a multithread processor that is an extension of the multithread processor shown in FIG. 6, and is in a state in which a valid instruction cannot be executed for one cycle due to the above-described thread switching. Provide an implementation to prevent the occurrence.
In the multithread processor shown in FIG. 9, an
図9に示すマルチスレッドプロセッサでは、命令フェッチ部93から読み出された命令を、一旦命令バッファ96に格納した後、このバッファ96に格納された命令を命令選択部97が選択し、命令実行部94へと供給する構成となっている。このように構成することにより、スレッド切り替えが発生した際には、連続して有効な命令を実行することができる。
しかし、命令バッファ96の、各スレッドに対応する単位バッファの各々は、2サイクル分以上の命令をバッファできるものであることが必要となる。スレッド切り替えの判断を行った時点では、命令バッファ96からは、切り替える前のスレッドの命令が読み出されている。このため、命令バッファ96が1サイクル分の命令のみをバッファする場合では、スレッドを切り替えた直後のサイクルでは、命令バッファ96から、実行可能な命令を読み出すことができないことになる。
In the multi-thread processor shown in FIG. 9, after the instruction read from the
However, each of the unit buffers corresponding to each thread in the
図10は、従来のマルチスレッドプロセッサでプログラムを実行した場合のスレッド切り替え方法の他の1例を示す説明図である。
図9に示す従来のマルチスレッドプロセッサは、演算結果が得られるまでの遅延が長い命令の場合には、データ依存の有無に関わらず、必ずスレッドを切り替えるように制御している。しかし、こうした構成の場合は、図10に示すような、遅延サイクルを利用したプログラミングができない。何故なら、データ依存の有無に関わらず、必ずスレッドを切り替えるように制御すると、遅延が長い命令(図10に示すスレッド1のfmul)の遅延サイクルに、データ依存の無い命令(図10に示すスレッド1のfadd)を配置できる場合であっても、スレッドの切り替えが行われてしまうことになるからである。
また、他に実行可能なスレッドが無い場合などには、有効な命令を継続して実行することができない。
FIG. 10 is an explanatory diagram showing another example of a thread switching method when a program is executed by a conventional multi-thread processor.
The conventional multi-thread processor shown in FIG. 9 controls to always switch threads regardless of the presence or absence of data dependence in the case of an instruction having a long delay until an operation result is obtained. However, in such a configuration, programming using a delay cycle as shown in FIG. 10 cannot be performed. This is because if the control is performed so that the thread is always switched regardless of the presence or absence of data dependence, the instruction having no data dependence (the thread shown in FIG. 10) is included in the delay cycle of the instruction having a long delay (fmul of
In addition, when there is no other thread that can be executed, a valid instruction cannot be continuously executed.
本発明の目的は、上術した課題を解決するマルチスレッドプロセッサ及びプログラムを提供することにある。 An object of the present invention, Ru near to provide a multi-threaded processor and programs that solve the problems described above surgery.
上記課題を解決するために、本発明の第1の形態によると、複数のパイプラインステージを備え、所定の細粒度に複数個のスレッドを切り替えられるマルチスレッドプロセッサであって、スレッド毎の命令流を制御するプログラムカウンタと、プログラムカウンタの1つを選択するスレッド選択手段と、スレッド選択手段が選択したプログラムカウンタの値に基づいて命令をフェッチする命令フェッチ手段と、命令フェッチ手段から送出された命令を実行する命令実行手段とを備え、命令には、実行スレッドの切り替えを要求するためのスレッド切り替えフラグを命令語内部に含み、スレッド切り替えフラグは、演算結果を得るのに所定値サイクルの遅延が生じる命令において、当該遅延サイクル中に存在する、当該演算結果を利用しない命令の数が、所定値サイクルの数よりも小さい場合に、実行スレッドの切り替えを要求することを指示するアクティブに設定され、命令フェッチ手段は、フェッチした命令の命令語内部に含む、スレッド切り替えフラグが、アクティブに設定されている場合には、実行スレッドの切り替えを要求する指示をスレッド選択手段に伝達し、スレッド選択手段は、該指示に基づいて、現在実行しているスレッドに対応するプログラムカウンタとは別のプログラムカウンタからのアドレスを選択して命令フェッチ手段に送出する。 In order to solve the above problems, the Ru good to the first aspect of the present invention, comprises a plurality of pipeline stages, a multi-threaded processor to switch a plurality of threads at a predetermined fine-grained, per-thread A program counter that controls the instruction flow, a thread selection unit that selects one of the program counters, an instruction fetch unit that fetches an instruction based on the value of the program counter selected by the thread selection unit, and an instruction fetch unit and a command execution means for executing the instructions, the instructions, viewing including the thread switching flag for requesting the switching of the execution thread within the instruction word, the thread switching flag, predetermined value cycles to obtain the calculation result In an instruction that causes a delay of Is set to active instructing to request switching of the execution thread when the number of cycles is smaller than the predetermined number of cycles, and the instruction fetch means includes a thread switch flag included in the instruction word of the fetched instruction. If it is set to active, an instruction to switch the execution thread is transmitted to the thread selection means, and the thread selection means, based on the instruction, receives a program counter corresponding to the currently executing thread and Selects an address from another program counter and sends it to the instruction fetch means .
本発明の第2の形態によると、複数のパイプラインステージを備え、所定の細粒度に複数個のスレッドを切り替えられるマルチスレッドプロセッサとして機能させるプログラムであって、マルチスレッドプロセッサを、スレッド毎の命令流を制御するプログラムカウンタ、プログラムカウンタの1つを選択するスレッド選択手段、スレッド選択手段が選択したプログラムカウンタの値に基づいて命令をフェッチする命令フェッチ手段、命令フェッチ手段から送出された命令を実行する命令実行手段として機能させ、命令には、実行スレッドの切り替えを要求するためのスレッド切り替えフラグを命令語内部に含み、スレッド切り替えフラグは、演算結果を得るのに所定値サイクルの遅延が生じる命令において、当該遅延サイクル中に存在する、当該演算結果を利用しない命令の数が、所定値サイクルの数よりも小さい場合に、実行スレッドの切り替えを要求することを指示するアクティブに設定され、命令フェッチ手段は、フェッチした命令の命令語内部に含む、スレッド切り替えフラグが、アクティブに設定されている場合には、実行スレッドの切り替えを要求する指示をスレッド選択手段に伝達し、スレッド選択手段は、該指示に基づいて、現在実行しているスレッドに対応するプログラムカウンタとは別のプログラムカウンタからのアドレスを選択して命令フェッチ手段に送出するように機能させる。 When Ru good to a second embodiment of the present invention, comprises a plurality of pipeline stages, a program to function as a multi-threaded processor to switch a plurality of threads at a predetermined fine grain, a multi-thread processor, each thread Counter for controlling the instruction flow of the program, thread selection means for selecting one of the program counters, instruction fetch means for fetching instructions based on the value of the program counter selected by the thread selection means, and instructions sent from the instruction fetch means The instruction includes a thread switching flag for requesting execution thread switching in the instruction word, and the thread switching flag has a delay of a predetermined value cycle to obtain the operation result. Present in the delay cycle in the resulting instruction When the number of instructions that do not use the operation result is smaller than the number of predetermined value cycles, the instruction fetch means is set to active instructing to request switching of the execution thread. When the thread switching flag included in the above is set to active, an instruction to switch the execution thread is transmitted to the thread selecting unit, and the thread selecting unit is currently executing based on the instruction. An address from a program counter different from the program counter corresponding to the thread is selected and functioned to be sent to the instruction fetch means .
以上説明したように、本発明のマルチスレッドプロセッサによれば、複数個のスレッドを細粒度のクロックサイクル単位で切り替えるマルチスレッドプロセッサにおいて、実行する命令の命令語内部に設けられたスレッド切り替えフラグに基づいて、実行するスレッドを切り替えることが可能となり、これにより、単位時間当たりの命令処理量を増加させると共にスループット性能を向上させることができるマルチスレッドプロセッサを提供できる効果がある。 As described above, according to the multi-thread processor of the present invention, in a multi-thread processor that switches a plurality of threads in units of fine-grained clock cycles, based on the thread switching flag provided in the instruction word of the instruction to be executed. Thus, it is possible to switch the thread to be executed, thereby providing an effect of providing a multi-thread processor capable of increasing the instruction processing amount per unit time and improving the throughput performance.
以下、本発明のマルチスレッドプロセッサの実施形態について、図面を参照して詳細に説明する。
但し、本発明の実施の形態は、下記の実施の形態に限定されることはなく、本発明の技術的範囲に属する限り、他の様々な形態をとり得る。
Hereinafter, embodiments of a multi-thread processor of the present invention will be described in detail with reference to the drawings.
However, the embodiments of the present invention are not limited to the following embodiments, and may take other various forms as long as they belong to the technical scope of the present invention.
図1は、本発明の実施形態に係るマルチスレッドプロセッサの基本構成を示す構成図である。
同図に示す本発明の実施形態に係るマルチスレッドプロセッサは、実行する命令の命令語内部に設けられたスレッド切り替えフラグに基づいて、実行するスレッドを切り替えることを特徴とする。
図1に示す本実施形態のマルチスレッドプロセッサは、基本構成として、スレッドの命令流を制御するプログラムカウンタ1(PC0〜PC3)と、実行するスレッドを選択するスレッド選択部2と、スレッド選択部2が選択したスレッドのプログラムカウンタ値に基づき、命令メモリ(図示は省略)から命令を読み出す命令フェッチ部3と、命令フェッチ部3が読み出した命令を実行する命令実行部4、とを備える。
FIG. 1 is a configuration diagram showing a basic configuration of a multi-thread processor according to an embodiment of the present invention.
The multi-thread processor according to the embodiment of the present invention shown in the figure is characterized in that the thread to be executed is switched based on a thread switching flag provided in the instruction word of the instruction to be executed.
The multi-thread processor of this embodiment shown in FIG. 1 has, as a basic configuration, a program counter 1 (PC0 to PC3) that controls the instruction flow of a thread, a
図1に示す本実施形態のマルチスレッドプロセッサでは、4つのスレッドを切り替える構成を示しているが、一般に、本発明に係るマルチスレッドプロセッサは、必ずしも、この実施形態に限るものではなく、切り替えることができるスレッドの数は、任意である。
また、本実施形態のマルチスレッドプロセッサは、近年のプロセッサと同様、動作周波数の向上を実現するために、複数のパイプラインステージから構成されるものとする。
さらに、図1に示す本実施形態のマルチスレッドプロセッサでは、命令フェッチステージと命令実行ステージとの2つのパイプラインステージを備えた構成を示しているが、一般に、本発明に係るマルチスレッドプロセッサは、必ずしも、このような構成に限るものではなく、プロセッサを構成するパイプラインステージの数は、任意である。
The multithread processor of the present embodiment shown in FIG. 1 shows a configuration in which four threads are switched. In general, however, the multithread processor according to the present invention is not necessarily limited to this embodiment, and can be switched. The number of threads that can be made is arbitrary.
In addition, the multi-thread processor of the present embodiment is composed of a plurality of pipeline stages in order to improve the operating frequency, as in recent processors.
Furthermore, in the multithread processor of the present embodiment shown in FIG. 1, a configuration including two pipeline stages of an instruction fetch stage and an instruction execution stage is shown, but in general, the multithread processor according to the present invention includes: It is not necessarily limited to such a configuration, and the number of pipeline stages constituting the processor is arbitrary.
図2は、本実施形態に係るマルチスレッドプロセッサで用いられる命令形式の1例を示す命令構成図である。
同図に示すように、本実施形態に係るマルチスレッドプロセッサで用いられる命令形式は、実行する命令の種類を指定するオペコード(Opcode)と、演算の対象データを指定するソースオペランド(r1/r2) と、演算結果の保存先を指定するデスティネーション(r3)と、実行するスレッドの切り替えを指示するスレッド切り替えフラグ(tcf)と、を含む。
FIG. 2 is an instruction configuration diagram illustrating an example of an instruction format used in the multithread processor according to the present embodiment.
As shown in the figure, the instruction format used in the multi-thread processor according to the present embodiment includes an opcode (Opcode) that specifies the type of instruction to be executed and a source operand (r1 / r2) that specifies data to be operated on. And a destination (r3) for designating a storage destination of the operation result, and a thread switching flag (tcf) for instructing switching of a thread to be executed.
図2に示す命令形式では、2個のソースオペランドと、1個のデスティネーションとを含む命令形式としたが、一般に、本発明に係るマルチスレッドプロセッサで用いられる命令形式は、必ずしも、これに限定されるものではなく、ソースオペランドの個数や、デスティネーションの個数は、例えば、0個の場合や、3個の場合であっても構わない。また、命令形式に、上記とは異なるフィールド( 例えば、単なる値など) を含んでいても構わない。 In the instruction format shown in FIG. 2, the instruction format includes two source operands and one destination. However, in general, the instruction format used in the multi-thread processor according to the present invention is not necessarily limited to this. For example, the number of source operands and the number of destinations may be zero or three. Further, the command format may include a field (for example, a simple value) different from the above.
以下、本発明の実施形態に係るマルチスレッドプロセッサの機能を説明する。
まず、命令フェッチ部3は、スレッド選択部2から指定されたアドレスに従って、図2に示す命令形式の命令を、命令メモリ(図示は省略)からフェッチする。その後、命令フェッチ部3は、フェッチした命令の命令語の内部に設けられたスレッド切り替えフラグ(tcf)がアクティブである場合に、実行するスレッドの切り替えをスレッド選択部2に要求する(より具体的には、内部フラグ(図示は省略)のスレッド切り替え要求をアクティブに設定する)。
スレッド選択部2は、内部フラグのスレッド切り替え要求がアクティブであることを検知し、現在実行しているスレッドに対応するプログラムカウンタとは、別のプログラムカウンタからのアドレスを選択し、前記アドレスを命令フェッチ部3へと送出する。
Hereinafter, functions of the multi-thread processor according to the embodiment of the present invention will be described.
First, the instruction fetch
The
図3は、本発明の実施形態に係るマルチスレッドプロセッサでプログラムを実行した場合のスレッド切り替え方法の1例を示す説明図である。
図3では、図1に示すマルチスレッドプロセッサにおいて、前述の図7に示すプログラムを実行した場合に、実行するスレッドがどのように切り替わるかを示している。
前述の図7に示すプログラム例の場合、fmul命令の命令語内部に設けられたスレッド切り替えフラグがアクティブに設定される。また、図3に示すIa-bは、スレッドaのb 番目の命令を示す。
FIG. 3 is an explanatory diagram showing an example of a thread switching method when a program is executed by the multithread processor according to the embodiment of the present invention.
FIG. 3 shows how threads to be executed are switched when the above-described program shown in FIG. 7 is executed in the multi-thread processor shown in FIG.
In the case of the program example shown in FIG. 7, the thread switching flag provided in the instruction word of the fmul instruction is set to active. Further, Ia-b shown in FIG. 3 indicates the b-th instruction of the thread a.
まず、図3に示すように、2サイクル目にスレッド1のfmul(I1-2)がフェッチされた段階で、fmul(I1-2)命令の命令語内部に設けられたスレッド切り替えフラグがアクティブであることをトリガーとして、図1のスレッド選択部が、実行するスレッドを、スレッド1(PC1)からスレッド2(PC2)に切り替える。3サイクル目では、スレッド2のfmov(I2-1)命令が、命令フェッチ部からフェッチされる。同様に、4サイクル目では、スレッド2(PC2)からスレッド3(PC3)への切り替えが行われる。
First, as shown in FIG. 3, when the fmul (I1-2) of the
図4は、本発明の実施形態に係るマルチスレッドプロセッサが実行する命令の、命令語中に設けられたスレッド切り替えフラグ(tcf)を設定する処理の手順を説明するフローチャート図である。
以下、図1〜3を参照しながら、図4に示すフローチャート図を使用して、本実施形態に係るマルチスレッドプロセッサが実行する命令の、命令語中に設けられたスレッド切り替えフラグ(tcf)を設定する処理の手順を説明する。
FIG. 4 is a flowchart illustrating a processing procedure for setting a thread switching flag (tcf) provided in an instruction word of an instruction executed by the multithread processor according to the embodiment of the present invention.
Hereinafter, the thread switching flag (tcf) provided in the instruction word of the instruction executed by the multithread processor according to the present embodiment will be described with reference to FIGS. A procedure of processing to be set will be described.
なお、同図に示すスレッド切り替えフラグ(tcf)の設定は、プログラマが生成したアセンブルプログラムまたはコンパイラが生成したマシン語プログラム、若しくはマシン語プログラムに対応したコンパイラの用いる中間言語記述を対象としてオペランドの依存関係等を分析することにより行うことが可能であり、この分析は、本発明の実施形態に係るコンピュータプログラムである専用のプログラムを実行して行うことが可能である。
また、この専用のプログラムは、前記のコンパイラ自体に含ませることも可能であり、さらに、コンパイラの実行後に実行される他のベーシックソフトに含ませることも可能である。ここでは、この専用のプログラムは、前記コンパイラ等のベーシックソフトに含まれているものとして説明する。
The setting of the thread switch flag (tcf) shown in the figure depends on the operand depending on the assembly language program generated by the programmer, the machine language program generated by the compiler, or the intermediate language description used by the compiler corresponding to the machine language program. The analysis can be performed by analyzing the relationship and the like, and the analysis can be performed by executing a dedicated program that is a computer program according to the embodiment of the present invention.
The dedicated program can be included in the compiler itself, and can also be included in other basic software executed after execution of the compiler. Here, the dedicated program will be described as being included in basic software such as the compiler.
なお、前述の本発明の実施形態に係る専用のプログラムを実行して作成されたプログラムも、また、本発明の実施形態に係るコンピュータプログラムである。
(ステップS1)
まず、入力となるアセンブルプログラム、またはマシン語プログラム、または中間言語記述における各命令に対して、各命令の演算結果を得るのに、N(>0)サイクルの遅延を生じるか否かを検査する。このため、ステップS1では、命令列を出力するコンパイラ等のベーシックソフトが、一時変数Sに1を代入し、以後、1番目の命令から順に、(一時変数Sの値)番目の命令を検査する用意をする。
The program created by executing the dedicated program according to the above-described embodiment of the present invention is also a computer program according to the embodiment of the present invention.
(Step S1)
First, for each instruction in the input assemble program, machine language program, or intermediate language description, it is checked whether or not a delay of N (> 0) cycles is generated to obtain the operation result of each instruction. . For this reason, in step S1, basic software such as a compiler that outputs an instruction sequence assigns 1 to the temporary variable S, and then checks the (first value of the temporary variable S) -th instruction in order from the first instruction. Get ready.
(ステップS2)
次に、ステップS2では、前記コンパイラ等のベーシックソフトが、(一時変数Sの値)番目の命令が、演算結果を得るのにN(>0)サイクルの遅延が生じるか否かを検証し、演算結果を得るのにN(>0)サイクルの遅延が生じない場合には、一時変数Sの新しい値を、(一時変数Sの値)+1番目とするために、ステップS10に移る。他方、演算結果を得るのにN(>0)サイクルの遅延が生じる場合は、ステップS3に進む。
(ステップS3)
ステップS3では、前記コンパイラ等のベーシックソフトが、一時変数Tに1を代入し、かつ一時変数Cに0を代入し、(一時変数Sの値)に後続する命令間のオペランド依存関係を検証する準備を行う。
(Step S2)
Next, in step S2, the basic software such as the compiler verifies whether or not the (temporary variable S value) instruction has a delay of N (> 0) cycles to obtain the operation result. If N (> 0) cycles are not delayed in obtaining the calculation result, the process proceeds to step S10 in order to set the new value of the temporary variable S to (the value of the temporary variable S) +1. On the other hand, if a delay of N (> 0) cycles occurs to obtain the calculation result, the process proceeds to step S3.
(Step S3)
In step S3, basic software such as the compiler assigns 1 to the temporary variable T and 0 to the temporary variable C, and verifies the operand dependency between the instructions following (the value of the temporary variable S). Make preparations.
(ステップS4)
次に、ステップS4では、前記コンパイラ等のベーシックソフトが、(S+1)番目から(S+N)番目の各命令が、S番目の命令の演算結果を利用するか否かを検証し、(S+1)番目から( S+N)番目の各命令が、S番目の命令の演算結果を利用しない場合はステップS5に進む。他方、(S+1)番目から(S+N)番目の各命令が、S番目の命令の演算結果を利用する場合はステップS6に移る。
(ステップS5)
ステップS5では、前記コンパイラ等のベーシックソフトが、一時変数Cの値に1を加え、ステップS6に進む。
(Step S4)
Next, in step S4, the basic software such as the compiler verifies whether or not each of the (S + 1) th to (S + N) th instructions uses the operation result of the Sth instruction, and the (S + 1) th If the (S + N) th instruction from to does not use the operation result of the Sth instruction, the process proceeds to step S5. On the other hand, if each of the (S + 1) th to (S + N) th instructions uses the operation result of the Sth instruction, the process proceeds to step S6.
(Step S5)
In step S5, the basic software such as the compiler adds 1 to the value of the temporary variable C and proceeds to step S6.
(ステップS6)
ステップS6では、前記コンパイラ等のベーシックソフトが、一時変数Tの値に1を加え、ステップS7に進む。
(ステップS7)
ステップS7では、前記コンパイラ等のベーシックソフトが、T>Nか否かを検証し、T>NであればステップS8に進む。他方、T>Nでない場合はステップS4に戻る。
(ステップS8)
ステップS8では、前記コンパイラ等のベーシックソフトが、C<(N/2)か否かを検証し、C<(N/2)であればステップS9に進む。他方、C<(N/2)でない場合はステップS10に移る。
(Step S6)
In step S6, the basic software such as the compiler adds 1 to the value of the temporary variable T, and proceeds to step S7.
(Step S7)
In step S7, it is verified whether basic software such as the compiler satisfies T> N. If T> N, the process proceeds to step S8. On the other hand, if T> N is not true, the process returns to step S4.
(Step S8)
In step S8, the basic software such as the compiler verifies whether or not C <(N / 2). If C <(N / 2), the process proceeds to step S9. On the other hand, if not C <(N / 2), the process proceeds to step S10.
(ステップS9)
ステップS9では、前記コンパイラ等のベーシックソフトが、S番目の命令のスレッド切り替えフラグ(tcf)をアクティブに設定し、ステップS10に進む。
(ステップS10)
ステップS10では、前記コンパイラ等のベーシックソフトが、一時変数Sの値に1を加え、ステップS11に進む。
(ステップS11)
ステップS11では、前記コンパイラ等のベーシックソフトが、S≧プログラムの命令数か否かを検証し、S≧プログラムの命令数でなければステップS2に戻る。他方、S≧プログラムの命令数であれば直ちに処理を終了する。
(Step S9)
In step S9, basic software such as the compiler sets the thread switching flag (tcf) of the Sth instruction to active, and the process proceeds to step S10.
(Step S10)
In step S10, the basic software such as the compiler adds 1 to the value of the temporary variable S, and proceeds to step S11.
(Step S11)
In step S11, the basic software such as the compiler verifies whether or not S ≧ the number of instructions in the program. If S ≧ the number of instructions in the program, the process returns to step S2. On the other hand, if S ≧ the number of instructions in the program, the process is immediately terminated.
この手順では、S番目の命令の演算結果を利用しない命令の数をカウントする。即ち、(S+1)番目の命令から順に、(S+T)番目の命令を検査し、(S+T)番目の命令が、S番目の命令の演算結果を利用しない場合には、一時変数Cをカウントアップする。
この検査を(S+N)番目の各命令に対して、順次行い、S番目の命令の演算結果を利用しない命令の数(C)に基づき、S番目の命令のスレッド切り替えフラグ(tcf)の設定を行うものである。また、利用しない命令の数(C)が、演算結果が得られるまでのサイクル数(N)の半分より小さければ、S番目の命令のスレッド切り替えフラグ(tcf)をアクティブに設定するのである。以上の処理を、プログラム中の全命令に対して行う。
このようにして、各命令のスレッド切り替えフラグ(tcf)を設定することができる。
In this procedure, the number of instructions that do not use the operation result of the Sth instruction is counted. That is, in order from the (S + 1) th instruction, the (S + T) th instruction is checked, and if the (S + T) th instruction does not use the operation result of the Sth instruction, the temporary variable C is counted up. .
This check is sequentially performed for each (S + N) th instruction, and the thread switching flag (tcf) of the Sth instruction is set based on the number of instructions (C) that do not use the operation result of the Sth instruction. Is what you do. If the number of unused instructions (C) is smaller than half of the number of cycles (N) until an operation result is obtained, the thread switching flag (tcf) of the Sth instruction is set to active. The above processing is performed for all instructions in the program.
In this way, the thread switching flag (tcf) for each instruction can be set.
なお、図4に示す処理手順では、スレッド切り替えフラグ(tcf)を設定するのに、演算結果を利用しない命令の数(C)が、演算結果が得られるまでのサイクル数(N)の半分より小さいことを条件としているが、一般に、本発明では、必ずしもこの条件に限るものではなく、例えば、CがNより小さいことや、CがNの1/4よりも小さいこと等をスレッド切り替えフラグ(tcf)を設定するための条件としてもよい。 In the processing procedure shown in FIG. 4, the number (C) of instructions that do not use the operation result for setting the thread switching flag (tcf) is less than half the number of cycles (N) until the operation result is obtained. In general, the present invention is not necessarily limited to this condition. For example, the thread switching flag (C is smaller than N, C is smaller than 1/4 of N, or the like). It may be a condition for setting tcf).
図5は、本発明の実施形態に係るマルチスレッドプロセッサの1実施例としての構成を示す構成図である。
同図に示すマルチスレッドプロセッサは、実行する命令の命令語内部に設けられたスレッド切り替えフラグに基づき、実行するスレッドを切り替えるマルチスレッドプロセッサである。
図5に示すように、本発明の実施形態に係るマルチスレッドプロセッサの1実施例としてのマルチスレッドプロセッサは、スレッドの命令流を制御するプログラムカウンタ1(PC0〜PC3)と、スレッド毎に、スレッドが実行されないサイクル数をカウントするスレッドカウンタ10(TC0〜TC3)と、実行するスレッドを選択するスレッド選択部2と、スレッド選択部が選択したスレッドのプログラムカウンタ値に基づき、命令メモリから命令を読み出す命令フェッチ部3と、後述するNOP置換部12が送出する命令を実行する命令実行部4と、NOP(None Operation)命令を送出するNOP11と、スレッド選択部2の指示に基づいてフェッチされた命令をNOP命令に置き換えるNOP置換部12と、から構成される。
FIG. 5 is a configuration diagram showing a configuration as one example of the multi-thread processor according to the embodiment of the present invention.
The multi-thread processor shown in the figure is a multi-thread processor that switches a thread to be executed based on a thread switching flag provided in an instruction word of an instruction to be executed.
As shown in FIG. 5, the multi-thread processor as an example of the multi-thread processor according to the embodiment of the present invention includes a program counter 1 (PC0 to PC3) for controlling the instruction flow of the thread, and a thread for each thread. A thread counter 10 (TC0 to TC3) that counts the number of cycles that are not executed, a
図5に示すマルチスレッドプロセッサでは、4つのスレッドを切り替えるマルチスレッドプロセッサを示しているが、一般に、本発明に係るマルチスレッドプロセッサは、必ずしも、この実施例に限定されるものではない。また、切り替えるスレッドの数は任意である。また、図5に示すマルチスレッドプロセッサは、近年の他のマルチスレッドプロセッサと同様に、動作周波数の向上を実現するために、複数のパイプラインステージから構成されるものとする。
さらに、図5に示すマルチスレッドプロセッサでは、命令フェッチステージと命令実行ステージとの2つのステージを示しているが、一般に、本発明に係るマルチスレッドプロセッサは、必ずしも、この実施例に限定されるものではない。プロセッサを構成するパイプラインステージの数は任意である。
The multi-thread processor shown in FIG. 5 shows a multi-thread processor that switches four threads, but in general, the multi-thread processor according to the present invention is not necessarily limited to this embodiment. Further, the number of threads to be switched is arbitrary. Further, the multi-thread processor shown in FIG. 5 is assumed to be composed of a plurality of pipeline stages in order to improve the operating frequency, like other multi-thread processors in recent years.
Furthermore, although the multithread processor shown in FIG. 5 shows two stages, an instruction fetch stage and an instruction execution stage, in general, the multithread processor according to the present invention is not necessarily limited to this embodiment. is not. The number of pipeline stages constituting the processor is arbitrary.
以下、図5に示したマルチスレッドプロセッサの機能を、特に、図1に示したマルチスレッドプロセッサの機能との相違点に留意して説明する。
図5に示すマルチスレッドプロセッサは、図1に示したマルチスレッドプロセッサと同様に、図2に示す命令形式の命令を実行し、フェッチされた命令の命令語内部に設けられたスレッド切り替えフラグ(tcf)がアクティブである場合に、スレッド選択部2が、実行するスレッドを切り替える。その際に、スレッド選択部2は、各スレッドに対応するスレッドカウンタ10のカウント値に基づき、次に選択するスレッドを決定する。具体的には、スレッドカウンタ10のカウント値が0であるスレッドを、次に実行するスレッドとして選択する。
In the following, the function of the multithread processor shown in FIG. 5 will be described with particular attention to differences from the function of the multithread processor shown in FIG.
As in the multithread processor shown in FIG. 1, the multithread processor shown in FIG. 5 executes an instruction having the instruction format shown in FIG. 2, and executes a thread switching flag (tcf provided in the instruction word of the fetched instruction. ) Is active, the
スレッドカウンタ10の各スレッドカウンタ(TC0〜TC3)には、初期値として0が格納されていて、スレッドが切り替えられると、元々実行されていたスレッドに対応するスレッドカウンタには、所定の値が格納される。そして、0以外の値が格納されるスレッドカウンタは、対応するスレッドが選択されていないサイクル毎に、0になるまでデクリメントされる。
スレッドが切り替えられる際に、スレッドカウンタ10に格納される所定の値は、元々実行していたスレッドにおいて、最後にフェッチされた命令のオペコード(Opcode)に基づき決定される。例えば、あるオペコードに該当する命令が、演算結果を得るのにN(>0)サイクルの遅延が生じる場合には、所定の値として、(N−1)の値がスレッドカウンタに格納される。このため、スレッドカウンタ10に格納される所定の値は、当該オペコードに基づいて制御されるセレクタ(図示は省略)によって選択され、該選択された値がスレッドカウンタに供給される。
Each thread counter (TC0 to TC3) of the thread counter 10
When a thread is switched, a predetermined value stored in the
このようなスレッドカウンタ10を用いることにより、スレッドAからスレッドBに切り替えた後、スレッドAにおけるデータ依存関係が解消する前に、再び、スレッドAが選択されることを防ぐことができる。
一方、NOP置換部12は、スレッド選択部2からの制御に基づき、命令フェッチ部3が読み出した命令を、NOP(None OPeration)命令に置き換える。具体的には、スレッドを切り替える際に、スレッド選択部2が、他に実行可能なスレッドが無いことを検知した場合に、スレッド選択部2は、NOP命令への置き換えを、NOP置換部12に対して要求する(より具体的には、NOP置換要求を示す内部フラグをアクティブに設定する) 。なお、スレッド選択部2は、実行中のスレッド以外に、スレッドカウンタ10のカウント値が0である実行待ちのスレッドが、1つも無い場合に、他に実行可能なスレッドが無いと判断する。
By using such a
On the other hand, the
この1実施例としてのマルチスレッドプロセッサでは、スレッドカウンタ10の初期値として0を設定し、オペコードに基づいて設定された所定値をデクリメントする構成としているが、一般に、本発明に係るマルチスレッドプロセッサは、必ずしも、この実施例に限定されるものではなく、初期値は0以外の値であっても構わない。また、スレッドカウンタ10をインクリメントする構成であっても構わない。
In the multi-thread processor as one embodiment, 0 is set as the initial value of the
本発明は、複数個のスレッドを細粒度のクロックサイクル単位で切り替えられるマルチスレッドプロセッサの構築に適用することができる。特に、命令間のオペランド依存関係に基づくスレッド切り替え機能を、確実に(即ち、任意に深い最適化レベルで)実現できると共に、低コストのハードウェアでも実現することができるマルチスレッドプロセッサの構築に好適である。 The present invention can be applied to the construction of a multi-thread processor in which a plurality of threads can be switched in units of fine-grained clock cycles. In particular, it is suitable for the construction of a multi-thread processor that can realize the thread switching function based on the operand dependency relationship between instructions reliably (that is, at an arbitrarily deep optimization level) and can be realized even with low-cost hardware. It is.
1 プログラムカウンタ
2 スレッド選択部
3 命令フェッチ部
4 命令実行部
10 スレッドカウンタ
12 NOP置換部
DESCRIPTION OF
Claims (6)
スレッド毎の命令流を制御するプログラムカウンタと、
前記プログラムカウンタの1つを選択するスレッド選択手段と、
前記スレッド選択手段が選択したプログラムカウンタの値に基づいて命令をフェッチする命令フェッチ手段と、
前記命令フェッチ手段から送出された前記命令を実行する命令実行手段と
を備え、
前記命令には、実行スレッドの切り替えを要求するためのスレッド切り替えフラグを命令語内部に含み、
前記スレッド切り替えフラグは、演算結果を得るのに所定値サイクルの遅延が生じる命令において、当該遅延サイクル中に存在する、当該演算結果を利用しない命令の数が、前記所定値サイクルの数よりも小さい場合に、実行スレッドの切り替えを要求することを指示するアクティブに設定され、
前記命令フェッチ手段は、フェッチした命令の命令語内部に含む、前記スレッド切り替えフラグが、アクティブに設定されている場合には、実行スレッドの切り替えを要求する指示を前記スレッド選択手段に伝達し、
前記スレッド選択手段は、該指示に基づいて、現在実行しているスレッドに対応するプログラムカウンタとは別のプログラムカウンタからのアドレスを選択して前記命令フェッチ手段に送出する
ことを特徴とするマルチスレッドプロセッサ。 A multi-thread processor having a plurality of pipeline stages and capable of switching a plurality of threads to a predetermined fine granularity;
A program counter that controls the instruction flow for each thread;
Thread selection means for selecting one of the program counters;
Instruction fetch means for fetching an instruction based on a value of a program counter selected by the thread selection means;
An instruction execution means for executing the instruction sent from the instruction fetch means;
The instruction includes a thread switching flag for requesting execution thread switching inside the instruction word,
In the thread switching flag, in an instruction that causes a delay of a predetermined value cycle to obtain an operation result, the number of instructions that do not use the operation result that exist in the delay cycle is smaller than the number of the predetermined value cycle. If set to active, indicating that the execution thread should be requested to switch
The instruction fetch means, when the thread switching flag included in the instruction word of the fetched instruction is set to active, transmits an instruction to switch the execution thread to the thread selection means,
The thread selection means selects an address from a program counter different from the program counter corresponding to the currently executing thread based on the instruction, and sends the address to the instruction fetch means. Processor.
前記命令フェッチ手段がフェッチした命令をNOP命令に置き換えるNOP置換手段と
を更に備え、
前記スレッド選択手段は、実行するスレッドを切り替える際に、前記スレッドカウンタのカウンタ値が0である実行待ちのスレッドを次に実行するスレッドとして選択し、前記スレッドカウンタのカウンタ値が0である実行待ちのスレッドが1つもない場合に、NOP命令への置き換えを前記NOP置換手段に要求する
ことを特徴とする請求項1に記載のマルチスレッドプロセッサ。 For each thread, a thread counter that counts the number of cycles in which the thread is not executed,
And NOP replacement means for replacing the instruction fetched by the instruction fetch means with a NOP instruction,
The thread selection means selects a thread waiting for execution whose counter value of the thread counter is 0 as a thread to be executed next when switching a thread to be executed, and is waiting for execution whose counter value of the thread counter is 0 2. The multithread processor according to claim 1, wherein when there is no thread, the NOP replacement unit is requested to replace it with a NOP instruction.
前記最後にフェッチされた命令のオペコードに基づいて決定される所定値は、該命令の演算結果を得るのに必要な遅延サイクル数に基づく値である
ことを特徴とする請求項2に記載のマルチスレッドプロセッサ。 The thread counter stores 0 as an initial value, and when a thread is switched, the thread counter corresponding to the thread that was being executed is determined based on the opcode of the last fetched instruction in the thread that was being executed. And decrementing the predetermined value until it becomes 0 for each cycle in which the corresponding thread is not selected,
The multi-value according to claim 2, wherein the predetermined value determined based on the opcode of the last fetched instruction is a value based on the number of delay cycles necessary to obtain an operation result of the instruction. Thread processor.
前記マルチスレッドプロセッサを、
スレッド毎の命令流を制御するプログラムカウンタ、
前記プログラムカウンタの1つを選択するスレッド選択手段、
前記スレッド選択手段が選択したプログラムカウンタの値に基づいて命令をフェッチする命令フェッチ手段、
前記命令フェッチ手段から送出された前記命令を実行する命令実行手段
として機能させ、
前記命令には、実行スレッドの切り替えを要求するためのスレッド切り替えフラグを命令語内部に含み、
前記スレッド切り替えフラグは、演算結果を得るのに所定値サイクルの遅延が生じる命令において、当該遅延サイクル中に存在する、当該演算結果を利用しない命令の数が、前記所定値サイクルの数よりも小さい場合に、実行スレッドの切り替えを要求することを指示するアクティブに設定され、
前記命令フェッチ手段は、フェッチした命令の命令語内部に含む、前記スレッド切り替えフラグが、アクティブに設定されている場合には、実行スレッドの切り替えを要求する指示を前記スレッド選択手段に伝達し、
前記スレッド選択手段は、該指示に基づいて、現在実行しているスレッドに対応するプログラムカウンタとは別のプログラムカウンタからのアドレスを選択して前記命令フェッチ手段に送出する
ように機能させることを特徴とするプログラム。 A program having a plurality of pipeline stages and functioning as a multi-thread processor capable of switching a plurality of threads to a predetermined fine granularity,
The multi-thread processor;
A program counter that controls the instruction flow for each thread,
Thread selection means for selecting one of the program counters;
Instruction fetch means for fetching an instruction based on a value of a program counter selected by the thread selection means;
Function as instruction execution means for executing the instruction sent from the instruction fetch means;
The instruction includes a thread switching flag for requesting execution thread switching inside the instruction word,
In the thread switching flag, in an instruction that causes a delay of a predetermined value cycle to obtain an operation result, the number of instructions that do not use the operation result that exist in the delay cycle is smaller than the number of the predetermined value cycle. If set to active, indicating that the execution thread should be requested to switch
The instruction fetch means, when the thread switching flag included in the instruction word of the fetched instruction is set to active, transmits an instruction to switch the execution thread to the thread selection means,
The thread selection means functions to select an address from a program counter different from the program counter corresponding to the currently executing thread based on the instruction and send the address to the instruction fetch means. Program.
スレッド毎に、スレッドが実行されないサイクル数をカウントするスレッドカウンタ、
前記命令フェッチ手段がフェッチした命令をNOP命令に置き換えるNOP置換手段
として更に機能させ、
前記スレッド選択手段は、実行するスレッドを切り替える際に、前記スレッドカウンタのカウンタ値が0である実行待ちのスレッドを次に実行するスレッドとして選択し、前記スレッドカウンタのカウンタ値が0である実行待ちのスレッドが1つもない場合に、NOP命令への置き換えを前記NOP置換手段に要求する
ように機能させることを特徴とする請求項4に記載のプログラム。 The multi-thread processor;
For each thread, a thread counter that counts the number of cycles in which the thread is not executed,
Further function as NOP replacement means for replacing the instruction fetched by the instruction fetch means with a NOP instruction,
The thread selection means selects a thread waiting for execution whose counter value of the thread counter is 0 as a thread to be executed next when switching a thread to be executed, and is waiting for execution whose counter value of the thread counter is 0 5. The program according to claim 4, wherein when there is no thread, the program is made to function so as to request the NOP replacement means to replace it with a NOP instruction.
前記最後にフェッチされた命令のオペコードに基づいて決定される所定値は、該命令の演算結果を得るのに必要な遅延サイクル数に基づく値である
ように機能させることを特徴とする請求項5に記載のプログラム。 The thread counter stores 0 as an initial value, and when a thread is switched, the thread counter corresponding to the thread that was being executed is determined based on the opcode of the last fetched instruction in the thread that was being executed. And decrementing the predetermined value until it becomes 0 for each cycle in which the corresponding thread is not selected,
The predetermined value determined based on the opcode of the last fetched instruction is made to function so as to be a value based on the number of delay cycles necessary for obtaining the operation result of the instruction. The program described in.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009172204A JP5573038B2 (en) | 2009-07-23 | 2009-07-23 | Multi-thread processor and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009172204A JP5573038B2 (en) | 2009-07-23 | 2009-07-23 | Multi-thread processor and program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2011028440A JP2011028440A (en) | 2011-02-10 |
| JP5573038B2 true JP5573038B2 (en) | 2014-08-20 |
Family
ID=43637135
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2009172204A Expired - Fee Related JP5573038B2 (en) | 2009-07-23 | 2009-07-23 | Multi-thread processor and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5573038B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20150019349A (en) * | 2013-08-13 | 2015-02-25 | 삼성전자주식회사 | Multiple threads execution processor and its operating method |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS61233838A (en) * | 1985-04-09 | 1986-10-18 | Nec Corp | Information processor |
| JP3569014B2 (en) * | 1994-11-25 | 2004-09-22 | 富士通株式会社 | Processor and processing method supporting multiple contexts |
| US6330584B1 (en) * | 1998-04-03 | 2001-12-11 | Mmc Networks, Inc. | Systems and methods for multi-tasking, resource sharing and execution of computer instructions |
| KR100498482B1 (en) * | 2003-01-27 | 2005-07-01 | 삼성전자주식회사 | Simultaneous Multithreading processor providing for thread fetch based on instructions count weighted by the operation cycle count and method thereof |
-
2009
- 2009-07-23 JP JP2009172204A patent/JP5573038B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2011028440A (en) | 2011-02-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR101109029B1 (en) | Arithmetic unit | |
| US7269712B2 (en) | Thread selection for fetching instructions for pipeline multi-threaded processor | |
| US5724565A (en) | Method and system for processing first and second sets of instructions by first and second types of processing systems | |
| US9286072B2 (en) | Using register last use infomation to perform decode-time computer instruction optimization | |
| US6061710A (en) | Multithreaded processor incorporating a thread latch register for interrupt service new pending threads | |
| CN101681261B (en) | Instruction execution controller and instruction execution control method | |
| JP5081143B2 (en) | Apparatus and method for automatically calling a low power consumption mode in a multi-threaded processor | |
| US8650554B2 (en) | Single thread performance in an in-order multi-threaded processor | |
| JP5173714B2 (en) | Multi-thread processor and interrupt processing method thereof | |
| US8301870B2 (en) | Method and apparatus for fast synchronization and out-of-order execution of instructions in a meta-program based computing system | |
| CN101238425B (en) | Apparatus and method for software specified power management performance using low power virtual threads | |
| JP5666473B2 (en) | Multi-threaded data processing system | |
| JP2008525921A (en) | A mechanism for scheduling threads on an OS isolation sequencer without operating system intervention | |
| US20090249037A1 (en) | Pipeline processors | |
| CN101763251A (en) | Instruction decode buffer device of multithreading microprocessor | |
| CN108920190B (en) | Apparatus and method for determining a recovery point from which recovery instructions are executed | |
| US11366669B2 (en) | Apparatus for preventing rescheduling of a paused thread based on instruction classification | |
| WO2002006959A1 (en) | Instruction fetch and dispatch in multithreaded system | |
| EP2159691B1 (en) | Simultaneous multithreaded instruction completion controller | |
| JP2020091751A (en) | Operation processing device and method for controlling the same | |
| US20060259741A1 (en) | Controlling out of order execution pipelines issue tagging | |
| KR102379886B1 (en) | Vector instruction processing | |
| JP5573038B2 (en) | Multi-thread processor and program | |
| JP5696210B2 (en) | Processor and instruction processing method thereof | |
| JP5104862B2 (en) | Instruction execution control device and instruction execution control method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120606 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130918 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130924 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20140408 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140514 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20140603 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140616 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5573038 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |