JP5145936B2 - Multi-thread central processing unit and simultaneous multi-threading control method - Google Patents

Multi-thread central processing unit and simultaneous multi-threading control method Download PDF

Info

Publication number
JP5145936B2
JP5145936B2 JP2007519071A JP2007519071A JP5145936B2 JP 5145936 B2 JP5145936 B2 JP 5145936B2 JP 2007519071 A JP2007519071 A JP 2007519071A JP 2007519071 A JP2007519071 A JP 2007519071A JP 5145936 B2 JP5145936 B2 JP 5145936B2
Authority
JP
Japan
Prior art keywords
thread
instruction
instructions
priority
threads
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.)
Active
Application number
JP2007519071A
Other languages
Japanese (ja)
Other versions
JPWO2006129767A1 (en
Inventor
信行 山崎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Keio University
Original Assignee
Keio University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Keio University filed Critical Keio University
Priority to JP2007519071A priority Critical patent/JP5145936B2/en
Publication of JPWO2006129767A1 publication Critical patent/JPWO2006129767A1/en
Application granted granted Critical
Publication of JP5145936B2 publication Critical patent/JP5145936B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/483Multiproc

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Advance Control (AREA)

Description

本発明は、一般的には中央演算装置(CPUまたはMPU)(以下、単に「プロセッサ」と呼ぶ)に関わり、特に、プロセッサ内で複数のスレッドを並列処理できるマルチスレッドプロセッサおよび同時マルチスレッディングを制御するための方法に関する。   The present invention generally relates to a central processing unit (CPU or MPU) (hereinafter simply referred to as a “processor”), and in particular, controls a multi-thread processor capable of processing a plurality of threads in parallel within the processor and simultaneous multi-threading. Related to the method.

本発明は、特に、各種ロボット、自動車、プラント、ホームオートメーション等の実時間処理を行うアプリケーションにおいて、各スレッドに課された時間制約を守りつつプロセッサのスループットを向上するために好適なマルチスレッドプロセッサに関する。   The present invention relates to a multi-thread processor suitable for improving the throughput of a processor while keeping the time constraint imposed on each thread, particularly in applications that perform real-time processing such as various robots, automobiles, plants, and home automation. .

実時間処理を行うリアルタイムシステムでは、各スレッドの時間制約を守るために、オペレーティングシステム(OS)のスケジューラは各スレッドの実行周期や時間制約により、各スレッドに優先度を付与する。そして、付与された優先度を基に、優先度の高いスレッドから順番に演算資源を割り当てて実行を行う。ここで、「スレッド」とは、プログラムの実行単位であり、通常、一つのアプリケーションプログラムは多数のスレッドから構成される。   In a real-time system that performs real-time processing, the scheduler of the operating system (OS) gives priority to each thread according to the execution period and time constraint of each thread in order to keep the time constraint of each thread. Then, based on the assigned priority, execution is performed by assigning computation resources in order from the thread with the highest priority. Here, the “thread” is a program execution unit, and usually one application program is composed of a number of threads.

図1に、一時に1スレッドのみを実行する従来のシングルスレッドプロセッサを用いて実時間処理を行った場合の例を示す。この例では、スレッド#0の優先度が最も高く、スレッド#7の優先度が最も低いとする。また、リリース時刻はそのスレッドが実行可能になる時刻、期限はそのスレッドの時間制約(その実行が完了されるべき最終期限)を示す。   FIG. 1 shows an example in which real-time processing is performed using a conventional single thread processor that executes only one thread at a time. In this example, assume that thread # 0 has the highest priority and thread # 7 has the lowest priority. Also, the release time indicates the time at which the thread can be executed, and the time limit indicates the time constraint of the thread (the final time limit at which the execution is to be completed).

図1に示された例では、最初にスレッド#1、スレッド#2およびスレッド#3が実行可能になる。これら実行可能なスレッド#1、#2および#3の中で最も優先度の高いスレッド#1にプロセッサ資源が与えられ、スレッド#1が実行される。スレッド#1の実行が完了すると、次に優先度の高いスレッド#2の実行を行うために、プロセッサ外のメモリとプロセッサとの間でコンテキストスイッチが起こる。コンテキストスイッチでは、現在実行しているスレッド#1のコンテキスト(すなわち、そのスレッドを実行するために必要なプロセッサ内のプログラムカウンタ、レジスタファイル、ステータスレジスタ等の各種資源)をプロセッサ外のメモリに退避させ、次に実行するスレッド#2のコンテキストをメモリからプロセッサ内に復帰させる。その後、プロセッサはスレッド#2の実行を開始する。スレッド#2の実行が完了すると、コンテキストスイッチが起こり、スレッド#2のコンテキストがメモリに退避し、スレッド#3のコンテキストがメモリからプロセッサ内に復帰した後、スレッド#3の実行が開始される。スレッド#3の実行中に、より優先度の高いスレッド#0が実行可能になると、スレッド#3の実行が中断され、コンテキストスイッチが起こり、スレッド#3のコンテキストがメモリに退避し、スレッド#0のコンテキストがプロセッサ内に復帰して、スレッド#0の実行が先に行われる。スレッド#0の実行が完了すると、コンテキストスイッチにより、スレッド#0のコンテキストがメモリに退避し、スレッド#3のコンテキストがプロセッサ内に復帰することにより、中断していたスレッド#3の実行が再開する。   In the example shown in FIG. 1, first, thread # 1, thread # 2, and thread # 3 become executable. Among these executable threads # 1, # 2, and # 3, the processor resource is given to the thread # 1 having the highest priority, and the thread # 1 is executed. When the execution of the thread # 1 is completed, a context switch occurs between the memory outside the processor and the processor in order to execute the thread # 2 having the next highest priority. The context switch saves the context of the currently executing thread # 1 (that is, various resources such as the program counter, register file, and status register in the processor necessary for executing the thread) to memory outside the processor. Then, the context of thread # 2 to be executed next is returned from the memory to the processor. Thereafter, the processor starts executing thread # 2. When execution of the thread # 2 is completed, a context switch occurs, the context of the thread # 2 is saved in the memory, and after the context of the thread # 3 returns from the memory to the processor, the execution of the thread # 3 is started. If thread # 0 with higher priority becomes executable during execution of thread # 3, execution of thread # 3 is interrupted, a context switch occurs, and the context of thread # 3 is saved in memory, and thread # 0 Is returned to the processor, and thread # 0 is executed first. When execution of thread # 0 is completed, the context of thread # 0 is saved in memory by the context switch, and the context of thread # 3 returns to the processor, so execution of suspended thread # 3 resumes .

このように従来のシングルスレッドプロセッサを用いた処理では、優先度の高いスレッドの実行が完了した場合や、現在実行しているスレッドよりもより優先度の高いスレッドが実行可能になった場合は、コンテキストスイッチが発生する。OSは、現在実行しているスレッドのコンテキストをメモリに退避し、次に実行するスレッドのコンテキストをプロセッサ内に復帰させなければならない。リアルタイムシステムでは、このコンテキストスイッチが大きなオーバヘッドとなる。一方、コンテキストスイッチのオーバヘッドを削減する技術として、プロセッサ内で複数のスレッドを並列処理するマルチスレッドプロセッサがある。マルチスレッドプロセッサは、プロセッサ内に複数スレッド分のコンテキストを保持し、これらをプロセッサ内のハードウェアで切り替えながらそれぞれのスレッドを実行するため、コンテキストスイッチを行わずに複数のスレッドを実行することが可能である(例えば、特許文献1参照)。   In this way, in the processing using the conventional single thread processor, when the execution of the thread with a higher priority is completed or when a thread with a higher priority than the currently executing thread becomes executable, A context switch occurs. The OS must save the context of the currently executing thread in the memory and return the context of the thread to be executed next to the processor. In a real-time system, this context switch is a large overhead. On the other hand, as a technique for reducing the overhead of context switching, there is a multi-thread processor that processes a plurality of threads in parallel in a processor. The multi-thread processor holds multiple thread contexts in the processor and executes each thread while switching them with the hardware in the processor, so it is possible to execute multiple threads without context switching (For example, see Patent Document 1).

また、実時間処理に適したマルチスレッドプロセッサのスループット向上のための別の制御技術として、各スレッドに割り当てられた優先度に応じて、複数のスレッドの命令の実行順序をリザベーションステーションにて入れ替える技術が知られている(例えば、特許文献2参照)。   In addition, as another control technology for improving the throughput of a multi-thread processor suitable for real-time processing, a technology for changing the execution order of instructions of multiple threads at the reservation station according to the priority assigned to each thread. Is known (see, for example, Patent Document 2).

特開2004−220070号公報Japanese Patent Laid-Open No. 2004-220070 特開2004−295195号公報JP 2004-295195 A

マルチスレッドプロセッサにおいて、複数のスレッドを並列に実行するとき、キャッシュアクセスや演算器等の演算資源においてスレッド間の競合が起こり得る。演算資源の競合が起こると、1スレッド単体の実行時間が増加する。そして、プロセッサ内で並列的に実行される複数のスレッドの組み合わせが異なれば、演算資源の競合の仕方や頻度が異なってくるため、各スレッドの実行時間が異なってくる。その結果、各スレッドの実行時間の予測精度が低下する。特にリアルタイムシステムでは、各スレッドに時間制約があるため、各スレッドの実行をその時間制約内に完了させ得るよう、スケジューラによりスレッド実行のスケジューリングがなされる。しかし、マルチスレッドプロセッサを用いたシステムでは、上記理由から時間予測精度が低いために、スレッドの時間制約を守れるようなスケジューリングが難しい。   In a multi-thread processor, when a plurality of threads are executed in parallel, contention between threads may occur in computation resources such as cache access and computing units. When the competition of computing resources occurs, the execution time of a single thread increases. If the combination of a plurality of threads executed in parallel within the processor is different, the execution time of each thread is different because the manner and frequency of computation resource competition differ. As a result, the prediction accuracy of the execution time of each thread decreases. In particular, in a real-time system, each thread has a time constraint. Therefore, the scheduler schedules thread execution so that execution of each thread can be completed within the time constraint. However, in a system using a multi-thread processor, the time prediction accuracy is low for the above reason, so that it is difficult to perform scheduling that keeps the thread time constraint.

従って、本発明の目的は、マルチスレッドプロセッサにおいて、時間予測精度の低下の原因であるスレッド実行時間の変動を抑制することにある。   Accordingly, an object of the present invention is to suppress fluctuations in thread execution time that cause a decrease in time prediction accuracy in a multithread processor.

本発明の別の目的は、マルチスレッドプロセッサのスループットを向上させることにある。   Another object of the present invention is to improve the throughput of a multi-thread processor.

本発明に従えば、複数のスレッドを並列的に処理するマルチスレッド中央演算装置は、各スレッドの優先度を記憶し、各スレッドの優先度を用いて、複数のスレッドの命令の処理の順序または頻度を制御する。加えて、このマルチスレッド中央演算装置は、各スレッドの命令実行目標を記憶し、各スレッドの時間当たりの実行命令数を監視し、そして、実行命令数と目標値を用いたフィードバック制御動作により、複数のスレッドの命令の処理の順序または頻度を制御する。   According to the present invention, the multi-thread central processing unit that processes a plurality of threads in parallel stores the priority of each thread, and uses the priority of each thread to process the processing order of the plurality of threads or Control the frequency. In addition, the multi-thread central processing unit stores the instruction execution target of each thread, monitors the number of execution instructions per time of each thread, and performs feedback control operation using the number of execution instructions and the target value. Control the order or frequency of processing of instructions in multiple threads.

このマルチスレッド中央演算装置によれば、各スレッドに付与された優先度を用いた命令処理順序/頻度の制御により、命令処理に必要な各種資源のスレッド間での競合が、各スレッドの優先度に応じて調停される。それに加えて、各スレッドの命令実行状態(例えば所定周期当りの実行命令数、IPCあるいはCPIなど)の監視に基づくフィードバック制御により、同時に処理されている他のスレッドからの影響が減り、各スレッドの実行時間の変動が抑制される。引いては、各スレッドの実行時間の予測精度の向上につながり、実時間処理の時間制約を守りつつ、プロセッサ全体のスループットを向上することが可能となる。   According to this multi-thread central processing unit, by controlling the instruction processing order / frequency using the priority given to each thread, the competition between threads of various resources necessary for instruction processing is reduced. Will be arbitrated accordingly. In addition, feedback control based on monitoring the instruction execution status of each thread (for example, the number of instructions executed per predetermined period, IPC or CPI) reduces the influence of other threads being processed at the same time. Variations in execution time are suppressed. This leads to an improvement in the prediction accuracy of the execution time of each thread, and it is possible to improve the throughput of the entire processor while keeping the time constraint of real-time processing.

好適な実施形態では、このマルチスレッド中央演算処理装置内の所定の資源(例えば、命令バッファ、リザベーションステーションまたはリオーダバッファ等)の複数スレッドへの割当量が監視され、監視されたそれらスレッドへの資源割当量がそれらスレッドの優先度に従うように、それらスレッドの命令フェッチ、発行または実行の順序または頻度が制御される。例えば、より下位の優先度をもつ1以上のスレッドの資源割当量が、より上位の優先度をもつ1以上のスレッドの資源割当量を超えた場合、その上位優先度をもつスレッド中の少なくとも一つのスレッドの命令フェッチ、発行または実行が促進され、または、その下位優先度をもつスレッドの命令フェッチ、発行または実行が抑制または禁止される。   In a preferred embodiment, the allocated amount of a predetermined resource (for example, an instruction buffer, a reservation station, or a reorder buffer) in the multi-thread central processing unit to a plurality of threads is monitored, and the resources for these monitored threads are monitored. The order or frequency of instruction fetch, issue, or execution of the threads is controlled so that the allocated amount follows the priority of the threads. For example, when the resource allocation amount of one or more threads having a lower priority exceeds the resource allocation amount of one or more threads having a higher priority, at least one of the threads having the higher priority Instruction fetch, issue or execution of one thread is facilitated, or instruction fetch, issue or execution of a thread having its lower priority is suppressed or prohibited.

より具体的には、各スレッドの命令バッファの占有量を監視して、より上位の優先度をもつ1以上のスレッドによる命令バッファの占有量が、下位の優先度をもつ1以上のスレッドによるそれ以下であるとき、その上位優先度をもつスレッド中の少なくとも一つのスレッドの命令のフェッチを促進し、または、その下位優先度をもつスレッドの命令のフェッチを抑制するように制御を行なうことができる。また、いずれかのスレッドによる命令バッファの占有量が少なくて所定の下限条件を満たさないときには、そのスレッドの命令のフェッチを促進し、または、そのスレッドの命令のフェッチの抑制を解除するように制御してもよい。更に、各スレッドのリザベーションステーションの占有量を監視して、より上位の優先度をもつ1以上のスレッドによるリザベーションステーションの占有量が、下位の優先度をもつ1以上のスレッドによるそれ以下であるとき、その上位優先度をもつスレッド中の少なくとも一つのスレッドの命令の発行を促進し、または、その下位優先度をもつスレッドの命令のフェッチを抑制するように制御を行なうこともできる。また、同じ優先度をもつ複数のスレッド間では、命令バッファの占有量がより小さいスレッドに優先的に、命令フェッチ権を与え、または、リザベーションステーションの占有量がより小さいスレッドに優先的に、命令発行権を与えるように制御を行なうことができる。   More specifically, the instruction buffer occupancy of each thread is monitored, and the instruction buffer occupancy by one or more threads having higher priority is that of one or more threads having lower priority. Controls to facilitate fetching instructions for at least one thread in a thread with its higher priority, or to suppress fetching instructions for a thread with its lower priority when . Also, when the instruction buffer occupancy by one of the threads is small and the predetermined lower limit condition is not satisfied, control is made so as to facilitate fetching of the instruction of the thread or cancel suppression of fetching of the instruction of the thread. May be. Furthermore, when the reservation station occupancy of each thread is monitored, the reservation station occupancy by one or more threads having a higher priority is less than that of one or more threads having a lower priority. It is also possible to perform control so as to promote the issuance of instructions of at least one thread in the thread having the higher priority, or to suppress fetching of instructions of the thread having the lower priority. In addition, among multiple threads with the same priority, the instruction fetch right is given to the thread with the smaller instruction buffer occupancy, or the instruction is given priority to the thread with the smaller reservation station occupancy. Control can be performed to give issuance rights.

このようにして、好適な実施形態では、上位優先度のスレッドの命令が下位優先度のスレッドの命令より先に処理されるように制御が行われる。しかし、上位優先度のスレッドが処理資源を無駄にするか、または非効率的に使用するような所定の状況下(例えば、キャッシュミスの発生、分岐予測ミスの発生または高い発生可能性、またはリザベーションステーションの占領など)では、下位優先度のスレッドの命令が上位優先度のスレッドの命令より先に処理されるように制御してもよい。   In this way, in the preferred embodiment, control is performed so that instructions of higher priority threads are processed before instructions of lower priority threads. However, under certain circumstances in which higher priority threads waste processing resources or use them inefficiently (eg, cache misses, branch prediction misses or high likelihood, or reservations) In the case of station occupation, etc., control may be performed so that instructions of lower priority threads are processed before instructions of higher priority threads.

また、好適な実施形態では、各スレッドの命令実行状態(例えばIPC)をスレッド毎に設定された命令実行目標(例えばIPCの目標値)に近づけるように、特に命令フェッチまたは発行のステージにおいて、上述した優先度による制御動作の制御条件に調整が加えられる。例えば、或るスレッドの命令実行状況が上記目標を満たさない場合、そのスレッドの命令のフェッチまたは発行の頻度が増加させられ、または、そのスレッドより下位の優先度をもつ他のスレッドの命令のフェッチまたは発行の頻度が抑制される。優先度による制御動作を調整させるために、優先度による制御の制御条件に組み込まれた「インフレーション値」と呼ばれるスレッド毎の操作値(好適な実施形態では、「インフレーション値」と呼ばれる)が増減され、それにより、各スレッドの命令のフェッチまたは発行が促進されたり、抑制されたりする。しかし、その操作値を変化させても、その変化に応じた命令実行状態の改善が現れない場合には、操作値が元に戻される。   In the preferred embodiment, the instruction execution state (for example, IPC) of each thread is brought close to the instruction execution target (for example, IPC target value) set for each thread, particularly in the instruction fetch or issue stage. Adjustments are made to the control conditions of the control action according to the priority. For example, when the instruction execution status of a thread does not satisfy the above target, the frequency of fetching or issuing the instruction of the thread is increased, or the instruction of an instruction of another thread having a lower priority than the thread is fetched. Or the frequency of issuing is suppressed. In order to adjust the control operation by priority, an operation value for each thread called “inflation value” incorporated in the control condition of control by priority (in the preferred embodiment, called “inflation value”) is increased or decreased. , Thereby facilitating or suppressing the fetching or issuing of instructions for each thread. However, even if the operation value is changed, if the instruction execution state does not improve according to the change, the operation value is restored.

本発明によれば、マルチスレッドプロセッサにおいて、各スレッドの実行時間またはIPCの変動を小さくすることが可能となる。これにより、実時間処理のためのより良いスケジューリングが容易となり、ひいては、プロセッサ全体のスループットの向上に貢献できる。   According to the present invention, in a multi-thread processor, it is possible to reduce the variation in the execution time or IPC of each thread. This facilitates better scheduling for real-time processing, which in turn can contribute to improving the throughput of the entire processor.

従来のシングルスレッドプロセッサによる実時間処理の例を示すタイムチャート図。The time chart figure which shows the example of the real-time process by the conventional single thread processor. 本発明に従うマルチスレッドプロセッサの一実施形態の主要部の構成を示すブロック線図。The block diagram which shows the structure of the principal part of one Embodiment of the multithread processor according to this invention. スレッドのIPCを制御するための構成を示すブロック線図。The block diagram which shows the structure for controlling IPC of a thread | sled. スレッドのIPCを制御するための制御関数の状態遷移とインフレーション値増減の動作を示すブロック線図。The block diagram which shows the operation | movement of the state transition of a control function for controlling IPC of a thread | sled, and inflation value increase / decrease. 優先度による調停を行なうマルチスレッドプロセッサを用いて実時間処理を行った場合の例を示すタイムチャート。The time chart which shows the example at the time of performing real-time processing using the multithread processor which performs arbitration by priority. 優先度による調停と共にIPC制御を行なうマルチスレッドプロセッサによる実時間処理の例を示すタイムチャート。The time chart which shows the example of the real-time process by the multithread processor which performs IPC control with arbitration by priority. 4つのパイプラインをもち、優先度による調停と共にIPC制御を行なうSMTプロセッサによる実時間処理の例を示すタイムチャート。The time chart which shows the example of the real-time processing by the SMT processor which has four pipelines and performs IPC control with arbitration by priority.

符号の説明Explanation of symbols

10 マルチスレッドプロセッサ
12 発行ユニット
14 キャッシュユニット
16 実行ユニット
20 スレッドコントロールユニット
24 フェッチスレッドセレクタ
32 命令発行セレクタ
36 レジスタファイル
38 コンテキストキャッシュ
40 リオーダバッファ
44 命令キャッシュ
48 命令ウェイトバッファ
52 データリード/ライトバッファ
58 データウェイトバッファ
60 リザベーションステーション
100 パイプライン処理機構
102 実行命令数監視部
104 比較部
106 制御関数部
10 multi-thread processor 12 issue unit 14 cache unit 16 execution unit 20 thread control unit 24 fetch thread selector 32 instruction issue selector 36 register file 38 context cache 40 reorder buffer 44 instruction cache 48 instruction wait buffer 52 data read / write buffer 58 data wait Buffer 60 Reservation station 100 Pipeline processing mechanism 102 Number of executed instructions monitoring unit 104 Comparison unit 106 Control function unit

以下、図2から図6を参照して、本発明の一実施形態について説明する。   Hereinafter, an embodiment of the present invention will be described with reference to FIGS.

図2は、本発明の一実施形態にかかるマルチスレッドプロセッサの主要部のブロック構成を示す。   FIG. 2 shows a block configuration of a main part of the multithread processor according to the embodiment of the present invention.

図2に示されるマルチスレッドプロセッサ(以下、単に「プロセッサ」という)10は、SMT(Simultaneous Multi Threading:同時マルチスレッディング)アーキテクチャを採用し、複数(例えば最大8つ)のスレッドを同時に処理することができるとともに、より多く(例えば最大40)のスレッドのコンテキストを内部に保持して、外部のメモリとの間でのコンテキストスイッチなしに多数のスレッドを処理することができる。図示のように、このプロセッサ10は発行ユニット12、キャッシュユニット14および実行ユニット16を備える。これらのユニット12,14および16の基本的な機能は次のとおりである。キャッシュユニット14は、外部のメモリ(図示省略)にアクセスし、その外部メモリから命令をフェッチしてキャッシュし、外部メモリからデータ(オペランド)をロードしてキャッシュし、また、ストアされるべきデータをキャッシュして外部メモリへストアする。実行ユニット16は、メモリアクセスユニットや各種の演算器等の演算資源を有し、発行ユニット12から発行された命令をアウトオブオーダで実行し、命令の実行結果を発行ユニット12へライトバックする。発行ユニット12は、複数のスレッドを並列的に処理できるよう、複数のスレッドのコンテキストを内部で保持し、それら複数のスレッドの命令をキャッシュユニット14からフェッチし、その命令をデコードし、その命令(その命令のデコード結果の動作指示)を実行ユニット16へ発行し、実行ユニット16からライトバックされた命令実行結果を受け、そして、その命令をコミットする。   A multi-thread processor (hereinafter simply referred to as “processor”) 10 shown in FIG. 2 employs an SMT (Simultaneous Multi Threading) architecture, and can process a plurality of (for example, a maximum of eight) threads simultaneously. At the same time, the context of more threads (for example, up to 40) can be held internally, and a large number of threads can be processed without context switching with external memory. As shown, the processor 10 includes an issue unit 12, a cache unit 14, and an execution unit 16. The basic functions of these units 12, 14 and 16 are as follows. The cache unit 14 accesses an external memory (not shown), fetches and caches instructions from the external memory, loads and caches data (operands) from the external memory, and stores data to be stored. Cache and store to external memory. The execution unit 16 has operation resources such as a memory access unit and various arithmetic units, executes the instruction issued from the issuing unit 12 in an out-of-order manner, and writes back the execution result of the instruction to the issuing unit 12. The issue unit 12 internally holds the contexts of the plurality of threads so that the plurality of threads can be processed in parallel, fetches the instructions of the plurality of threads from the cache unit 14, decodes the instructions, The operation instruction of the decoding result of the instruction is issued to the execution unit 16, the instruction execution result written back from the execution unit 16 is received, and the instruction is committed.

上述した基本的な機能の上に、このプロセッサ10は、本発明の原理に従う次のような特筆すべき2つの機能を有する。一つは、優先度による調停機能である。すなわち、それは、複数のスレッドに予め割り当てられた優先度に基づいて複数のスレッド間での資源の競合を調停する機能である。別の一つは、各スレッドのIPC(Instructions per Clock Cycle: クロックサイクル当り命令実行数)の変動を抑えできるだけ所望値で一定に保つためのIPC制御機能である。すなわち、それは、スレッド毎の一定時間当たりの実行命令数を監視し、各スレッドの実行命令数が各スレッドに予め割り当てられた実行命令数の目標値にできるだけ一致するように、複数のスレッドの命令の実行頻度を調整する機能である。この2つの機能は相互に関係付けられ同時に働く。ここで、各スレッドの優先度や命令実行数目標値は、例えば、OSのスケジューラやプログラマからプロセッサ10に対して設定される。   In addition to the basic functions described above, the processor 10 has two notable functions according to the principles of the present invention as follows. One is an arbitration function based on priority. That is, it is a function that mediates resource competition among a plurality of threads based on priorities assigned in advance to the plurality of threads. Another one is an IPC control function for keeping a desired value constant as much as possible while suppressing variations in IPC (Instructions per Clock Cycle) of each thread. That is, it monitors the number of execution instructions per fixed time for each thread, and the instructions of the plurality of threads so that the number of execution instructions of each thread matches the target value of the number of execution instructions assigned to each thread as much as possible. It is a function to adjust the execution frequency. These two functions are related to each other and work simultaneously. Here, the priority of each thread and the target number of instruction executions are set for the processor 10 by, for example, an OS scheduler or programmer.

優先度による調停機能を実現するために、発行ユニット12は、各スレッドに予め割り当てられた優先度を予め記憶する。その優先度はキャッシュユニット14および実行ユニット16にも通知される。発行ユニット12、キャッシュユニット14および実行ユニット16は、個別に、複数のスレッドの優先度に基づいて、複数のスレッドのそれぞれに提供される命令フェッチ、発行、実行およびコミットのための資源の量を制御する。なお、この目的のために、上位優先度のスレッドの実行が下位優先度のスレッドにより阻害されないようにするだけでなく、上位優先度のスレッドの性能を低下させずに、下位優先度のスレッドも実行されるような制御方法が実装される。   In order to realize the arbitration function by priority, the issuing unit 12 stores in advance the priority assigned in advance to each thread. The priority is also notified to the cache unit 14 and the execution unit 16. The issue unit 12, the cache unit 14, and the execution unit 16 individually determine the amount of resources for instruction fetch, issue, execution, and commit provided to each of the plurality of threads based on the priority of the plurality of threads. Control. For this purpose, not only does the execution of the higher priority thread not be hindered by the lower priority thread, but also the lower priority thread A control method to be executed is implemented.

さらに、IPC制御機能を実現するために、発行ユニット12は、各スレッドに予め割り当てられた実行命令数の目標値を予め記憶する。発行ユニット12は、一定の繰返し周期でスレッド毎の実際の実行命令数(コミットされた命令の数)をカウントし、それを予め記憶している目標値と比較する。或るスレッドの実際の実行命令数が目標値に達してなければ、そのスレッドの命令のフェッチまたは発行の頻度が増えるように、上述した優先度による資源競合調停の制御をフィードバック制御により修正する。例えば、或るスレッドの命令のフェッチまたは発行の頻度を増加させるために、そのスレッドより下位優先度のスレッドのフェッチまたは発行が抑制される。逆に、例えば、或るスレッドの命令のフェッチまたは発行の頻度を低下させるために、そのスレッドより下位優先度のスレッドのフェッチまたは発行が促進される。   Furthermore, in order to implement the IPC control function, the issuing unit 12 stores in advance a target value of the number of execution instructions allocated in advance to each thread. The issuing unit 12 counts the actual number of executed instructions (number of committed instructions) for each thread at a fixed repetition period, and compares it with a target value stored in advance. If the actual number of instructions executed by a thread does not reach the target value, the resource contention arbitration control based on the priority is corrected by feedback control so that the frequency of fetching or issuing the instruction of the thread is increased. For example, in order to increase the frequency of fetching or issuing an instruction of a thread, fetching or issuing a thread having a lower priority than that thread is suppressed. Conversely, for example, in order to reduce the frequency of fetching or issuing instructions of a thread, fetching or issuing of a thread having a lower priority than that thread is facilitated.

以下、図2を参照しつつ、プロセッサ10のより具体的な構成と機能、とりわけ、優先度による調停機能とIPC制御機能に関わる部分に重点をおいて説明する。   Hereinafter, a more specific configuration and function of the processor 10, particularly a part related to the arbitration function by priority and the IPC control function will be described with reference to FIG. 2.

発行ユニット12は、スレッドコントロールユニット20、同時処理可能なスレッドの最大数分(例えば8つ)のPC(プログラムカウンタ)コントロールユニット22、フェッチスレッドセレクタ24、命令デコーダ26、命令アナライザ28、命令バッファ30、命令発行セレクタ32、リネームレジスタ34、同時処理可能なスレッドの最大数分(例えば8つ)のレジスタファイル36、およびリオーダバッファ40を有する。キャッシュユニット14は、命令MMU(メモリマネジメントユニット)42、命令キャッシュ44、命令ヴィクティムキャッシュ46、命令ウェイトバッファ48、データMMU50、データリード/ライトバッファ52、データキャッシュ54、データヴィクティムバッファ56およびデータウェイトバッファ58を有する。実行ユニット16は、所定の複数個(例えば5つ)のリザベーションステーション60と各種の演算資源62−80を有する。演算資源62−80には、メモリアクセスユニット62、複数のブランチユニット64、整数除算器66、複数の整数演算ユニット68、FP(浮動小数点)除算器70、複数のFP演算ユニット72、64ビット整数演算ユニット74、ベクタ整数演算ユニット78およびベクタFP演算ユニット80などがある。同時処理されるスレッドが同じ演算資源を同時に使おうとする可能性は低いので、リザベーションステーションの個数や各演算資源の個数は、同時処理可能なスレッドの最大数(例えば8つ)よりは少なく、資源の無駄な冗長を避けている。   The issue unit 12 includes a thread control unit 20, a PC (program counter) control unit 22 corresponding to the maximum number of threads that can be processed simultaneously (for example, eight), a fetch thread selector 24, an instruction decoder 26, an instruction analyzer 28, and an instruction buffer 30. , An instruction issue selector 32, a rename register 34, a register file 36 corresponding to the maximum number of threads that can be processed simultaneously (for example, eight), and a reorder buffer 40. The cache unit 14 includes an instruction MMU (memory management unit) 42, an instruction cache 44, an instruction victim cache 46, an instruction wait buffer 48, a data MMU 50, a data read / write buffer 52, a data cache 54, a data victim buffer 56, and a data wait buffer. 58. The execution unit 16 has a predetermined plurality (for example, five) of reservation stations 60 and various computing resources 62-80. The computing resource 62-80 includes a memory access unit 62, a plurality of branch units 64, an integer divider 66, a plurality of integer computing units 68, an FP (floating point) divider 70, a plurality of FP computing units 72, and a 64-bit integer. There are an arithmetic unit 74, a vector integer arithmetic unit 78, a vector FP arithmetic unit 80, and the like. Since it is unlikely that threads that are processed simultaneously will use the same computing resource at the same time, the number of reservation stations and the number of each computing resource are less than the maximum number of threads that can be processed simultaneously (for example, eight). Avoid unnecessary redundancy.

以下では、命令が処理される流れにほぼ沿って、各部の機能と動作を説明する。   In the following, the function and operation of each part will be described along the flow of processing instructions.

スレッドコントロールユニット22は、複数スレッドの並列的な処理を制御するためのコアとして働くユニットであり、その内部に複数のスレッドの優先度を記憶し保持し、そして、その優先度をプロセッサ10全体に配布する。ここで、スレッドコントロールユニット22に記憶され得る優先度のスレッド数は、好ましくは、このプロセッサ10が内部に保持し得るコンテキストのスレッドの最大数(例えば40)以上である。複数のPCコントロールユニット22は、プロセッサ10内で同時処理され得る複数のスレッドにそれぞれ割り当てられ、それぞれのスレッドからのプログラムカウンタの値をフェッチスレッドセレクタ24に与える。複数スレッド間の競合は、まず命令キャッシュアクセスにおいて生じる。そこで、フェッチスレッドセレクタ24は、命令キャッシュアクセスを要求しているスレッドの中から、各スレッドの優先度を用いて、一つのスレッドを選択し、選択されたスレッドのプログラムカウンタを命令MMU(メモリマネジメントユニット)42に送る。ここで、フェッチスレッドセレクタ24は、原則として命令キャッシュアクセスを要求しているスレッドの中で最上位優先度をもつスレッドを選択する。しかし、常に最上位優先度のスレッドが選択されるわけではなく、最上位優先度のスレッドの実行が圧迫されない所定の状況下では、最上位優先度のスレッドに代えて下位優先度のスレッドが選択される場合もある。   The thread control unit 22 is a unit that functions as a core for controlling parallel processing of a plurality of threads. The thread control unit 22 stores and holds the priority of the plurality of threads therein, and the priority is assigned to the entire processor 10. To distribute. Here, the number of priority threads that can be stored in the thread control unit 22 is preferably equal to or greater than the maximum number (for example, 40) of context threads that the processor 10 can internally hold. The plurality of PC control units 22 are respectively assigned to a plurality of threads that can be simultaneously processed in the processor 10, and give the value of the program counter from each thread to the fetch thread selector 24. Contention between multiple threads first occurs in instruction cache access. Therefore, the fetch thread selector 24 selects one thread from the threads requesting the instruction cache access using the priority of each thread, and sets the program counter of the selected thread to the instruction MMU (memory management). Unit) 42. Here, the fetch thread selector 24 selects, in principle, a thread having the highest priority among threads requesting instruction cache access. However, the thread with the highest priority is not always selected, and the thread with the lower priority is selected instead of the thread with the highest priority under certain circumstances where the execution of the thread with the highest priority is not under pressure. Sometimes it is done.

命令MMU42は、命令キャッシュ44をアクセスして、上記選択されたスレッドの命令を命令キャッシュ44から命令デコーダ26に渡させる。ここで命令キャッシュミスが発生した場合、外部のメモリ(図示省略)をアクセスしキャッシュラインを読み込む必要がある。メモリアクセスはキャッシュアクセスに比べてレイテンシが大きいため、キャッシュミスが続くと、命令ウェイトバッファ48にて複数のメモリアクセス要求が待たされる。この場合、命令ウェイトバッファ48は、各スレッドの優先度に基づいて、原則として最上位優先度のスレッドのメモリアクセス要求から先に処理する。それにより、より上位の優先度をもつスレッドの実行が優先される。しかし、常に優先度の高いスレッドのメモリアクセス要求が優先されるわけではなく、上位優先度のスレッドの実行が圧迫されない所定の状況下では、上位優先度のスレッドよりも下位優先度のスレッドのメモリアクセス要求が先に処理される場合もある。   The instruction MMU 42 accesses the instruction cache 44 and passes the instruction of the selected thread from the instruction cache 44 to the instruction decoder 26. Here, when an instruction cache miss occurs, it is necessary to read the cache line by accessing an external memory (not shown). Since memory access has higher latency than cache access, if a cache miss continues, a plurality of memory access requests are waited in the instruction wait buffer 48. In this case, based on the priority of each thread, the instruction wait buffer 48 basically processes the memory access request of the highest priority thread first. Thereby, priority is given to the execution of a thread having a higher priority. However, memory access requests of higher priority threads are not always given priority, and under certain circumstances where the execution of higher priority threads is not under pressure, the memory of lower priority threads is higher than higher priority threads. In some cases, the access request is processed first.

命令キャッシュ44から命令デコーダ26へ、複数(キャッシュの1ライン分である例えば8つ)の命令が同時に送られる。命令デコーダ26は、命令キャッシュ44から同時にフェッチした複数命令を同時にデコードし、それら複数命令のデコード結果(これも、以下の説明では便宜上「命令」という)は同時に命令バッファ40に入れられる。その際、命令アナライザ28が、同時デコードされた複数命令の命令タイプ(どのスレッドの命令であるか、どの演算資源を使用するか、および命令間の依存関係はどうかなどの判断を行うために必要な、スレッド、オペコードおよびオペランドなどに関する情報)を把握し、その命令タイプを命令発行セレクタ32に与える。命令発行セレクタ32は、リオーダバッファ40、リネームレジスタ34およびリザベーションステーション60の空きや、命令バッファ30内の命令間の依存関係を調べ、その結果に基づいて、命令バッファ30の中から、リザベーションステーション60に発行可能である命令を選択する。所定数(同時処理可能なスレッド最大数より少ない例えば4つ)の命令が同時に命令バッファ30から発行され得る。その際、命令発行セレクタ32は、命令バッファ30内に発行可能な命令が複数(とりわけ、上記所定数(4つ)より多く)ある場合、各スレッドの優先度に応じて、原則としてより上位の優先度をもつスレッドの命令から先に発行する。しかし、後述するように、上位優先度のスレッドの実行が圧迫されない所定の状況下では、上位優先度のスレッドよりも下位の優先度のスレッドの命令が先に発行される場合もある。   A plurality of (for example, eight, which is one line of the cache) instructions are simultaneously sent from the instruction cache 44 to the instruction decoder 26. The instruction decoder 26 simultaneously decodes a plurality of instructions fetched from the instruction cache 44 at the same time, and the decoding results of these instructions (also referred to as “instructions” for convenience in the following description) are simultaneously stored in the instruction buffer 40. At that time, it is necessary for the instruction analyzer 28 to determine the instruction type of multiple instructions decoded simultaneously (which thread's instruction, which computing resource is used, and whether there is a dependency between instructions, etc.) Information regarding threads, opcodes, operands, etc.) and giving the instruction type to the instruction issue selector 32. The instruction issue selector 32 checks the availability of the reorder buffer 40, the rename register 34, and the reservation station 60, and the dependency relationship between instructions in the instruction buffer 30, and based on the result, from the instruction buffer 30 to the reservation station 60. Select an instruction that can be issued. A predetermined number of instructions (for example, four less than the maximum number of threads that can be processed simultaneously) can be issued from the instruction buffer 30 at the same time. At that time, when there are a plurality of instructions that can be issued in the instruction buffer 30 (especially, more than the predetermined number (four)), the instruction issue selector 32 is in principle higher order according to the priority of each thread. It is issued first from the instruction of the thread with the priority. However, as will be described later, under a predetermined situation in which execution of a higher priority thread is not squeezed, an instruction of a lower priority thread than a higher priority thread may be issued first.

各リザベーションステーション60に接続された整数演算ユニット68やFP演算ユニット72等の各種の演算ユニットについても、スレッド間で競合が発生する。そこで、各リザベーションステーション60でも、各スレッドの優先度を用いた競合の調停が行なわれる。各リザベーションステーション60は、そこで待機している命令を、演算に必要なオペランドがそろった命令から順に、アウトオブオーダで演算ユニットに送る。その際、各リザベーションステーション60は、複数の命令が同時に演算可能になった場合、各スレッドの優先度に基づいて、原則として優先度の高いスレッドの命令から先に演算ユニットに送ることにより、優先度の高いスレッドの実行を優先する。しかし、常に優先度の高いスレッドの命令が優先されるわけではなく、上位優先度のスレッドの実行が圧迫されない所定の状況下では、上位優先度のスレッドに代えて下位の優先度のスレッドの命令が先に演算ユニットに送られる場合もある。   The various arithmetic units such as the integer arithmetic unit 68 and the FP arithmetic unit 72 connected to each reservation station 60 also compete with each other. Thus, each reservation station 60 also performs contention arbitration using the priority of each thread. Each reservation station 60 sends the instructions waiting there to the arithmetic unit out-of-order in order from the instruction having the operands necessary for the operation. At that time, when a plurality of instructions can be operated simultaneously, each reservation station 60, in principle, sends the instruction of the thread with the higher priority first to the operation unit based on the priority of each thread. Priority is given to thread execution. However, the instruction of the thread with the higher priority is not always given priority, and the instruction of the thread with the lower priority is substituted for the thread with the higher priority in a predetermined situation where the execution of the thread with the higher priority is not under pressure. May be sent to the arithmetic unit first.

データキャッシュアクセスにおいても競合が発生する。そこで、データリード/ライトバッファ52は、各スレッドの優先度に基づいて、原則として上位優先度のスレッドのデータキャッシュアクセスから先に実行することにより、上位優先度のスレッドの実行を優先する。しかし、常に優先度の高いキャッシュアクセスが優先されるわけではなく、上位優先度のスレッドの実行が圧迫されない所定の状況下では、上位優先度のスレッドに代えて下位の優先度のスレッドのキャッシュアクセスが先に処理される場合もある。また、データキャッシュミスが起こった場合、外部のメモリ(図示省略)をアクセスしキャッシュラインを読み込む必要があるが、命令キャッシュの場合と同様に、データウェイトバッファ58が、各スレッドの優先度に基づいて、原則として上位優先度のスレッドのメモリアクセス要求から先に処理することにより、優先度の高いスレッドの実行を優先する。しかし、ここでも、常に優先度の高いスレッドのメモリアクセスが優先されるわけではなく、上位優先度のスレッドの実行が圧迫されない所定の状況下では、上位優先度のスレッドに代えて下位の優先度のスレッドのメモリアクセスが先に処理される場合もある。   Contention also occurs in data cache access. Therefore, the data read / write buffer 52 gives priority to the execution of the higher priority thread by executing first the data cache access of the higher priority thread based on the priority of each thread. However, cache access with a higher priority is not always given priority. Under certain circumstances where the execution of higher priority threads is not under pressure, cache access with lower priority threads is substituted for higher priority threads. May be processed first. When a data cache miss occurs, it is necessary to access an external memory (not shown) and read the cache line. However, as in the case of the instruction cache, the data wait buffer 58 is based on the priority of each thread. Thus, in principle, the execution of the thread with the higher priority is given priority by processing the memory access request of the thread with the higher priority first. However, even in this case, memory access of a higher priority thread is not always given priority, and in a predetermined situation where execution of a higher priority thread is not under pressure, a lower priority is used instead of a higher priority thread. In some cases, the memory access of the thread is processed first.

リオーダバッファ40は、アウトオブオーダで実行された命令の実行結果を一時的に保持し、インオーダで命令をコミットする。所定数(同時処理可能なスレッド最大数より少ない例えば4つ)の命令が同時にコミットされ得る。その際、リオーダバッファ40は、複数(とりわけ、上記所定数(4つ)より多く)の命令がコミット可能であれば、原則として上位優先度のスレッドの命令から先にコミットする。しかし、ここでも、常に優先度の高いスレッドが優先されるわけではなく、上位優先度のスレッドの実行が圧迫されない所定の状況下では、上位優先度のスレッドに代えて下位の優先度のスレッドが先にコミットされる場合もある。   The reorder buffer 40 temporarily holds the execution result of the instruction executed out of order, and commits the instruction in order. A predetermined number of instructions (for example, four less than the maximum number of threads that can be processed simultaneously) can be committed simultaneously. At that time, if a plurality of (especially, more than the predetermined number (four)) instructions can be committed, the reorder buffer 40 generally commits the instructions of the higher priority thread first. However, in this case as well, a thread with a higher priority is not always given priority, and a thread with a lower priority is replaced with a thread with a lower priority in a predetermined situation where execution of a thread with a higher priority is not under pressure. Sometimes committed first.

レジスタファイル36は、同時処理され得るスレッド最大数(例えば8つ)だけ存在し、それぞれ、同時処理される複数のスレッドに割り当てられる。各レジスタファイル36には、各スレッドのコンテキストが格納される。コンテキストキャッシュ38は、より多くのスレッド数(例えば32スレッド)分のコンテキストが格納できる。コンテキストキャッシュ38内の任意のスレッドのコンテキストと任意のレジスタファイル36内のコンテキストとを高速に交換することができる。従って、このプロセッサ10では、レジスタファイル36の数(例えば8つ)のスレッドがコンテキストスイッチを行うことなしに処理でき、コンテキストキャッシュ38がサポートするスレッド数(例えば32個)のスレッドが、高速にコンテキストスイッチを行うことができる。   There are as many register files 36 as the maximum number of threads that can be processed simultaneously (for example, eight), and each register file 36 is assigned to a plurality of threads that are processed simultaneously. Each register file 36 stores the context of each thread. The context cache 38 can store contexts for a larger number of threads (for example, 32 threads). The context of any thread in the context cache 38 and the context in any register file 36 can be quickly exchanged. Therefore, in this processor 10, the number of register files 36 (for example, eight) threads can be processed without performing context switching, and the number of threads (for example, 32) supported by the context cache 38 can be processed at high speed. A switch can be performed.

上述したように、プロセッサ10内における命令のフェッチ、発行、実行およびコミットのステージにそれぞれ関わる諸ユニットにおいて、複数のスレッドの優先度を用いて、スレッド間での資源競合を調停するための命令の処理順序または処理頻度の制御が行われる。これにより、上位優先度のスレッドが優先的に実行され、かつ、上位優先度のスレッドの性能を低下させないようにして下位優先度のスレッドも実行されることになる。   As described above, in units related to the fetch, issue, execution, and commit stages of instructions in the processor 10, instructions for arbitrating resource contention among threads using the priority of a plurality of threads. The processing order or the processing frequency is controlled. As a result, the higher priority thread is preferentially executed, and the lower priority thread is also executed without degrading the performance of the upper priority thread.

さて、上記制御に加えて、各スレッドの実行時間の予測を容易にするために、各スレッドのIPCの変動を抑えてそれをできるだけ所望値の近傍に維持するためのIPC制御が、プロセッサ10で行われる。上述したスレッドの優先度を用いた命令の処理順序または処理頻度の制御が、このIPC制御により調整または修正される。この実施形態では、スレッドコントロールユニット20、フェッチスレッドセレクタ24および命令発行セレクタ32が、このIPC制御に直接的に関与する。スレッドコントロールユニット20は、複数のスレッドの各々に予め割り当てられた実行命令数の目標値を記憶し保持する。ここで、スレッドコントロールユニット22に記憶され得る目標値のスレッド数は、好ましくは、このプロセッサ10が内部に保持し得るコンテキストのスレッドの最大数(例えば40)以上である。スレッドコントロールユニット20は、一定の監視周期毎(例えば、数百クロックサイクル毎)にスレッド毎の実際の実行命令数(IPC x 1監視周期中のクロックサイクル数)をカウントし、カウントされた実行命令数と記憶されている目標値とを比較し、そして、その比較の結果に基づくフィードバック制御の方法で、フェッチスレッドセレクタ24および命令発行セレクタ32による各スレッドの命令フェッチと命令発行の頻度を制御する。   In addition to the above control, in order to facilitate the prediction of the execution time of each thread, the processor 10 performs IPC control for suppressing fluctuation of the IPC of each thread and maintaining it as close to a desired value as possible. Done. The control of the processing order or processing frequency of instructions using the thread priority described above is adjusted or corrected by this IPC control. In this embodiment, the thread control unit 20, the fetch thread selector 24, and the instruction issue selector 32 are directly involved in this IPC control. The thread control unit 20 stores and holds a target value of the number of execution instructions allocated in advance to each of a plurality of threads. Here, the number of threads of the target value that can be stored in the thread control unit 22 is preferably equal to or greater than the maximum number (for example, 40) of context threads that the processor 10 can internally hold. The thread control unit 20 counts the actual number of execution instructions (IPC x number of clock cycles in one monitoring period) per thread for every fixed monitoring period (for example, every several hundred clock cycles), and the counted execution instructions The number is compared with the stored target value, and the frequency of instruction fetch and instruction issue of each thread by the fetch thread selector 24 and the instruction issue selector 32 is controlled by a feedback control method based on the comparison result. .

図3は、このIPC制御を行なう機構の構成を示す。   FIG. 3 shows a configuration of a mechanism for performing this IPC control.

図3において、ブロック100は、プロセッサ10内における上述された複数スレッドの命令のパイプライン処理を行う機構を示し、そこでは、上述されたように、各スレッドの優先度を用いて、スレッド間の資源競合の調停制御が行われる。IPC制御機構は、実行命令数監視部102、比較部104および制御関数部106を有し、図2に示されたスレッドコントロールユニット20に組み込まれる。   In FIG. 3, block 100 shows a mechanism for pipeline processing of the above-described multi-thread instructions in processor 10, where, as described above, using the priority of each thread, Resource contention arbitration control is performed. The IPC control mechanism includes an execution instruction number monitoring unit 102, a comparison unit 104, and a control function unit 106, and is incorporated in the thread control unit 20 shown in FIG.

実行命令数監視部102は、一定の監視周期毎に、並列処理されている複数スレッドの各々の実行命令数をカウントする。比較部104は、スレッド毎に、カウントされた実際の命令実行数と、予め記憶されている目標値とを比較する。後述するように、この実施形態では、後述するような状態遷移に従う制御を行う関係から、比較部104は、実際の命令実行数と目標値との比較だけでなく、次のような比較も行なう。すなわち、スレッド毎に、前回の監視周期において実際の実効命令数が実行されるべきであった命令数に足りなかった命令数(繰越命令数)が計算され、その繰越命令数と目標値とが加算されて繰越残値(つまり、現在の監視周期で実行されるべきである命令数)が計算され、その繰越残値と今回の実際の命令実行数とが比較される。   The execution instruction number monitoring unit 102 counts the number of execution instructions of each of a plurality of threads being processed in parallel for each fixed monitoring period. The comparison unit 104 compares the counted actual instruction execution count with a target value stored in advance for each thread. As will be described later, in this embodiment, the comparison unit 104 performs not only the comparison between the actual instruction execution number and the target value, but also the following comparison because of the control for performing state transition as described later. . That is, for each thread, the number of instructions (the number of carry-over instructions) in which the actual number of effective instructions should have been executed in the previous monitoring cycle is calculated, and the number of carry-over instructions and the target value are calculated. It is added to calculate the carry-over residual value (that is, the number of instructions to be executed in the current monitoring period), and the carry-over residual value is compared with the actual instruction execution number this time.

制御関数部106は、比較部104による比較の結果に基づいて、所定のフィードバック制御動作を行って、各スレッドの命令フェッチと命令発行の頻度を調節するための操作値を決定し、その操作値をパイプライン処理機構100に適用する。ここで、フィードバック制御動作には、PD制御やPID制御などを用いることも可能であるが、この実施形態では、後に図4を参照して説明されるような、状態遷移に従って操作値を制御する制御動作が採用される。操作値としては、後に図4を参照して説明されるような、スレッド毎に用意されたインフレーション値というパラメータが採用される。   The control function unit 106 performs a predetermined feedback control operation based on the comparison result by the comparison unit 104, determines an operation value for adjusting the frequency of instruction fetch and instruction issuance of each thread, and the operation value Is applied to the pipeline processing mechanism 100. Here, although PD control, PID control, or the like can be used for the feedback control operation, in this embodiment, the operation value is controlled according to the state transition as described later with reference to FIG. Control action is adopted. As the operation value, a parameter called an inflation value prepared for each thread as described later with reference to FIG. 4 is adopted.

制御関数部106から出力されるスレッド毎のインフレーション値は、パイプライン処理機構100中の命令フェッチと命令発行の頻度を制御するユニット、すなわち、この実施形態では図2に示されたフェッチスレッドセレクタ24および命令発行セレクタ32に与えられる。各スレッドのインフレーション値は、各スレッドの実行命令数と目標値および繰越残値との比較結果に応じて、制御関数部106により所定の可変レンジ内で漸次的に増減される。インフレーション値が増加すると命令フェッチや命令発行の頻度が増し、インフレーション値が低いと命令フェッチや命令発行の頻度が減少するように、フェッチスレッドセレクタ24および命令発行セレクタ32が、インフレーション値に応じて、優先度を用いた制御動作を調整する。例えば、或るスレッドのインフレーション値が増加すると、フェッチスレッドセレクタ24および命令発行セレクタ32は、それぞれ、そのスレッドより下位の優先度をもつスレッドの命令フェッチおよび命令発行の頻度を抑制し、その結果、そのスレッドの命令フェッチおよび命令発行の頻度が増える。逆に、例えば、或るスレッドのインフレーション値が減少すると、フェッチスレッドセレクタ24および命令発行セレクタ32は、それぞれ、そのスレッドより下位の優先度をもつスレッドの命令フェッチおよび命令発行の頻度を促進させ、その結果、そのスレッドの命令フェッチおよび命令発行の頻度が低下する。   The inflation value for each thread output from the control function unit 106 is a unit for controlling the frequency of instruction fetch and instruction issuance in the pipeline processing mechanism 100, that is, in this embodiment, the fetch thread selector 24 shown in FIG. And the instruction issue selector 32. The inflation value of each thread is gradually increased or decreased within a predetermined variable range by the control function unit 106 according to the comparison result between the number of instructions executed by each thread, the target value, and the carry-over residual value. As the inflation value increases, the frequency of instruction fetch and instruction issuance increases, and when the inflation value is low, the fetch thread selector 24 and the instruction issuance selector 32 reduce the frequency of instruction fetch and instruction issuance according to the inflation value. Adjust control actions using priorities. For example, when the inflation value of a thread increases, the fetch thread selector 24 and the instruction issue selector 32 suppress the frequency of instruction fetch and instruction issue of a thread having a lower priority than that thread, respectively. The frequency of instruction fetch and instruction issue of the thread is increased. Conversely, for example, when the inflation value of a thread decreases, the fetch thread selector 24 and the instruction issue selector 32 promote the frequency of instruction fetch and instruction issue of a thread having a lower priority than that thread, respectively. As a result, the frequency of instruction fetch and instruction issuance of the thread is reduced.

上述した構成をもつIPC制御機構は、それぞれのスレッドのIPCをある一定の監視周期PERIODで監視する。プログラマは、各スレッドのIPC目標値をipcとして、「PERIOD× ipc」の値を、各スレッドの実行命令数の設定値として各スレッドのIPC設定レジスタに書き込む。IPC制御機構は、いずれかのスレッドについて、設定値「PERIOD× ipc」が満たされていない状態が続いた場合、そのスレッドのインフレーション値を増加させる。   The IPC control mechanism having the above-described configuration monitors the IPC of each thread with a certain monitoring period PERIOD. The programmer writes the value of “PERIOD × ipc” in the IPC setting register of each thread as the setting value of the number of execution instructions of each thread, with the IPC target value of each thread as ipc. When a setting value “PERIOD × ipc” is not satisfied for any thread, the IPC control mechanism increases the inflation value of the thread.

IPC制御機構は、スレッド毎に、以下の値を保持し、インフレーション値を制御する。   The IPC control mechanism holds the following values for each thread and controls the inflation value.

ipc_target: 実行命令数の設定値、つまりPERIOD×ipc;
com_cnt: 今期実行命令数、すなわち現在の監視周期PERIODで実際に実行された命令数;
prev_com_cnt: 前期実行命令数、すなわち一つ前の監視周期PERIODで実際に実行された命令数;
carry_over: 繰越命令数、すなわち現在の監視周期PERIODで実行されるべき命令数であり、この値が現在の監視周期PERIODの終了時にゼロでなければ、この値は次の監視周期PERIODへと繰り越される;
stat_cnt: 現在の状態(後述する図4に示される各状態)に留まっている監視周期PERIODの回数。
ipc_target: Setting value for the number of instructions executed, that is, PERIOD x ipc;
com_cnt: Number of instructions executed this term, that is, the number of instructions actually executed in the current monitoring period PERIOD;
prev_com_cnt: Number of instructions executed in the previous period, that is, the number of instructions actually executed in the previous monitoring period PERIOD;
carry_over: Number of carry-over instructions, that is, the number of instructions to be executed in the current monitoring period PERIOD, and if this value is not zero at the end of the current monitoring period PERIOD, this value is carried over to the next monitoring period PERIOD ;
stat_cnt: The number of monitoring periods PERIOD remaining in the current state (each state shown in FIG. 4 described later).

ここで、繰越命令数carry_overの値は、監視周期PERIOD毎に更新され、
carry_over = carry_over + ipc_target-com_cnt
というように決められる。すなわち、或る監視周期PERIODにおいて繰越命令数carry_overで指定された数より少ない数の命令しか実行できなかった場合、不足命令数が繰越命令数carry_overとして次の監視周期PERIOD繰り越され、それにより、次の監視周期PERIODにおける繰越総命令数carry_overが増加する。逆に、或る監視周期PERIODにおいて繰越命令数carry_overで指定された数より多くの命令が実行された場合、次の監視周期PERIODでは、繰越命令数carry_overが減少する。なお、或る監視周期PERIODで今期実行命令数com_cntが繰越命令数carry_overを上回った場合、その監視周期PERIOD内では該当するスレッドの命令フェッチは行われなくなる。
Here, the value of the carry-over instruction carry_over is updated every monitoring period PERIOD.
carry_over = carry_over + ipc_target-com_cnt
It is decided as follows. That is, if only a smaller number of instructions can be executed than the number specified in the carry-over instruction carry_over in a certain monitoring period PERIOD, the insufficient instruction number is carried over to the next monitoring period PERIOD as the carry-over instruction number carry_over. Carry_over in the monitoring period PERIOD increases. Conversely, when more instructions are executed in a certain monitoring period PERIOD than the number specified in the carry-over instruction carry_over, the carry-over instruction number carry_over decreases in the next monitoring period PERIOD. If the number of instructions executed com_cnt in the current period exceeds the number of carry-over instructions carry_over in a certain monitoring period PERIOD, instruction fetch of the corresponding thread is not performed in the monitoring period PERIOD.

IPC制御機構の制御関数部106は、上述した値を用いて、図4に示される状態遷移を監視周期PERIOD毎に行い、インフレーション値を制御する。その詳細は、以下のとおりである.   The control function unit 106 of the IPC control mechanism performs the state transition shown in FIG. 4 for each monitoring period PERIOD using the above-described values, and controls the inflation value. The details are as follows.

図4は、制御関数部106の状態遷移とインフレーション値増減の動作を示す。   FIG. 4 shows the state transition of the control function unit 106 and the inflation value increase / decrease operation.

制御関数部106は、複数のスレッドのそれぞれについて並列的に、図4に示された動作を行う。   The control function unit 106 performs the operation shown in FIG. 4 in parallel for each of the plurality of threads.

図4において、「ノーマル」110は、今期実行命令数com_cntが設定値ipc_targetを満たしており、繰越命令数carry_overも満たしている状態であり、換言すれば、そのスレッドの性能が保証されている状態である。今まで状態が「ノーマル」110であったところ、現在の監視周期PERIODで実行した命令数が設定値ipc_targetの両方を満たせなかった場合、状態は「IPCフェイリング」112に遷移し、他方、繰越命令数carry_overのみを満たせなかった場合には、状態は「リクエストフェイリング」114に遷移する。また、ある回数以上の監視周期にわたり「ノーマル」110が続いた場合には、インフレーション値が減少され、その結果、そのスレッドの命令フェッチおよび命令発行の頻度が抑制される。   In FIG. 4, “normal” 110 is a state in which the current number of executed instructions com_cnt satisfies the set value ipc_target and the number of carry-over instructions carry_over, in other words, the performance of the thread is guaranteed. It is. If the status was “Normal” 110 until now, if the number of instructions executed in the current monitoring period PERIOD could not satisfy both of the set value ipc_target, the status transited to “IPC Failing” 112, while it was carried forward If only the instruction number carry_over cannot be satisfied, the state transitions to “request failing” 114. Further, when “normal” 110 continues over a certain number of monitoring cycles, the inflation value is decreased, and as a result, the frequency of instruction fetch and instruction issuance of the thread is suppressed.

「リクエストフェイリング」114は、今期実行命令数com_cntが設定値ipc_targetを満たしているが、繰越命令数carry_overを満たしていない状態である。つまり、短期的にはIPC目標値が満たされているが、それ以前の監視周期PERIODでIPC目標値が満たされなかったために、不足命令を余分に実行しなくてはならない状態である。この状態がある回数REQ_FAIL_THRESH以上の監視周期にわたり続く場合、インフレーション値が増加され、そして、状態は「リソースアップチェック」116に遷移する。他方、「リクエストフェイリング」114において、現在の実行命令数が繰越残値を満たした場合は、状態は「ノーマル」110へ遷移する。   “Request failing” 114 is a state in which the current number of executed instructions com_cnt satisfies the set value ipc_target but does not satisfy the number of carry-over instructions carry_over. In other words, the IPC target value is satisfied in the short term, but the IPC target value is not satisfied in the previous monitoring period PERIOD, so that the insufficient instruction must be executed extra. If this state lasts for a certain number of times REQ_FAIL_THRESH or more, the inflation value is increased and the state transitions to “resource up check” 116. On the other hand, in “request failing” 114, when the current number of executed instructions satisfies the carry-over residual value, the state transitions to “normal” 110.

「IPCフェイリング」112は、今期実行命令数com_cntが繰越命令数carry_overと設定値ipc_targetを共に満たしていない状態である。つまり、短期的にも長期的にもIPC目標値が満たされていない状態である。この状態がある回数IPC_FAIL_THRESH以上の監視周期にわたり続く場合、インフレーション値が増加させられ、状態は「リソースアップチェック」116に遷移する。他方、「IPCフェイリング」112において、繰越命令数carry_overと設定値ipc_targetが共に満たされた場合は、状態は「ノーマル」110に遷移する。   “IPC failing” 112 is a state in which the current number of executed instructions com_cnt does not satisfy both the carry-over instruction number carry_over and the set value ipc_target. In other words, the IPC target value is not met in the short and long term. If this state continues for a certain number of times IPC_FAIL_THRESH or longer, the inflation value is increased and the state transitions to “resource up check” 116. On the other hand, in “IPC failing” 112, when both the carry-over instruction number carry_over and the set value ipc_target are satisfied, the state transitions to “normal” 110.

「リソースアップチェック」116は、インフレーション値を増加させた後、インフレーション値の増加に見合うIPCの向上があったかどうかをチェックするための状態である。この状態において、前期実行命令数prev_com_cntと比較した今期実行命令数com_cntの増分が、予め設定された閾値EFFICIENT_THRESH以上であるが、まだ繰越命令数carry_overが満たされていない場合は、インフレーション値がさらに増加される。他方、繰越命令数carry_overが満たされた場合は、状態は「ノーマル」110に遷移する。また、「リソースアップチェック」116において、上記増分が上記閾値EFFICIENT_THRESH未満である場合は、インフレーション値は減少させられ、状態は「リソースダウン」118に遷移する。   The “resource up check” 116 is a state for checking whether or not there has been an improvement in IPC commensurate with the increase in the inflation value after the inflation value has been increased. In this state, if the increment of the current execution instruction number com_cnt compared to the previous execution instruction number prev_com_cnt is greater than or equal to the preset threshold EFFICIENT_THRESH, but the carry-over instruction number carry_over is not yet satisfied, the inflation value further increases. Is done. On the other hand, when the number of carry-over instructions carry_over is satisfied, the state transitions to “normal” 110. Further, in the “resource up check” 116, when the increment is less than the threshold value EFFICIENT_THRESH, the inflation value is decreased and the state transitions to “resource down” 118.

「リソースダウン」118は、インフレーション値の増加に見合ったIPCの向上が認められなかった場合に相当する状態である。この状態に入ると、インフレーション値が減少させられ、状態は「リソースダウンチェック」120に遷移する。   “Resource down” 118 is a state corresponding to a case where an improvement in IPC commensurate with an increase in inflation value is not recognized. When entering this state, the inflation value is decreased and the state transitions to “resource down check” 120.

「リソースダウンチェック」120は、インフレーション値を減少させた後、IPCが大幅に低下していないかどうかをチェックするための状態である。この状態において、前期実行命令数prev_com_cntと比較して、今期実行命令数com_cntの予め設定された閾値以上に低下した場合、インフレーション値は一周期前の値に戻される。そうでない場合は、インフレーション値は現在の値に維持される。状態は「ノーマル」110、「IPCフェイリング」112または「リクエストフェイリング」114に遷移する。状態が「ノーマル」110と「IPCフェイリング」112と「リクエストフェイリング」114のいずれに遷移するかは、今期実行命令数com_cntと設定値ipc_targetおよび繰越命令数carry_overとの比較結果により決まる。   The “resource down check” 120 is a state for checking whether or not the IPC has significantly decreased after the inflation value is decreased. In this state, when the number of execution instructions com_cnt in the current period falls below a preset threshold value compared to the number of execution instructions prev_com_cnt in the previous period, the inflation value is returned to the value one cycle before. Otherwise, the inflation value is maintained at the current value. The state transitions to “normal” 110, “IPC failing” 112, or “request failing” 114. Whether the state transitions to “normal” 110, “IPC failing” 112, or “request failing” 114 is determined by a comparison result between the current execution instruction number com_cnt, the set value ipc_target, and the carry-over instruction number carry_over.

以上のように、各スレッドについて、IPCが所望値を満たせていない状態が続くと、インフレーション値が増加させられる。ただし、インフレーション値を増加した場合であっても、その増加に見合ったIPCの向上が得られない場合は、インフレーション値を元に戻す。その理由は、プログラムの最大性能が時間と共に変化することに対応するためである。すなわち、プログラムのIPCは時間と共に変化するため,ある監視周期PERIODではIPC目標値を満たせない場合がある。そのような場合にインフレーション値を増加させても無意味であり、他スレッドの実行が阻害されるだけである。そこで、インフレーション値を増加させてもその増加に見合ったIPCの向上が生じない場合には、将来の監視周期PERIODで取り返しがつくことが期待できるので、インフレーション値の増加を取り消す。不足命令数は繰越命令数carry_overに加算される。将来プログラムのIPCが向上しやすくなった時点でインフレーション値を増加させることで、その不足命令数が解消されることになる。   As described above, if the state where the IPC does not satisfy the desired value continues for each thread, the inflation value is increased. However, even if the inflation value is increased, if the IPC improvement corresponding to the increase cannot be obtained, the inflation value is restored. The reason is to cope with the fact that the maximum performance of the program changes with time. In other words, since the IPC of the program changes with time, the IPC target value may not be satisfied in a certain monitoring period PERIOD. In such a case, increasing the inflation value is meaningless and only the execution of other threads is hindered. Therefore, if an increase in the inflation value does not improve the IPC corresponding to the increase, it can be expected to recover in the future monitoring period PERIOD, so the increase in the inflation value is cancelled. The number of insufficient instructions is added to the carry-over instruction number carry_over. By increasing the inflation value when the IPC of the program becomes easier to improve in the future, the number of insufficient instructions will be eliminated.

上記のIPC制御により、性能の変動が激しいプログラムにおいても、他スレッドの実行を著しく阻害することなく、特定のスレッドの性能を制御することができる。各スレッドのIPCが所望値近くに制御されることになるので、各スレッドの実行時間の予測の精度が向上する。その結果、実時間処理において、複数スレッドを並列に実行していても時間制約を守ることができるようなスケジューリングが容易になる。   With the above IPC control, the performance of a specific thread can be controlled without significantly impeding the execution of other threads, even in a program whose performance varies greatly. Since the IPC of each thread is controlled to be close to a desired value, the accuracy of predicting the execution time of each thread is improved. As a result, in real-time processing, it is easy to schedule such that time constraints can be observed even when a plurality of threads are executed in parallel.

図5は、上述した優先度による調停を行なうマルチスレッドプロセッサを用いて実時間処理を行った場合の例を示す。なお、図5の例では、説明の都合上、上述したプロセッサ10のような複数スレッドを同時処理できるSMTプロセッサではなく、同時処理できるスレッドは1つのみであるシングルパイプラインのマルチスレッドプロセッサを用いた場合であって、理想的な実行(キャッシュミスや分岐予測ミスが発生しない)の場合を想定する。   FIG. 5 shows an example in which real-time processing is performed using a multi-thread processor that performs arbitration based on the above-described priority. In the example of FIG. 5, for convenience of explanation, a single pipeline multi-thread processor having only one thread that can be simultaneously processed is used instead of the SMT processor that can simultaneously process a plurality of threads such as the processor 10 described above. In this case, an ideal execution (no cache miss or branch prediction miss occurs) is assumed.

図5に示される例では、スレッド#0の優先度が最も高く、スレッド#7の優先度が最も低いとする。この例では、最初にスレッド#1、スレッド#2およびスレッド#3が実行可能になる。ここで、優先度による資源の調停を行なわない従来のマルチスレッドプロセッサでは、スレッド#1、スレッド#2およびスレッド#3が並列的に実行されることになる。これに対し、優先度による資源の調停を行なうマルチスレッドプロセッサでは、優先度による演算資源の調停により、原則として、最も優先度の高いスレッド#1の実行が優先される。そのためスレッド#1が先に実行される。スレッド#1の実行が完了すると、優先度による調停により、次に優先度の高いスレッド#2が優先的に実行される。このとき、スレッド#2のコンテキストがプロセッサ内に保持されているため、スレッド#2はコンテキストスイッチを行うことなく直ちに実行される。スレッド#4の実行中に、より優先度の高いスレッド#0が実行可能になった場合においても、優先度による演算資源の調停によりスレッド#0の実行が優先される。このときも、スレッド#0はコンテキストスイッチを行うことなく直ちに実行される。スレッド#0の実行が完了すると、次にスレッド#4に演算資源が割り当てられて、スレッド#4が直ちに実行を再開する。   In the example shown in FIG. 5, it is assumed that thread # 0 has the highest priority and thread # 7 has the lowest priority. In this example, first, thread # 1, thread # 2, and thread # 3 become executable. Here, in a conventional multi-thread processor that does not perform resource arbitration according to priority, thread # 1, thread # 2, and thread # 3 are executed in parallel. On the other hand, in a multi-thread processor that arbitrates resources according to priority, in principle, execution of thread # 1 with the highest priority is given priority due to arbitration of computing resources according to priority. Therefore, thread # 1 is executed first. When the execution of the thread # 1 is completed, the thread # 2 having the next highest priority is preferentially executed by arbitration based on the priority. At this time, since the context of the thread # 2 is held in the processor, the thread # 2 is immediately executed without performing a context switch. Even when thread # 0 having a higher priority becomes executable during execution of thread # 4, execution of thread # 0 is given priority due to arbitration of computing resources by priority. Also at this time, thread # 0 is immediately executed without performing a context switch. When the execution of the thread # 0 is completed, a computing resource is allocated to the thread # 4, and the thread # 4 immediately resumes execution.

マルチスレッドプロセッサは、一般に1つのスレッドがキャッシュミスなどでストールしている場合でも、別のスレッドを実行することにより、プロセッサ全体のスループットを高く維持できる。この側面に関して、本発明に従うマルチスレッドプロセッサでは、優先度の高いスレッドがストールした場合、次に優先度の高いスレッドを実行するように、優先度による調停を行うことができ、それにより、スループットを向上することが可能である。   In general, even when one thread is stalled due to a cache miss or the like, a multi-thread processor can maintain a high throughput of the entire processor by executing another thread. With respect to this aspect, in the multi-thread processor according to the present invention, when a high-priority thread stalls, arbitration by priority can be performed so that the next highest-priority thread is executed, thereby reducing throughput. It is possible to improve.

図6は、優先度による調停と共にIPC制御を行なうマルチスレッドプロセッサより複数スレッドの同時実行を行った場合の例を示す。図6の例は、同時処理できるスレッドが1つのみのシングルパイプラインのマルチスレッドプロセッサの実際の実行(キャッシュミスや分岐予測ミスが発生する)場合を示している。   FIG. 6 shows an example of a case where a plurality of threads are simultaneously executed by a multithread processor that performs IPC control together with arbitration by priority. The example of FIG. 6 shows a case where a single pipeline multi-thread processor with only one thread that can be simultaneously processed is actually executed (a cache miss or a branch prediction miss occurs).

図6に示した例でも、図5に示した例と同様に、スレッド#0の優先度が最も高く、スレッド#7の優先度が最も低く、最初にスレッド#1、スレッド#2およびスレッド#3が実行可能になる。優先度による演算資源の調停により、実行可能なスレッド#1、スレッド#2およびスレッド#3中で最も優先度の高いスレッド#1の実行が優先される。上述の図5に例示された理想的な実行の場合、キャッシュミスや分岐予測ミスが発生しないため、優先度に従って順番にスレッドが実行される。この理想的な場合では、スレッド間の干渉がないため、IPCの変化はない。これに対し、図6に例示される実際の実行の場合、キャッシュミスや分岐予測ミスなどが発生することがある。例えばスレッド#1がこの種のミスでストールすると、次に優先度の高いスレッド#2が実行される。スレッド#2のコンテキストはプロセッサ内に保持されているため、コンテキストスイッチを行うことなく直ちにスレッド#2を実行することができる。このため、見かけ上「スレッド#1とスレッド#2が(或いは、より多くのスレッドが)同時並列的に実行される」ことになる。スレッド#2は演算資源を使用するため、優先度のより高いスレッド#1の実行時間に影響を与える。そのため、スレッド間の干渉が発生し、IPCの変化が発生する。IPC制御を採用しない場合には、スレッド#1の時間予測精度が低下する。これに対して、IPC制御を採用することにより、同時に実行されている各スレッド#1、#2の実行命令数(IPC)をそれぞれの目標値に近づけるように、各スレッド#1、#2の実行の頻度が制御される。よって、複数スレッドを同時実行した場合でも、時間予測精度の低下は小さい。そのため、時間制約を守りつつ、プロセッサ全体のスループットを向上することが可能となる。   Also in the example shown in FIG. 6, as in the example shown in FIG. 5, thread # 0 has the highest priority and thread # 7 has the lowest priority. First, thread # 1, thread # 2, and thread # 3 becomes executable. Due to the arbitration of computing resources by priority, execution of the thread # 1 having the highest priority among the executable thread # 1, thread # 2, and thread # 3 is given priority. In the case of the ideal execution illustrated in FIG. 5 described above, since no cache miss or branch prediction miss occurs, threads are executed in order according to priority. In this ideal case, there is no IPC change because there is no interference between threads. On the other hand, in the actual execution illustrated in FIG. 6, a cache miss or a branch prediction miss may occur. For example, when thread # 1 stalls due to this type of mistake, thread # 2 with the next highest priority is executed. Since the context of the thread # 2 is held in the processor, the thread # 2 can be immediately executed without performing a context switch. For this reason, it appears that “thread # 1 and thread # 2 (or more threads) are executed simultaneously in parallel”. Since thread # 2 uses computational resources, it affects the execution time of thread # 1, which has a higher priority. For this reason, interference between threads occurs, and IPC changes occur. When IPC control is not adopted, the time prediction accuracy of thread # 1 is lowered. On the other hand, by adopting IPC control, the number of instructions executed (IPC) of each thread # 1 and # 2 being executed simultaneously is brought closer to the target value of each thread # 1 and # 2. The frequency of execution is controlled. Therefore, even when a plurality of threads are executed simultaneously, the decrease in time prediction accuracy is small. Therefore, it is possible to improve the throughput of the entire processor while keeping time constraints.

図5と図6は、理解を容易にするするために、シングルパイプラインのプロセッサの場合を例示した。しかし、同様の説明は、図2に示したような複数のスレッドを同時処理できるSMTプロセッサにも適用される。図7は、図2に示した4パイプラインをもち優先度による調停と共にIPC制御を行なうSMTプロセッサより複数スレッドの同時実行(実際の実行)を行った場合の例を示す。   5 and 6 exemplify the case of a single pipeline processor for easy understanding. However, the same description applies to an SMT processor that can simultaneously process a plurality of threads as shown in FIG. FIG. 7 shows an example in which a plurality of threads are simultaneously executed (actual execution) by an SMT processor having the four pipelines shown in FIG.

図7に示すように、マルチパイプラインのSMTプロセッサでは、より多くの数のスレッドが、見かけ上、同時並列的に実行される。同時並列的に実行されるスレッドの数が多いほど、スレッド間の資源の競合が発生する頻度が多くなり、各スレッドについての時間予測精度がより低下する。故に、IPC制御の採用による時間予測精度の低下を抑制できる利点は大きい。   As shown in FIG. 7, in a multi-pipeline SMT processor, a larger number of threads seem to be executed concurrently in parallel. The greater the number of threads that are executed in parallel, the more frequently the resource contention between threads occurs, and the time prediction accuracy for each thread is further reduced. Therefore, there is a great advantage that the decrease in time prediction accuracy due to the adoption of IPC control can be suppressed.

さて、以下では、図2に示したSMTアーキテクチャを採用したプロセッサ10における、優先度による資源調停とIPC制御のより具体的で詳細な制御方法を説明する。   Now, a more specific and detailed control method of resource arbitration by priority and IPC control in the processor 10 employing the SMT architecture shown in FIG. 2 will be described below.

まず、優先度による資源調停の制御方法を説明する。   First, a resource arbitration control method based on priority will be described.

この制御は、複数のスレッドを同時に実行する場合における、命令フェッチスロット、命令発行スロット、演算ユニットなどの各演算資源におけるスレッド間の競合を調停し解決するものである。そこでは、スケジューラが付与した優先度を、スレッド間の競合解決のために使用する。プロセッサ10内で生じるスレッド間の競合解決に優先度を用いることで、優先度の低いスレッドが優先度の高いスレッドの実行を阻害することを防ぎ、優先度の高いスレッドの実行を保証する。ただし、優先度を単純に全ての競合処理に導入すると、システム全体の性能が低下してしまい、マルチスレッドによるレイテンシの隠蔽の効果を得ることができない。そこで、優先度の高いスレッドの性能を低下させずに、優先度の低いスレッドを実行する機構が採用される。SMTアーキテクチャは、スーパースカラアーキテクチャを採用するので、単一スレッドの性能が通常のシングルパイプラインと比較して高い。ただし、単一スレッドの性能をできるだけ高くするには、実行資源をスレッド間で共有化し、全ての実行資源を一つのスレッドが利用できるようにする必要がある。実行資源を共有化すると、単一のスレッドの性能の向上が期待できるが、スレッド間で性能に影響を与えやすくなるので、優先度の低いスレッドが優先度の高いスレッドの性能に悪影響を与えてしまう。その対策として、フェッチスロットや発行スロットといったスロットの優先度制御に加え、共有資源の占有率の制御も実装することができる。また、フェッチスレッド選択でのボトルネックをできるだけ回避し、命令供給機構全体を制御するような制御方法が採用される。その際、ソフトリアルタイムタスクとハードリアルタイムタスクの性質の違いに着目し、単一スレッドの性能に大きく比重を置く制御方法と、単一スレッドの性能の低下を抑制しつつ全体の性能に比重を置く制御方法とを実装することができる。   This control mediates and resolves competition among threads in each operation resource such as an instruction fetch slot, instruction issue slot, and operation unit when a plurality of threads are executed simultaneously. In this case, the priority assigned by the scheduler is used to resolve the conflict between threads. By using the priority for the conflict resolution between threads generated in the processor 10, it is possible to prevent the low priority thread from obstructing the execution of the high priority thread and to guarantee the execution of the high priority thread. However, if the priority is simply introduced to all the competing processes, the performance of the entire system is lowered, and the latency concealment effect by multithread cannot be obtained. Therefore, a mechanism for executing a low priority thread without degrading the performance of a high priority thread is adopted. Since the SMT architecture adopts a superscalar architecture, the performance of a single thread is higher than that of a normal single pipeline. However, in order to increase the performance of a single thread as much as possible, it is necessary to share execution resources among threads so that all execution resources can be used by one thread. Sharing execution resources can be expected to improve the performance of a single thread, but it tends to affect performance between threads, so low-priority threads adversely affect the performance of high-priority threads. End up. As countermeasures, in addition to slot priority control such as fetch slots and issue slots, control of shared resource occupancy can also be implemented. Also, a control method is adopted in which a bottleneck in fetch thread selection is avoided as much as possible and the entire instruction supply mechanism is controlled. At that time, paying attention to the difference between the properties of the soft real-time task and the hard real-time task, a control method that places a large weight on the performance of a single thread, and a weight on the overall performance while suppressing a decrease in the performance of a single thread A control method can be implemented.

フェッチスレッド選択では、最上位優先度スレッドの性能低下をできるだけ抑制しつつ、他のスレッドのフェッチを行うことができる制御方法を採用することができる。最上位優先度スレッドの性能低下をできるだけ抑えることに主眼を置く場合、所定の状況下で最上位優先度スレッドにより無駄にされる(使用されない)スロットを、他の下位優先度スレッドが使用することで、ある程度のシステム全体の性能向上が期待できる。そのような制御方法として次のものを挙げることができる。   In fetch thread selection, it is possible to adopt a control method that can fetch other threads while suppressing the performance degradation of the highest priority thread as much as possible. When focusing on minimizing the performance degradation of the highest priority thread as much as possible, other lower priority threads use slots that are wasted (not used) by the highest priority thread under certain circumstances. Therefore, it can be expected that the performance of the entire system will be improved to some extent. The following can be mentioned as such a control method.

(1) 命令フェッチでのキャッシュミス
キャッシュミスした後に同じスレッドが命令フェッチを行うことはハードウェアを不必要に複雑化するのみである。キャッシュから命令が返ってくるまでは他のスレッドがフェッチを行う。
(1) Cache miss in instruction fetch The same thread fetching an instruction after a cache miss only unnecessarily complicates the hardware. Another thread fetches until an instruction returns from the cache.

(2) 分岐予測ミスからの回復
分岐予測ミスによるパイプライン中の命令の破棄はその分岐命令のコミット時に行われる。分岐命令がライトバックされたときにはその予測の成否がわかるので、もし予測ミスしていた場合にはそれ以後のフェッチは無駄になる。そこでライトバックした分岐命令が予測ミスしていた場合には、その命令がコミットするまで他のスレッドからフェッチを行う。
(2) Recovery from a branch misprediction The instruction in the pipeline is discarded due to a branch misprediction when the branch instruction is committed. When the branch instruction is written back, the success or failure of the prediction is known, so if there is a misprediction, subsequent fetches are wasted. Therefore, when the branch instruction written back has a misprediction, fetch is performed from another thread until the instruction is committed.

(3) 命令バッファ中の命令数
最上位優先度スレッドの性能を落さないためには、実行機構への発行を可能な限り絶やさない必要がある。そのためには、命令バッファ中に常に命令が格納されている必要がある。図2に示したプロセッサ10の場合、命令発行まで5ステージあるので、スレッド選択の際に最上位優先度スレッドの命令が命令バッファ30内に6クロック分あれば、そのクロックに他のスレッドからフェッチを行ったとしても命令バッファ中の命令が不足することはない。4命令の同時発行のため、24命令が命令バッファ30内に存在する場合に、優先度の低いスレッドからフェッチを行う。ただし次に最上位優先度スレッドがフェッチした命令中にいくつの有効な命令があるかはこの時点では不明であるのに加え、次の命令フェッチがキャッシュミスを起こす可能性があるので、それを考慮にいれると、さらに命令数を増やした方が性能の低下は防げる。
(3) Number of instructions in the instruction buffer In order not to degrade the performance of the highest priority thread, it is necessary to keep issuing to the execution mechanism as much as possible. For this purpose, it is necessary to always store an instruction in the instruction buffer. In the case of the processor 10 shown in FIG. 2, since there are five stages until the instruction issuance, if there are 6 clock instructions in the instruction buffer 30 in the instruction buffer 30 at the time of thread selection, fetch from other threads at that clock Even if the operation is performed, there is no shortage of instructions in the instruction buffer. Since 24 instructions are present in the instruction buffer 30 because 4 instructions are issued simultaneously, fetching is performed from a thread having a low priority. However, the number of valid instructions among the instructions fetched by the next highest priority thread is unknown at this point, and the next instruction fetch may cause a cache miss. If you take this into account, you can prevent performance degradation by increasing the number of instructions.

以上の3つの制御方法は、最上位優先度スレッドが無駄にするスロットを使用して下位優先度スレッドの命令を格納するという方法である。それに対し、優先度の高いスレッドが実行資源を非効率的に使うと予測して、優先度の低いスレッドのフェッチを行うという制御方法も採用し得る。その例を以下に挙げる。   The above three control methods are methods in which the instructions of the lower priority thread are stored using the slots that the highest priority thread wastes. On the other hand, it is also possible to employ a control method in which a thread with a low priority is predicted to use an execution resource inefficiently and a thread with a low priority is fetched. Examples are given below.

(1) パイプライン中の条件分岐命令数
条件分岐命令を多く実行するほど分岐予測ミスの可能性が高くなり、実行資源を無駄にする可能性が高くなる。そのため、パイプライン中の条件分岐命令の数が閾値を越えた場合に優先度の低いスレッドからフェッチを行う。
(1) Number of conditional branch instructions in the pipeline The more conditional branch instructions are executed, the higher the possibility of branch misprediction and the higher the possibility of wasting execution resources. Therefore, when the number of conditional branch instructions in the pipeline exceeds the threshold value, fetching is performed from a thread having a low priority.

(2) パイプライン中の命令数
パイプライン中に命令数が多くなると、それが依存するデータを待つ命令が多くなり、実行スロットを埋めることが難しくなる。特に単一のスレッドの命令数が多くなったときに、この現象は顕著になる。そのため、パイプライン中の命令数が閾値を越えた場合に優先度の低いスレッドからフェッチを行う。
(2) Number of instructions in the pipeline As the number of instructions in the pipeline increases, more instructions wait for the data on which they depend, making it difficult to fill the execution slot. This phenomenon is particularly noticeable when the number of instructions in a single thread increases. For this reason, when the number of instructions in the pipeline exceeds a threshold, fetching is performed from a thread with a low priority.

(3) 命令バッファ中の命令数
前述した制御方法では、常に最大限命令が発行されると仮定したが、リザベーションステーション60などの問題で最大限命令を発行できないことがある。そこで、閾値を上述した24命令よりも低く設定する。閾値が低い程、優先度の高いスレッドの性能が落ちると考えられる。
(3) Number of instructions in the instruction buffer In the control method described above, it is assumed that the maximum number of instructions is always issued. However, the maximum number of instructions may not be issued due to a problem such as the reservation station 60. Therefore, the threshold value is set lower than the above-described 24 instructions. It is considered that the lower the threshold value, the lower the performance of the high priority thread.

(4) フェッチ制御ユニット内の占めているステージ数
デコード時に用いられる分岐予測器と比較して、BTB(Branch Target Buffer: 分岐ターゲットバッファ、図示省略)は分岐命令があるかどうかという情報がない分、予測精度が大きく劣る。そのため、BTBによる投機フェッチ数を制限する。フェッチ制御パイプライン中のステージ数によって制御することで、連続するフェッチ回数を抑える。
(4) Number of stages occupied in the fetch control unit Compared with the branch predictor used for decoding, BTB (Branch Target Buffer, not shown) has no information on whether there is a branch instruction. The prediction accuracy is greatly inferior. Therefore, the speculative fetch number by BTB is limited. By controlling the number of stages in the fetch control pipeline, the number of consecutive fetches is suppressed.

(5) リザベーションステーション内の待ち命令数
使われる実行ユニットに偏りがある場合や、命令間に強い依存関係がある場合、パイプライン中の命令数による制御ではリザベーションステーション60を一杯にしてしまう可能性がある。そこで、リザベーションステーション60内の命令数を数え、閾値を越えた場合に優先度の低いスレッドからフェッチを行う。
(5) Number of waiting instructions in the reservation station If there is a bias in the execution units used or if there is a strong dependency relationship between the instructions, there is a possibility that the reservation station 60 will be filled with control by the number of instructions in the pipeline. There is. Therefore, the number of instructions in the reservation station 60 is counted, and when the threshold is exceeded, fetching is performed from a thread having a low priority.

以上の5つの制御方法は、システム全体の性能を向上させることを重視している。   The above five control methods place emphasis on improving the performance of the entire system.

さて、発行命令選択では、命令実行ユニット16に直接命令を供給するために、命令フェッチ機構から十分な命令が来ている場合には、スレッドの性能に大きな影響を及ぼすと考えられる。そこで、優先度の高いスレッドの性能の低下を抑制するために、命令発行機構では発行できる限り優先度の高いスレッドの命令を発行する。優先度による発行命令選択ではフェッチスレッド選択と同様に、次のような方法で優先度の低いスレッドの命令を発行する。   In the issue instruction selection, it is considered that if the instruction fetch mechanism has enough instructions to directly supply an instruction to the instruction execution unit 16, the performance of the thread is greatly affected. Therefore, in order to suppress a decrease in the performance of a high-priority thread, the instruction issue mechanism issues an instruction of a thread with a high priority as much as possible. In the issue instruction selection by priority, similarly to the fetch thread selection, an instruction of a thread with a low priority is issued by the following method.

(1) 対象のリザベーションステーションが一杯の場合
優先度の低いスレッドの命令に他のリザベーションステーションを利用する命令が含まれている場合はその命令を発行する。
(1) When the target reservation station is full If the instruction of a thread with a low priority includes an instruction that uses another reservation station, that instruction is issued.

(2) リオーダバッファやリネームレジスタが一杯の場合
これらの実行資源をスレッド毎に所持している場合は他のスレッドの命令を発行する。
(2) When the reorder buffer and rename register are full: When these execution resources are owned by each thread, issue instructions from other threads.

(3) 投機実行が禁止されている命令の場合
コントロールレジスタへの書き込み命令のように、投機実行が禁止されている命令の場合はその命令より前の命令が全てコミットされない限り命令発行を止める。
(3) In the case of an instruction for which speculative execution is prohibited In the case of an instruction for which speculative execution is prohibited, such as an instruction for writing to the control register, the instruction issuance is stopped unless all instructions before that instruction are committed.

(4) 分岐予測ミスからの回復の場合
フェッチスレッド選択と同様に、ライトバックされた分岐命令が予測ミスをしていた場合にその命令がコミットするまで命令発行を止める。
(4) When recovering from a branch misprediction As with fetch thread selection, if a branch instruction that has been written back has made a misprediction, it stops issuing instructions until the instruction commits.

対象のリザベーションステーション60が一杯の場合は、優先度の高いスレッドと低いスレッドの利用するユニットがそれぞれ偏っていてなおかつ異なる場合でない限り、優先度の低いスレッドから多くの命令を発行できるわけではない。また、リオーダバッファ40やリネームレジスタ34をスレッド間で共有する構成にした場合には、優先度の低いスレッドからの命令発行は行うことが出来なく、投機実行が禁止されている命令は通常のプログラムにおいては頻度が低い。つまり、キャッシュミスが起こり得るフェッチスレッド選択と比較して、優先度の低いスレッドの命令が発行される可能性が低い。複数スレッドの並列実行によるレイテンシの隠蔽には、更なる制御方法が採用される。さらに、システム全体の性能に重きを置き、次のパラメータ、
・パイプライン中の条件分岐命令数
・パイプライン中の命令数
・リザベーションステーション内の待ち命令数
を参照して優先度の高いスレッドの命令発行を止める。
When the target reservation station 60 is full, many instructions cannot be issued from a low-priority thread unless the units used by the high-priority thread and the low-priority thread are biased and different. In addition, when the reorder buffer 40 and the rename register 34 are configured to be shared among threads, it is impossible to issue an instruction from a thread having a low priority, and an instruction whose speculative execution is prohibited is a normal program. Is less frequent. That is, there is a low possibility that an instruction of a thread with a low priority is issued as compared with fetch thread selection in which a cache miss may occur. A further control method is adopted for hiding latency by parallel execution of multiple threads. Furthermore, emphasis is placed on the overall system performance, the following parameters:
-Number of conditional branch instructions in the pipeline-Number of instructions in the pipeline-Refer to the number of waiting instructions in the reservation station and stop issuing instructions from threads with high priority.

以上、命令フェッチ、発行といったパイプライン中のスロットに関する競合を解決する制御方法について述べた。それに加え、SMTアーキテクチャでは複数スレッドで実行資源が共有されるため、その競合制御についても考慮にいれる必要がある。ここでいう実行資源とは、典型的には、
・命令バッファ30
・リネームレジスタ34
・リオーダバッファ40
などを指す。これらの実行資源は、スレッドごとに用意されるか、または共有化されるかの2通りの実装方法がある。
The control method for resolving contention related to slots in the pipeline such as instruction fetch and issue has been described above. In addition, in the SMT architecture, execution resources are shared by multiple threads, so it is necessary to consider the contention control. The execution resource here is typically
Instruction buffer 30
・ Rename register 34
Reorder buffer 40
And so on. These execution resources are provided in two ways: prepared for each thread or shared.

実行資源がスレッドごとに用意される場合、スレッド間の影響を低く抑えることが可能である。或るスレッドがストールしても、他のスレッドは容易に実行できる。しかし、一つのスレッドが使える量が小さく抑えられるので、単一のスレッドの性能が低くなる。一方、実行資源がスレッド間で共有された場合、単一のスレッドを優先して実行した場合に、実行資源を十分に利用できるので性能が高くなる。しかしスレッド間の影響が大きくなるため、低い優先度のスレッドが高い優先度のスレッドを阻害してしまう。またスレッドがストールしたときに他のスレッドが実行できないことがある。   When execution resources are prepared for each thread, it is possible to keep the influence between threads low. Even if one thread is stalled, other threads can be easily executed. However, since the amount of one thread that can be used is kept small, the performance of a single thread is lowered. On the other hand, when an execution resource is shared among threads, when a single thread is preferentially executed, the execution resource can be used sufficiently, and the performance is improved. However, since the influence between threads becomes large, a low-priority thread inhibits a high-priority thread. Also, when a thread stalls, other threads may not execute.

このようにスレッド間の影響を考えると、スレッド毎に実行資源を用意する方法の方が好ましいが、チップサイズの制限があるのでスレッドあたりの資源の量は小さく抑えられてしまう。そのため、優先度の高いスレッドの性能が低くなるので、ソフトリアルタイム処理に耐え得る高い性能という面で問題がある。そこで、図2に示されたプロセッサ10では、実行資源を共有化することで、単一のスレッドの性能向上を目指す。   Considering the influence between threads in this way, the method of preparing execution resources for each thread is preferable, but the amount of resources per thread can be kept small because of the chip size limitation. For this reason, the performance of threads with high priority is lowered, and there is a problem in terms of high performance that can withstand soft real-time processing. Therefore, the processor 10 shown in FIG. 2 aims to improve the performance of a single thread by sharing execution resources.

各バッファをパーティション化(幾つかの単位に分割)することにより、ハードウェアの複雑化を防ぐことができる。一つのパーティションを単一のスレッドのみが使用するように設計することで、スレッドごとにパーティションの使用順番とパーティション内の現在位置だけ記憶しておけば良いので、ハードウェアが単純になる。   By partitioning each buffer (dividing it into several units), hardware complexity can be prevented. By designing one partition to be used only by a single thread, it is only necessary to store the order of use of the partition and the current position in the partition for each thread, thereby simplifying the hardware.

各バッファを共有することで、優先度の低いスレッドがバッファを占有することにより優先度の高いスレッドの実行を阻害してしまう。そこで、共有バッファにおけるスレッド間の性能に対する影響を抑えるために、各スレッドが使用できるバッファのエントリ数をソフトウェアによりパーティション単位で設定する。これに関し、次の2通りの制御方法が採用できる。   By sharing each buffer, a thread having a low priority occupies the buffer, thereby hindering execution of a thread having a high priority. Therefore, in order to suppress the influence on the performance between threads in the shared buffer, the number of buffer entries that can be used by each thread is set by software in units of partitions. In this regard, the following two control methods can be employed.

(1) 資源予約
制御レジスタを用いてスレッド毎にパーティション使用権を設定する。同じパーティションを複数のスレッドが利用することができる。
(1) Resource reservation Set partition usage rights for each thread using the control register. The same partition can be used by multiple threads.

(2) 最大数設定
制御レジスタを用いてスレッド毎に使用できる最大のパーティション数を設定する。
(2) Maximum number setting Set the maximum number of partitions that can be used for each thread using the control register.

資源予約方式では、スレッド毎に利用できる資源を個別に指定できるので、安定した性能が期待できるが、周期タスクが実行を終え、次の周期を待っている場合など、スレッドが実行できない場合に対応がしづらく、実行資源を有効に使うことができない。最大数設定方式では、他のスロットの制御を優先度制御で行っているために、優先度の高いスレッドから指定された最大限の量まで実行資源を利用することができ、状況に応じて最大限に実行資源を利用しやすい。ただし、各スレッドの最大数の合計がパーティション総数を上回っている場合には、優先度の低いスレッドが優先度の高いスレッドの実行を阻害してしまう。資源予約方式は静的に性能の予測ができ、最大数設定方式は、動的に実行資源の利用の効率化を計ることができる。しかし、これらの制御方法のみでは最上位優先度スレッドの性能を維持することは難しい。例えば優先度の高いスレッドがスケジューリング可能な状態になり、最上位優先度スレッドが切り替わる場合には、それまで実行されていた優先度の低いスレッドが実行資源を占有しており、優先度の高いスレッドの実行が阻害されてしまう。そこで、優先度の高いスレッドの命令が格納されているパーティションの数が閾値以下で、空きパーティションがない場合に、現在その資源を利用しているスレッドの中から最も優先度の低いスレッドの命令を破棄する。命令バッファ30の場合ではそのスレッドの先頭の命令からフェッチし直し、リオーダバッファ40では分岐予測ミスの場合と同様の機構を用いてパイプライン中の命令を破棄する。   In the resource reservation method, the resources that can be used for each thread can be specified individually, so stable performance can be expected, but it corresponds to the case where the thread cannot be executed, such as when the periodic task finishes executing and waits for the next period It is difficult to use execution resources effectively. In the maximum number setting method, other slots are controlled by priority control, so execution resources can be used from the highest priority thread up to the maximum amount specified, depending on the situation. It is easy to use execution resources as much as possible. However, if the total of the maximum number of each thread exceeds the total number of partitions, a thread with a low priority will impede execution of a thread with a high priority. The resource reservation method can statically predict the performance, and the maximum number setting method can dynamically increase the efficiency of execution resource usage. However, it is difficult to maintain the performance of the highest priority thread only with these control methods. For example, when a thread with a high priority is ready for scheduling and the highest priority thread is switched, a thread with a low priority that has been executed so far occupies execution resources, and a thread with a high priority. Execution will be hindered. Therefore, if the number of partitions storing high-priority thread instructions is less than the threshold and there is no free partition, the thread instruction with the lowest priority among the threads currently using that resource is selected. Discard. In the case of the instruction buffer 30, the instruction is refetched from the head instruction of the thread, and in the reorder buffer 40, an instruction in the pipeline is discarded using the same mechanism as in the case of a branch prediction miss.

SMTアーキテクチャでは、優先度による制御を行っていても、同時に実行されるスレッドによっては最上位優先度の実行に影響を与える場合がある。そこで、プロセッサの性能の予測性、及び全体スループットの改善のために、各スレッドがその優先度に従った量のプロセッサ資源を割り当てるように制御することができる。例えば、命令フェッチに関しては、命令バッファの各スレッドへの割当量を、各スレッドの優先度に従うように制御することができる。これにより下位優先度スレッドがフェッチ権を獲得しやすくなるため、最上位優先度スレッドの性能が多少低下する可能性があるが、性能の変動は小さくなり、予測性が高まるものと考えられる。また、命令バッファの利用効率の改善により全体性能の向上が期待できる。   In the SMT architecture, even if control is performed based on priority, execution of the highest priority may be affected depending on the threads that are executed simultaneously. Therefore, in order to improve predictability of the processor performance and improve the overall throughput, each thread can be controlled to allocate an amount of processor resources according to its priority. For example, with respect to instruction fetch, the allocation amount of each instruction buffer to each thread can be controlled to follow the priority of each thread. This makes it easier for the lower priority thread to acquire the fetch right, so that the performance of the highest priority thread may be somewhat reduced, but the fluctuation in performance is reduced and the predictability is considered to be increased. In addition, improvement in overall performance can be expected by improving the use efficiency of the instruction buffer.

命令フェッチに関するこの制御について、以下に具体的に述べる。この制御は、図2に示されたプロセッサ10内の主としてフェッチスレッドセレクタ24によって実行される。この制御は、各スレッドの命令バッファの占有量を監視し、より下位の優先度のスレッドの占有量が、より上位の優先度のスレッドの占有量を超えると、その下位優先度のスレッドからの命令フェッチを抑制または禁止するものである。以後の説明には以下の記号を用いる。   This control regarding instruction fetch will be specifically described below. This control is executed mainly by the fetch thread selector 24 in the processor 10 shown in FIG. This control monitors the instruction buffer occupancy of each thread, and if the occupancy of a lower priority thread exceeds the occupancy of a higher priority thread, the thread from the lower priority thread Instruction fetch is suppressed or prohibited. The following symbols are used in the following description.

Ti: スレッド;
Gj: 同じ優先度を与えられたスレッドのグループ。グループ間の優先度はGj > Gj-1 であるとする;
ThOfMinIQ(Gj): グループGj中で命令バッファ占有数が最小のスレッド;
THNUM(Gj): グループGjに属するスレッドTiの数;
IQSUM(Gj): グループGjが占有する命令バッファ数(グループGjに属するスレッドの命令バッファ占有数の合計);
MINIQ(Gj): グループGjが占有する命令バッファ数の最小値;
MIN_IQ_THRESH: 1スレッド当りの命令バッファ占有数に対する所定の下限値;
FREQj: グループGj のフェッチ要求;
FETCHj: フェッチ要求FREQj が認められた場合にフェッチを行なうスレッド(フェッチスレッド)。
Ti: Thread;
Gj: A group of threads given the same priority. The priority between groups is assumed to be Gj>Gj-1;
ThOfMinIQ (Gj): Thread with the smallest instruction buffer occupancy in group Gj;
THNUM (Gj): Number of threads Ti belonging to group Gj;
IQSUM (Gj): Number of instruction buffers occupied by group Gj (total number of instruction buffers occupied by threads belonging to group Gj);
MINIQ (Gj): Minimum number of instruction buffers occupied by group Gj;
MIN_IQ_THRESH: a predetermined lower limit for the number of instruction buffers occupied per thread;
FREQj: Group Gj fetch request;
FETCHj: Thread that fetches when fetch request FREQj is accepted (fetch thread).

フェッチ要求FREQjとフェッチスレッドFETCHj は、以下のような制御条件(1)および(2)に従って決められる。
FREQj =
MINIQ(Gj)≦IQSUM(Gj-1)
or
IQSUM(Gj) ≦MIN_IQ_THRESH × THNUM(Gj) … 制御条件(1)
FETCHj = ThOfMinIQ (Gj) … 制御条件(2)
ここで、値MIN_IQ_THRESH は、各スレッドの命令バッファが空になる頻度を低くすることを目的とした下限値である。各スレッドの命令バッファ占有数がこの下限値MIN_IQ_THRESHを下回ると、各スレッドは無条件にフェッチ要求を出すことができる。この値MIN_IQ_THRESHは以下の条件値、
・1回のフェッチでフェッチされる命令数
・フェッチ開始から命令発行までに要する最短サイクル数
・1サイクルの最大命令発行数
によって決めることができる。例えば図2に示されたプロセッサ10では、1サイクルで8つの命令がフェッチされ、フェッチ開始から命令発行まで6サイクルを要し、1サイクルで4命令が発行される。そのため、命令バッファの命令数が24になった時点でフェッチを開始することで、命令供給が途絶える頻度を減らすことができると考えられる。そこで、値MIN_IQ_THRESHとして「24」を採用することができる。
The fetch request FREQj and the fetch thread FETCHj are determined according to the following control conditions (1) and (2).
FREQj =
MINIQ (Gj) ≦ IQSUM (Gj-1)
or
IQSUM (Gj) ≤ MIN_IQ_THRESH × THNUM (Gj)… Control condition (1)
FETCHj = ThOfMinIQ (Gj)… Control condition (2)
Here, the value MIN_IQ_THRESH is a lower limit value for the purpose of reducing the frequency with which the instruction buffer of each thread becomes empty. When the instruction buffer occupation number of each thread falls below this lower limit value MIN_IQ_THRESH, each thread can issue a fetch request unconditionally. This value MIN_IQ_THRESH is the following condition value,
・ The number of instructions fetched by one fetch ・ The shortest number of cycles required from the start of fetch to the issue of instructions ・ It can be determined by the maximum number of instructions issued in one cycle. For example, in the processor 10 shown in FIG. 2, eight instructions are fetched in one cycle, six cycles are required from the start of fetching to issuing an instruction, and four instructions are issued in one cycle. Therefore, it is considered that the frequency at which the supply of instructions is interrupted can be reduced by starting fetching when the number of instructions in the instruction buffer reaches 24. Therefore, “24” can be adopted as the value MIN_IQ_THRESH.

制御条件(1)によれば、或るグループGjの命令バッファ占有数の最小値MINIQ(Gj)が、それより1ランク優先度の低いグループGj-1の命令バッファ占有数IQSUM(Gj-1)と同等かより少ないときには、または、或るグループGjの命令バッファ占有数IQSUM(Gj)が、そのグループGj により占有されるべき命令バッファ数の下限値MIN_IQ_THRESH × THNUM(Gj) と同等かより少ないときには、そのグループGjのフェッチ要求FREQjは認められるが、より優先度の低いグループGj-1のフェッチ要求FREQ j-1は認められない。そして、制御条件(2)によれば、そのグループGj のフェッチ要求FREQjが認められる場合、そのグループGj 中で命令バッファ占有数が最小であるスレッドThOfMinIQ (Gj)に、フェッチ権が与えられる。   According to the control condition (1), the minimum value MINIQ (Gj) of the instruction buffer occupation number of a certain group Gj is lower than the instruction buffer occupation number IQSUM (Gj-1) of the group Gj-1 having a lower rank priority. When the instruction buffer occupation number IQSUM (Gj) of a certain group Gj is equal to or less than the lower limit value MIN_IQ_THRESH × THNUM (Gj) of the instruction buffer number to be occupied by the group Gj The fetch request FREQj of the group Gj is permitted, but the fetch request FREQ j-1 of the group Gj-1 having a lower priority is not permitted. According to the control condition (2), when the fetch request FREQj of the group Gj is recognized, the fetch right is given to the thread ThOfMinIQ (Gj) having the smallest instruction buffer occupation number in the group Gj.

以上により、FETCHj 、FREQj が決定されるが、プロセッサ10では、1サイクルで1つのスレッドのみがフェッチを行うため、複数のフェッチ要求から1つのスレッドを選択しなければならない。そこで、最上位優先度スレッドの実行を優先するために、最上位優先度のグループのフェッチ要求を選択し、フェッチスレッドを決定するような制御方法が採用できる。また、フェッチスレッドとして選択されたスレッドがキャッシュミス等を起こしフェッチを行えない場合であっても、下位優先度のスレッドにフェッチ権を譲ることはないようにしてもよい。これは、資源占有量の逆転を防ぎ下位優先度スレッドが上位優先度スレッドの性能を圧迫しないようにするためである。   As described above, FETCHj and FREQj are determined. In the processor 10, only one thread performs fetch in one cycle, so one thread must be selected from a plurality of fetch requests. Therefore, in order to prioritize the execution of the highest priority thread, a control method can be adopted in which a fetch request of the highest priority group is selected and the fetch thread is determined. Further, even when a thread selected as a fetch thread causes a cache miss or the like and cannot be fetched, the fetch right may not be transferred to a lower priority thread. This is to prevent reversal of the resource occupancy and prevent the lower priority thread from squeezing the performance of the upper priority thread.

この制御方法では、一方において、下位優先度スレッドがフェッチ権を得やすくなっており、プロセッサの全体性能が向上すると考えられる。そして、他方において、プログラムの特性によらず高優先度スレッドほど多くの命令バッファを獲得できるように制御されており、低優先度スレッドに多くの命令バッファが割かれる問題や、長期間命令バッファが占有される問題は生じにくいと考えられる。この利点は、後述の命令発行の制御方法との組み合わせにより、より強化される。また、この制御方法では、同じ優先度のスレッドが複数あった場合には、それらの中で最も命令バッファ占有数が少ないスレッドからフェッチを行う。   On the other hand, in this control method, it is considered that the lower priority thread easily obtains the fetch right, and the overall performance of the processor is improved. On the other hand, the higher priority thread is controlled so that more instruction buffers can be acquired regardless of the program characteristics. The problem is that many instruction buffers are allocated to low priority threads, Occupied problems are unlikely to occur. This advantage is further strengthened by a combination with a command issue control method described later. Further, in this control method, when there are a plurality of threads having the same priority, the fetch is performed from the thread having the smallest instruction buffer occupation number among them.

次に命令発行の制御方法について述べる。   Next, an instruction issue control method will be described.

命令フェッチの制御と同様に、資源の占有量が優先度に従うように、それぞれのスレッドの命令発行が制御される。この命令発行の制御は、図2に示されたプロセッサ10内の例えば命令発行セレクタ32によって実行される。この命令発行の制御では、監視対象の資源として、リザベーションステーションまたはリオーダバッファを採用することができる。以下に説明する制御では、リザベーションステーションのスレッド毎の占有量が監視され、より下位の優先度のスレッドの占有量が、より上位の優先度のスレッドの占有量を超えると、その下位優先度のスレッドからの命令発行が抑制または禁止される。以降の説明では以下の記号を用いる。   Similar to the instruction fetch control, the instruction issue of each thread is controlled so that the occupation amount of the resource follows the priority. This instruction issue control is executed by, for example, the instruction issue selector 32 in the processor 10 shown in FIG. In this command issue control, a reservation station or a reorder buffer can be adopted as a resource to be monitored. In the control described below, the occupancy of each reservation station thread is monitored, and if the occupancy of a lower priority thread exceeds the occupancy of a higher priority thread, the lower priority Instruction issue from the thread is suppressed or prohibited. In the following description, the following symbols are used.

Tj,k: グループGj に属するスレッド;
RSNUM(Tj,k): スレッドTj,k のリザベーションステーション占有数;
RSSUM(Gj.): グループGjのリザベーションステーション占有数(グループGjに属するスレッドのリザベーションステーション占有数の合計);
IREQj,k: スレッドTj,k の命令発行要求。
Tj, k: threads belonging to group Gj;
RSNUM (Tj, k): Number of reservation stations occupied by thread Tj, k;
RSSUM (Gj.): Number of reservation stations occupied by group Gj (total number of reservation stations occupied by threads belonging to group Gj);
IREQj, k: Instruction issue request for thread Tj, k.

命令発行要求IREQj,k は以下のような制御条件(3)に従って決められる。
IREQj,k = RSNUM(Tj,k) ≦ RSSUM(Gj-1) … 制御条件(3)
The instruction issue request IREQj, k is determined according to the following control condition (3).
IREQj, k = RSNUM (Tj, k) ≤ RSSUM (Gj-1) ... Control condition (3)

制御条件(3)によれば、或るスレッドTj,k のリザベーションステーション占有数RSNUM(Tj,k)が、それより1ランク優先度の低いグループGj-1のリザベーションステーション占有数と同等かそれより少ないときには、そのスレッドTj,kの命令発行要求IREQj,kは認められるが、その優先度の低いグループの命令発行要求IREQj-1,kは認められない。ここで、図2に示されたプロセッサ10では、1サイクルで最大で4つのスレッドが命令を発行し得る。命令フェッチと異なり、同じグループの複数のスレッドから命令発行要求が来る場合がある。そこで、命令発行の制御では、命令発行要求を出しているスレッドを以下のように順位付けし、その順位の上位4つのスレッドを発行スレッドとする。   According to the control condition (3), the reservation station occupation number RSNUM (Tj, k) of a thread Tj, k is equal to or less than the reservation station occupation number of the group Gj-1 having a lower rank priority than that. When the number is low, the instruction issue request IREQj, k of the thread Tj, k is accepted, but the instruction issue request IREQj-1, k of the group with the lower priority is not accepted. Here, in the processor 10 shown in FIG. 2, a maximum of four threads can issue instructions in one cycle. Unlike instruction fetch, there may be an instruction issue request from multiple threads in the same group. Therefore, in the instruction issuance control, the threads issuing the instruction issuance requests are ranked as follows, and the top four threads in the rank are set as the issuing threads.

・スレッドに与えられた優先度の高い順
・同じ優先度(グループ)のスレッド間では、リザベーションステーション60の占有数が少ない順
-Order in descending order of priority given to threads-Order in which the reservation station 60 occupies the smallest number among threads of the same priority (group)

命令発行の制御方法は、前述の命令フェッチのそれとよく似たものである。相違点は、命令バッファ30の占有数の代わりにリザベーションステーション60の占有数を用いる点と、占有数の下限値MIN_IQ_THRESHに対応する条件が無い点である。発行スレッド選択の基準にリザベーションステーション60を用いる理由は次の通りである。すなわち、発行スレッドとして選択されたスレッドが実際には発行できない場合が存在する。これは主に次のような場合である。   The instruction issue control method is very similar to that of the aforementioned instruction fetch. The difference is that the number of occupations of the reservation station 60 is used instead of the number of occupations of the instruction buffer 30, and there is no condition corresponding to the lower limit value MIN_IQ_THRESH of the occupation number. The reason for using the reservation station 60 as a criterion for selecting an issue thread is as follows. That is, there is a case where the thread selected as the issuing thread cannot actually be issued. This is mainly the case as follows.

・リオーダバッファ40に空きがない
・リネームバッファ34に空きがない
・発行先の実行ユニットのリザベーションステーション60に空きがない
プロセッサ10では、リオーダバッファ40とリネームバッファ34は連動しており、実際に制約となるのはリオーダバッファ40かリザベーションステーション60である。このうち、実際上は、リザベーションステーション60に空きがなく命令発行が行えない場合が多い。そのため、上記の制御条件(3)では、より貴重な資源を高優先度スレッドに割り当てるためスレッド選択の基準にリザベーションステーション60の占有数が用いられる。実際、発明者が実施した評価試験によっても、リオーダバッファ40よりリザベーションステーション60の方が、より影響的であることがわかった。
There is no space in the reorder buffer 40. There is no space in the rename buffer 34. There is no space in the reservation station 60 of the issuing execution unit. In the processor 10, the reorder buffer 40 and the rename buffer 34 are linked and are actually limited. It is the reorder buffer 40 or the reservation station 60 that becomes. Of these, in practice, there are many cases where the reservation station 60 is not empty and cannot issue an instruction. Therefore, in the above control condition (3), the number of occupations of the reservation station 60 is used as a thread selection criterion in order to allocate more precious resources to high priority threads. Actually, it was found from the evaluation test conducted by the inventor that the reservation station 60 is more influential than the reorder buffer 40.

次に、IPC制御の具体的方法を説明する。   Next, a specific method of IPC control will be described.

リアルタイム処理においてはタスクの実行時間の予測性が重要である。そこで、前述の命令フェッチ、命令発行機構にIPCを制御する機構を加えられる。IPC 制御では、一定の間隔で各スレッドの実行命令数を監視し、それが指定された目標値に満たない場合には命令フェッチ、発行が行われる頻度を高くする。また、プログラムの性能は時間とともに大きく変化することがあり、以下に説明するIPC制御ではその点についても考慮される。   In real-time processing, predictability of task execution time is important. Therefore, a mechanism for controlling the IPC can be added to the above-described instruction fetch and instruction issue mechanism. In IPC control, the number of instructions executed by each thread is monitored at regular intervals, and if it does not reach the specified target value, the frequency of instruction fetch and issue is increased. Moreover, the performance of the program may change greatly with time, and this point is also taken into consideration in the IPC control described below.

このIPC制御では、グループGjの現在のIPCに応じて変化するインフレーション値INFLjが導入され、前述の命令フェッチ、発行の制御条件(1)と(3)が以下の制御条件(4)と(5)のように変更される。
FREQj =
MINIQ(Gj) ≦ IQSUM(Gj-1) + INFLj × THNUM(Gj)
or
IQSUM(Gj) ≦ MIN_IQ_THRESH × THNUM(Gj) … 制御条件(4)
IREQj,k = RSNUM(Tj,k) ≦ RSSUM(Gj-1) +INFLj … 制御条件(5)
ここで、既に図4を参照して説明したように、インフレーション値INFLjは、所定の値範囲、例えば0 ≦ INFLj ≦32の範囲で、グループGj の現在の性能によって増減される。すなわち、グループGj が指定されたIPC を得られていない場合には、インフレーション値INFLjが増加し、それにより、グループGjより優先度が下位のスレッドのフェッチと発行が抑制され、グループGjのスレッドの性能を上昇させる。インフレーション値INFLjの可変範囲が0から32であるのは、図2に示されたプロセッサ10では命令バッファ30およびリザベーションステーション60が32エントリをもつことに基づいている。
In this IPC control, an inflation value INFLj that changes according to the current IPC of the group Gj is introduced, and the above-described instruction fetch and issue control conditions (1) and (3) are controlled by the following control conditions (4) and (5 ) Is changed.
FREQj =
MINIQ (Gj) ≤ IQSUM (Gj-1) + INFLj × THNUM (Gj)
or
IQSUM (Gj) ≤ MIN_IQ_THRESH × THNUM (Gj)… Control condition (4)
IREQj, k = RSNUM (Tj, k) ≤ RSSUM (Gj-1) + INFLj… Control condition (5)
Here, as already described with reference to FIG. 4, the inflation value INFLj is increased or decreased according to the current performance of the group Gj within a predetermined value range, for example, a range of 0 ≦ INFLj ≦ 32. That is, when the IPC specified by the group Gj is not obtained, the inflation value INFLj increases, thereby suppressing the fetching and issuing of threads having a lower priority than the group Gj, and the thread of the group Gj Increase performance. The reason why the variable range of the inflation value INFLj is 0 to 32 is that the instruction buffer 30 and the reservation station 60 have 32 entries in the processor 10 shown in FIG.

以上、本発明の実施形態を説明したが、この実施形態は本発明の説明のための例示にすぎず、本発明の範囲をこの実施形態にのみ限定する趣旨ではない。本発明は、その要旨を逸脱することなく、その他の様々な態様でも実施することができる。   As mentioned above, although embodiment of this invention was described, this embodiment is only the illustration for description of this invention, and is not the meaning which limits the scope of the present invention only to this embodiment. The present invention can be implemented in various other modes without departing from the gist thereof.

Claims (14)

複数のスレッドを並列的に処理するマルチスレッド中央演算装置において、
各スレッドの優先度を記憶する優先度記憶手段と、
前記各スレッドの優先度を用いて、前記複数のスレッドの命令の処理の順序または頻度を制御する第1の制御手段と、
各スレッドの一定の繰り返し周期あたりの実行命令数の目標値を記憶する目標記憶手段と、
前記各スレッドの命令実行状態を監視し、前記繰り返し周期あたりの実際の実行命令数と前記目標値を用いたフィードバック制御動作により、前記第1の制御手段により制御される前記複数のスレッドの命令の処理の順序または頻度に対して調整を加える第2の制御手段と
を備え、
前記第1の制御手段が、前記装置内の所定の資源の前記複数のスレッドへの割当量を監視し、前記複数のスレッドへの割当量が前記複数のスレッドの優先度に従うように、前記複数のスレッドの命令のフェッチ、発行または実行のそれぞれの順序または頻度を制御するマルチスレッド中央演算装置。
In a multi-thread central processing unit that processes a plurality of threads in parallel,
Priority storage means for storing the priority of each thread;
First control means for controlling the order or frequency of instruction processing of the plurality of threads using the priority of each thread;
Target storage means for storing a target value of the number of executed instructions per fixed repetition period of each thread;
The instruction execution state of each thread is monitored, and the instructions of the plurality of threads controlled by the first control unit are controlled by a feedback control operation using the actual number of executed instructions per repetition period and the target value. Second control means for adjusting the order or frequency of processing,
The first control means monitors the allocation amount of the predetermined resource in the device to the plurality of threads, and the allocation amount to the plurality of threads follows the priority of the plurality of threads. A multi-threaded central processing unit that controls the order or frequency of fetch, issue, or execution of instructions for threads.
請求項1記載の装置において、
前記第1の制御手段が、第1の優先度をもつ1以上の第1のスレッドへの前記資源の割当量が、前記第1の優先度より下位の第2の優先度をもつ1以上の第2のスレッドへのそれ以下であるとき、前記第1のスレッド中の少なくとも一つのスレッドの命令のフェッチ、発行または実行を促進し、または、前記第2のスレッドの命令のフェッチ、発行または実行を抑制するマルチスレッド中央演算装置。
The apparatus of claim 1.
The first control means has an allocation amount of the resource to one or more first threads having a first priority of one or more having a second priority lower than the first priority. Facilitate fetching, issuing, or executing instructions of at least one thread in the first thread when less than to a second thread, or fetching, issuing, or executing instructions of the second thread Multi-thread central processing unit that suppresses
請求項1記載の装置において、
前記第1の制御手段が、各スレッドへの前記資源の割当量が少なくて所定の下限条件を満たさないとき、前記各スレッドの命令のフェッチ、発行または実行を促進し、または、前記各スレッドの命令のフェッチ、発行または実行の抑制を解除するマルチスレッド中央演算装置。
The apparatus of claim 1.
The first control means facilitates fetching, issuing, or executing an instruction of each thread when the resource allocation amount to each thread is small and does not satisfy a predetermined lower limit condition; or A multi-threaded central processing unit that removes restrictions on fetching, issuing, or executing instructions.
請求項2又は3のいずれか一項記載の装置において、
前記第1のスレッド中の前記少なくとも一つのスレッドには、前記資源の占有量が前記第1のスレッド中で最小であるスレッドが含まれるマルチスレッド中央演算装置。
The device according to claim 2 or 3,
The multi-thread central processing unit, wherein the at least one thread in the first thread includes a thread having a minimum occupation amount of the resource in the first thread.
請求項1〜4のいずれか一項記載の装置において、
前記所定の資源には、フェッチされた前記複数のスレッドの命令をそれが発行されるまで保持する命令バッファが含まれる、マルチスレッド中央演算装置。
The device according to any one of claims 1 to 4,
The multi-thread central processing unit, wherein the predetermined resource includes an instruction buffer for holding fetched instructions of the plurality of threads until they are issued.
請求項5記載の装置において、
前記所定の資源には、前記命令バッファから発行された前記複数のスレッドの命令をそれが実行されるまで保持する1以上のリザベーションステーションが含まれる、マルチスレッド中央演算装置。
The apparatus of claim 5, wherein,
The multi-thread central processing unit, wherein the predetermined resource includes one or more reservation stations that hold the instructions of the plurality of threads issued from the instruction buffer until the instructions are executed.
請求項1〜6のいずれか一項記載の装置において、
前記第2の制御手段が、前記各スレッドの前記実際の実行命令数が前記各スレッドの前記目標値に近づくように、或るスレッドの前記実際の実行命令数が前記目標値を満たさない場合、前記或るスレッドの命令のフェッチまたは発行を促進し、または、前記或るスレッドより下位の優先度をもつ他のスレッドの命令のフェッチまたは発行を抑制するマルチスレッド中央演算装置。
The device according to any one of claims 1 to 6,
When the actual number of execution instructions of a thread does not satisfy the target value so that the second control means approaches the target value of each thread so that the actual number of execution instructions of each thread A multi-thread central processing unit that facilitates fetching or issuing instructions of the certain thread or suppressing fetching or issuing instructions of other threads having a lower priority than the certain thread.
請求項1〜7のいずれか一項記載の装置において、
前記第2の制御手段が、前記各スレッドの前記実際の実行命令数が前記各スレッドの前記目標値に近づくようにするために、或るスレッドの前記実際の実行命令数が前記目標値を満たさない場合、前記或るスレッドの命令の処理の頻度を増加させるための調整を、前記第1の制御手段の制御に加え、そして、前記調整を加えても前記或るスレッドの前記実際の実行命令数に所定条件を満たす改善が現れない場合、前記加えられた調整を解除するマルチスレッド中央演算装置。
The device according to any one of claims 1 to 7,
In order for the second control means to make the actual execution instruction number of each thread approach the target value of each thread, the actual execution instruction number of a certain thread satisfies the target value. If not, an adjustment for increasing the frequency of processing of the instruction of the certain thread is added to the control of the first control means, and the actual execution instruction of the certain thread even if the adjustment is added A multi-thread central processing unit that cancels the added adjustment if no improvement appears in the number that satisfies a predetermined condition.
請求項1〜8のいずれか一項記載の装置において、
前記第2の制御手段が、
監視周期毎に、スレッド毎に実行された命令数をカウントする監視部と、
スレッド毎に、現在の監視周期における前記実際の実行命令数が、予め設定されている目標値を満たすかチェックする第1の比較を行い、且つ、スレッド毎に、前回の監視周期における実行命令数の不足分と前記目標値との加算である繰越残値を求め、前記現在の監視周期における前記実際の実行命令数が前記繰越残値を満たすかチェックする第2の比較を行う比較部と、
スレッド毎に、前記第1と第2の比較の結果に基づいて命令フェッチ又は命令発行の頻度を可変する制御部と
を有するマルチスレッド中央演算装置。
The device according to any one of claims 1 to 8,
The second control means comprises:
A monitoring unit that counts the number of instructions executed for each thread for each monitoring period;
For each thread, a first comparison is performed to check whether the actual number of instructions executed in the current monitoring cycle satisfies a preset target value, and the number of instructions executed in the previous monitoring cycle for each thread. A comparison unit that performs a second comparison that obtains a carry-over residual value that is an addition of the deficiency of the target value and the target value, and checks whether the actual number of executed instructions in the current monitoring cycle satisfies the carry-over residual value;
A multi-thread central processing unit having a control unit that varies the frequency of instruction fetch or instruction issue based on the result of the first and second comparisons for each thread.
請求項9記載の装置において、
前記制御部が、
スレッド毎に、前記命令実行状態が、前記第1と第2の比較結果の双方が肯定的である第1状態、前記第1の比較結果は肯定的であるが前記第2の比較結果が否定的である第2状態、および、前記第1と第2の比較結果の双方が否定的である第3状態のいずれに該当するかを判断する手段と、
スレッド毎に、所定の第1時間長にわたり前記第1状態が続く場合、前記命令フェッチ又は前記命令発行の頻度を減少させる手段と、
スレッド毎に、所定の第2時間長にわたり前記第2状態が続く場合、前記命令フェッチ又は前記命令発行の頻度を増加させる手段と、
スレッド毎に、所定の第3時間長にわたり前記第3状態が続く場合、前記命令フェッチ又は前記命令発行の頻度を増加させる手段と、
スレッド毎に、前記命令フェッチ又は前記命令発行の頻度を増加させた場合、前記実行命令数に所定程度以上の増加が生じたかチェックするリソースアップチェックを行う手段と、
スレッド毎に、前記リソースアップチェックの結果が否定的である場合、前記命令フェッチ又は前記命令発行の頻度を減少させる手段と
を有するマルチスレッド中央演算装置。
The apparatus of claim 9.
The control unit is
For each thread, the instruction execution state is a first state in which both the first and second comparison results are positive, and the first comparison result is positive but the second comparison result is negative. Means for determining whether the second state is a target and the third state in which both the first and second comparison results are negative;
Means for decreasing the frequency of instruction fetch or instruction issue if the first state continues for a predetermined first time length for each thread;
Means for increasing the frequency of instruction fetch or instruction issue if the second state continues for a predetermined second time length for each thread;
Means for increasing the frequency of instruction fetch or instruction issue if the third state continues for a predetermined third time length for each thread;
Means for performing a resource up check for checking whether an increase of a predetermined degree or more has occurred in the number of execution instructions when the frequency of the instruction fetch or the instruction issue is increased for each thread;
A multi-thread central processing unit having means for reducing the frequency of the instruction fetch or the instruction issuance when the result of the resource up check is negative for each thread.
請求項1記載の装置において、
前記第1の制御手段が、通常の状況下では上位優先度のスレッドの命令が下位優先度のスレッドの命令より先に処理され、前記上位優先度のスレッドが前記装置内の所定の資源を無駄にするか非効率的に使用するような所定状況下では、前記下位優先度のスレッドの命令が前記上位優先度のスレッドの命令より先に処理されるように制御を行うマルチスレッド中央演算装置。
The apparatus of claim 1.
In a normal situation, the first control means processes an instruction of a higher priority thread before an instruction of a lower priority thread, and the upper priority thread wastes a predetermined resource in the device. Or a multi-thread central processing unit that performs control so that instructions of the lower priority thread are processed before instructions of the higher priority thread under predetermined circumstances such that they are used inefficiently or inefficiently.
請求項1記載の装置において、
前記第2の制御手段が、前記各スレッドの前記実際の実行命令数が前記各スレッドの前記目標値に近づくように、前記複数のスレッドの命令のフェッチまたは発行の順序または頻度を制御するマルチスレッド中央演算装置。
The apparatus of claim 1.
Multi-thread in which the second control means controls the order or frequency of fetching or issuing instructions of the plurality of threads so that the actual number of instructions executed by each thread approaches the target value of each thread Central processing unit.
請求項1記載の装置において
前記第2の制御手段が、前記各スレッドの前記実際の実行命令数が前記各スレッドの前記目標値に近づくようにするための調整を、前記第1の制御手段の制御に加えるマルチスレッド中央演算装置。
The apparatus of claim 1 .
Said second control means, wherein the adjustment for the actual number of executed instructions for each thread to approach the target value of said each thread, multi-threaded central processing applied to control of said first control means apparatus.
複数のスレッドを並列的に処理するマルチスレッド中央演算装置における同時マルチスレッディング制御方法であって、
優先度記憶手段が各スレッドの優先度を記憶するステップと、
第1の制御手段が、前記各スレッドの優先度を用いて、前記複数のスレッドの命令の処理の順序または頻度を制御するステップと、
目標記憶手段が、各スレッドの一定の繰り返し周期あたりの実行命令数の目標値を記憶するステップと、
第2の制御手段が、前記各スレッドの命令実行状態を監視し、前記繰り返し周期あたりの実際の実行命令数と前記目標値を用いたフィードバック制御動作により、前記第1の制御手段により制御される前記複数のスレッドの命令の処理の順序または頻度に対して調整を加えるステップと有し、
前記第1の制御手段が、前記装置内の所定の資源の前記複数のスレッドへの割当量を監視し、前記複数のスレッドへの割当量が前記複数のスレッドの優先度に従うように、前記複数のスレッドの命令のフェッチ、発行または実行のそれぞれの順序または頻度を制御する、同時マルチスレッディング制御方法。
A simultaneous multithreading control method in a multithread central processing unit that processes a plurality of threads in parallel,
A step of storing a priority of each thread by a priority storage means;
A step of controlling a sequence or frequency of processing of instructions of the plurality of threads by using a priority of each thread;
A step of storing a target value of the number of execution instructions per fixed repetition period of each thread;
The second control means monitors the instruction execution state of each thread, and is controlled by the first control means by a feedback control operation using the actual number of executed instructions per repetition period and the target value. Adjusting the order or frequency of processing of the instructions of the plurality of threads;
The first control means monitors the allocation amount of the predetermined resource in the device to the plurality of threads, and the allocation amount to the plurality of threads follows the priority of the plurality of threads. A simultaneous multithreading control method that controls the order or frequency of fetching, issuing, or executing instructions of a thread.
JP2007519071A 2005-06-02 2006-06-01 Multi-thread central processing unit and simultaneous multi-threading control method Active JP5145936B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007519071A JP5145936B2 (en) 2005-06-02 2006-06-01 Multi-thread central processing unit and simultaneous multi-threading control method

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
JP2005162549 2005-06-02
JP2005162549 2005-06-02
JP2005167427 2005-06-07
JP2005167427 2005-06-07
PCT/JP2006/311022 WO2006129767A1 (en) 2005-06-02 2006-06-01 Multithread central processing device and simultaneous multithreading control method
JP2007519071A JP5145936B2 (en) 2005-06-02 2006-06-01 Multi-thread central processing unit and simultaneous multi-threading control method

Publications (2)

Publication Number Publication Date
JPWO2006129767A1 JPWO2006129767A1 (en) 2009-01-08
JP5145936B2 true JP5145936B2 (en) 2013-02-20

Family

ID=37481695

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007519071A Active JP5145936B2 (en) 2005-06-02 2006-06-01 Multi-thread central processing unit and simultaneous multi-threading control method

Country Status (2)

Country Link
JP (1) JP5145936B2 (en)
WO (1) WO2006129767A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8260990B2 (en) * 2007-11-19 2012-09-04 Qualcomm Incorporated Selective preclusion of a bus access request
JP5548037B2 (en) 2010-06-11 2014-07-16 パナソニック株式会社 Command issuing control device and method
CN103324269B (en) * 2013-06-13 2016-01-27 中国科学院计算技术研究所 A kind of method and system reducing multithread program power consumption
CN103336571B (en) * 2013-06-13 2016-02-03 中国科学院计算技术研究所 A kind of method and system reducing multithread program power consumption
CN113139003B (en) * 2020-01-19 2023-04-11 上海静客网络科技有限公司 Spark-based big data processing method
US11204802B2 (en) 2020-04-27 2021-12-21 International Business Machines Corporation Adjusting a dispatch ratio for multiple queues

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10124316A (en) * 1996-08-27 1998-05-15 Matsushita Electric Ind Co Ltd Multithread processor independently processing plural instruction flows and flexibly controlling processing performance by the same instruction flows
JP2882475B2 (en) * 1996-07-12 1999-04-12 日本電気株式会社 Thread execution method
JP2004287883A (en) * 2003-03-24 2004-10-14 Toshiba Corp Processor, computer and priority decision method
JP2004532444A (en) * 2001-02-19 2004-10-21 イマジネイション テクノロジーズ リミテッド Control of priority and instruction speed on multithreaded processors

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2882475B2 (en) * 1996-07-12 1999-04-12 日本電気株式会社 Thread execution method
JPH10124316A (en) * 1996-08-27 1998-05-15 Matsushita Electric Ind Co Ltd Multithread processor independently processing plural instruction flows and flexibly controlling processing performance by the same instruction flows
JP2004532444A (en) * 2001-02-19 2004-10-21 イマジネイション テクノロジーズ リミテッド Control of priority and instruction speed on multithreaded processors
JP2004287883A (en) * 2003-03-24 2004-10-14 Toshiba Corp Processor, computer and priority decision method

Also Published As

Publication number Publication date
JPWO2006129767A1 (en) 2009-01-08
WO2006129767A1 (en) 2006-12-07

Similar Documents

Publication Publication Date Title
JP2006343872A (en) Multithreaded central operating unit and simultaneous multithreading control method
KR100880470B1 (en) Thread livelock unit
US6542921B1 (en) Method and apparatus for controlling the processing priority between multiple threads in a multithreaded processor
US7721127B2 (en) Multithreaded dynamic voltage-frequency scaling microprocessor
JP5548037B2 (en) Command issuing control device and method
US7752627B2 (en) Leaky-bucket thread scheduler in a multithreading microprocessor
JP3805305B2 (en) Control of priority and instruction speed on multithreaded processors
US20040172631A1 (en) Concurrent-multitasking processor
JP5413853B2 (en) Thread de-emphasis method and device for multi-threaded processor
JP5145936B2 (en) Multi-thread central processing unit and simultaneous multi-threading control method
JP5607545B2 (en) Prioritizing instruction fetching in microprocessor systems.
JP5498505B2 (en) Resolving contention between data bursts
WO2022100372A1 (en) Processor architecture with micro-threading control by hardware-accelerated kernel thread
JP5861354B2 (en) Arithmetic processing device and control method of arithmetic processing device
US20060037021A1 (en) System, apparatus and method of adaptively queueing processes for execution scheduling
US11144353B2 (en) Soft watermarking in thread shared resources implemented through thread mediation
JP2010061642A (en) Technique for scheduling threads
WO2002046887A2 (en) Concurrent-multitasking processor
EP4034993B1 (en) Throttling while managing upstream resources
JP2012168725A (en) Multi-thread processor
WO2017199106A1 (en) Single-thread speculative multi-threading
CN116324719A (en) Processor with multiple op cache lines
CN116324716A (en) Apparatus and method for simultaneous multithreading instruction scheduling in a microprocessor
Cazorla Almeida et al. Architectural support for real-time task scheduling in SMT processors
JP2012113487A (en) Multithread processor

Legal Events

Date Code Title Description
A529 Written submission of copy of amendment under article 34 pct

Free format text: JAPANESE INTERMEDIATE CODE: A5211

Effective date: 20071122

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090528

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090528

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120501

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120628

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120628

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120821

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120924

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: 20121030

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20121112

R150 Certificate of patent or registration of utility model

Ref document number: 5145936

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20151207

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250