1. Field of the Invention
Embodiments of the present invention relate generally to multi-threaded processing and, more particularly, to a scoreboard system and method for multi-threaded processing.
2. Description of the Related Art
Scoreboards have been used in scalar processing to keep track of registers that are busy so that instructions that need to use these registers can be prevented from being issued during the time these registers are in the busy state. A conventional scoreboard maintains a bit mask for each of the registers that are in a register file. When the bit mask is 1, this indicates that the associated register is busy and instructions that need to use this register should not be issued. When the bit mask is 0, this indicates that the associated register is not busy and instructions that need to use this register can be issued. Therefore, before any instruction can be issued, the scoreboard is checked to see if any of the registers specified in the instruction is busy or not. If none are indicated by the scoreboard as being busy, the instruction is allowed to issue.
The scoreboarding technique described above works adequately for small register files. When the number of registers in the register file becomes very large, however, the size of the scoreboard becomes proportionately large and table look-ups performed on the scoreboard to check if a particular register is busy or not become technique are often too slow to be able to support highly parallel processing architectures that execute a large number of independent threads in parallel.
The present invention provides a system and a method with which scoreboard checks and updates can be performed quickly, even when the number of threads and the size of the register file become very large.
The system according to an embodiment of the present invention includes a scoreboard memory that has separate memory regions allocated to each of the multiple threads to be processed. For each thread, the scoreboard memory stores register identifiers of registers that have pending writes. When an instruction is added to an instruction buffer, the register identifiers of the registers specified in the instruction are compared with the register identifiers stored in the scoreboard memory for that instruction's thread, and a multi-bit value representing the comparison result is generated. The multi-bit value is stored with the instruction in the instruction buffer and may be updated as instructions belonging to the same thread complete their execution. Before the instruction is issued for execution, this multi-bit value is checked. If this multi-bit value indicates that none of the registers specified in the instruction have pending writes, the instruction is allowed to issue for execution.
The scoreboard memory also stores a size indicator for each register identifier. The size indicator is used when comparing the register identifiers of the registers specified in an instruction with the register identifiers stored in the scoreboard memory for that instruction's thread. If the size indicator is 1, a normal comparison is made. If the size indicator is 2, the least significant bit of the register identifiers is masked and not compared. If the size indicator is 4, the two least significant bits of the register identifiers are masked and not compared.
The method according to an embodiment of the present invention is used to issue instructions to be executed by a multi-threaded processing unit. The method includes the steps of comparing register identifiers of registers specified in an instruction to be issued with one or more register identifiers of registers that have pending writes, and issuing the instruction for execution when the register identifiers of registers specified in the instruction to be issued does not match any of the register identifiers of registers that have pending writes.
The method according to another embodiment of the present invention is used to track the register usage of a plurality of threads using a scoreboard memory that has memory regions reserved for each of the plurality of threads. The method includes the steps of allocating a region of the scoreboard memory to each of the plurality of threads, storing register identifiers of registers that have pending writes in the memory region allocated to a thread as instructions of that thread with pending writes are issued for execution, and removing register identifiers of registers that have pending writes from the memory region allocated to a thread as instructions of that thread with pending writes are completed.
So that the manner in which the above recited features of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
The instruction dispatch unit 212 further includes an issue logic 320. The issue logic 320 examines the instructions and their multi-bit dependency masks stored in the instruction buffer 310 and issues an instruction out of the instruction buffer 310 that is not dependent on any of the instructions in flight (e.g., an instruction having a dependency mask equal to zero), provided that there is available memory space in the scoreboard memory 322 to store the register ID of a destination register specified in the instruction. If not, the issue logic 320 does not issue the instruction until memory space in the scoreboard memory 322 becomes available. In conjunction with the issuance out of the instruction buffer 310, the issue logic 320 sends pipeline configuration signals to the appropriate execution pipeline.
By storing the size indicator in the scoreboard memory 322, an instruction such as a texture fetch instruction which often specify a sequential string of registers (e.g., R0, R1, R2, R3) can be represented in the scoreboard memory 322 with a single register entry (e.g., R0) and a size indicator (e.g., 4). Thus, instead of having four storage spaces allocated to a thread being consumed by registers specified in a single instruction, only one storage space is consumed. The present invention may, however, be practiced without storing the size indicator. In such an embodiment, all register IDs stored in the scoreboard memory 322 will be representative of a single register.
During the comparisons in step 712, if the size indicator corresponding to a register ID stored in the scoreboard memory 322 is equal to 2, the least significant bit of the register IDs being compared is masked and not compared. If the size indicator is equal to 4, the two least significant bits of the register IDs being compared are masked and not compared. If the size indicator is equal to 1, a normal comparison is made, i.e., there is no masking of the bits and all of the bits of the register IDs being compared are compared.
When performing the comparisons described above, 0, 1 or 2 least significant bits of the single register entry are masked in accordance with the size indicator and not compared. If the size indicator is 1, no bits are masked. If the size indicator is 2, one bit is masked. If the size indicator is 4, two bits are masked. As a result, a comparison of a single register entry R0 with a size indicator of 4 (e.g., 00000xx, where x represents the masked bits) against any of the registers R0 (0000000), R1 (0000001), R2 (0000010), R3 (0000011) will indicate a match. For this technique to work correctly, however, instructions that specify a sequential string of destination registers are required to begin their sequence at multiples of 4 starting with R0 (e.g., R0, R4, R8, etc.). For further improvement, a texture fetch instruction may be required to specify a single sequence of registers as both source and destination registers.
For simplicity of illustration, a thread as used in the above description of the embodiments of the present invention represents a single thread of instructions. The present invention is also applicable to embodiments where like threads are grouped together and the same instruction from this group, also referred to as a convoy, is processed through multiple, parallel data paths using a single instruction, multiple data (SIMD) processor.
While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof. The scope of the present invention is determined by the claims that follow.
This application is a continuation of U.S. patent application Ser. No. 11/301,589 entitled, “SCOREBOARD FOR MULTI-THREADED PROCESSOR,” filed Dec. 13, 2005, now U.S. Pat. No. 7,434,032. The subject matter of this related application is hereby incorporated herein by reference.
Number | Name | Date | Kind |
---|---|---|---|
5421028 | Swanson | May 1995 | A |
5579473 | Schlapp et al. | Nov 1996 | A |
5815166 | Baldwin | Sep 1998 | A |
5838988 | Panwar et al. | Nov 1998 | A |
5860018 | Panwar et al. | Jan 1999 | A |
5890008 | Panwar et al. | Mar 1999 | A |
5948106 | Hetherington et al. | Sep 1999 | A |
5958047 | Panwar et al. | Sep 1999 | A |
5978864 | Hetherington et al. | Nov 1999 | A |
5996060 | Medelson et al. | Nov 1999 | A |
5999727 | Panwar et al. | Dec 1999 | A |
6178481 | Krueger et al. | Jan 2001 | B1 |
6204856 | Wood et al. | Mar 2001 | B1 |
6222550 | Roseman et al. | Apr 2001 | B1 |
6266733 | Knittel et al. | Jul 2001 | B1 |
6279086 | Arimilli et al. | Aug 2001 | B1 |
6279100 | Tremblay et al. | Aug 2001 | B1 |
6288730 | Duluk, Jr. et al. | Sep 2001 | B1 |
6397300 | Arimilli et al. | May 2002 | B1 |
6405285 | Arimilli et al. | Jun 2002 | B1 |
6418513 | Arimilli et al. | Jul 2002 | B1 |
6434667 | Arimilli et al. | Aug 2002 | B1 |
6446166 | Arimilli et al. | Sep 2002 | B1 |
6463507 | Arimilli et al. | Oct 2002 | B1 |
6559852 | Ashburn et al. | May 2003 | B1 |
6658447 | Cota-Robles | Dec 2003 | B2 |
6704925 | Bugnion | Mar 2004 | B1 |
6750869 | Dawson | Jun 2004 | B1 |
6771264 | Duluk et al. | Aug 2004 | B1 |
6816161 | Lavelle et al. | Nov 2004 | B2 |
6819325 | Boyd et al. | Nov 2004 | B2 |
6919896 | Sasaki et al. | Jul 2005 | B2 |
6947047 | Moy et al. | Sep 2005 | B1 |
7015718 | Burky et al. | Mar 2006 | B2 |
7103720 | Moy et al. | Sep 2006 | B1 |
7139003 | Kirk et al. | Nov 2006 | B1 |
7237094 | Curran et al. | Jun 2007 | B2 |
7254697 | Bishop et al. | Aug 2007 | B2 |
7278011 | Elsen et al. | Oct 2007 | B2 |
7328438 | Armstrong et al. | Feb 2008 | B2 |
7447873 | Nordquist | Nov 2008 | B1 |
20010056456 | Cota-Robeles | Dec 2001 | A1 |
20030097395 | Peterson | May 2003 | A1 |
20040024993 | Parthasarathy | Feb 2004 | A1 |
20040194096 | Armstrong et al. | Sep 2004 | A1 |
20040207623 | Isard et al. | Oct 2004 | A1 |
20040208066 | Burkey et al. | Oct 2004 | A1 |
20050108720 | Cervini | May 2005 | A1 |
20050122330 | Boyd et al. | Jun 2005 | A1 |
20060020772 | Hussain | Jan 2006 | A1 |
20060155966 | Burky et al. | Jul 2006 | A1 |
Number | Date | Country |
---|---|---|
2003-35589 | May 2003 | JP |
Number | Date | Country | |
---|---|---|---|
Parent | 11301589 | Dec 2005 | US |
Child | 12233515 | US |