The successful resolution of conditional branches is an important issue in modern microprocessors. When a conditional branch enters an execution pipeline, the instructions following the branch may typically wait for the branch resolution. A common solution to this problem is speculative execution: the branch outcome and/or its target may be dynamically or statically predicted, so the execution may proceed without stalling. However, if a branch is mispredicted, speculatively executed instructions are typically flushed and their results discarded, thus wasting a significant number of processor clock cycles.
Referring to the Figures in which like numerals indicate like elements,
Referring to
Processor 100 may include a branch predictor system (BP) 114 to predict whether a branch instruction will be taken or not. An output from branch predictor system 114 (e.g., taken or not taken) may, for example, cause instruction fetch unit 110 to begin fetching instructions from a branch path (e.g., if a branch instruction is predicted as taken) or to continue fetching instructions along a fall-through path (e.g., if the branch is predicted as not taken). The instruction pointer (IP) (e.g., address) for each fetched instruction may be provided to the branch predictor system 114 to allow the branch predictor system 114 to predict whether a branch instruction will be taken or not taken.
Processor 100 may also include an instruction cache (I$) 116 to cache fetched instructions. A level 2 instruction cache (not shown) may also be provided. An instruction decoder (D) 118 may decode each fetched (e.g., architectural) instruction into one or more micro-operations or micro-ops (uops). Processor 100 may include a mapper (or register renamer) (M) 120 to map architectural registers to physical (or virtual) registers.
An instruction scheduler (S) 122 may generally schedule micro-ops (uops) for execution, for example, when operands for the instruction are ready and the appropriate execution resources are available. According to an example embodiment, the scheduler may be a single scheduler or may include a multilevel scheduler (or multiple schedulers), such as a level 2 scheduler and a level 1 scheduler (not shown).
According to an example embodiment, processor 100 may include a limited set of architectural registers (e.g., eax, ebx, . . . ) that may be seen or accessed by a programmer. Processor 100 may include a larger set of physical registers, shown as the register file (RF) 124. A register (or entry) in the register file 124 may be allocated for each uop to store the execution result for the micro-op. The register file may also store status information indicating the status of each micro-op. The different status for a uop that may be tracked in its entry in the register file 152 may include, for example: uop is scheduled for execution, uop is executing, uop has completed execution and results are being written back to the register file entry, uop is ready for retirement, and uop is being retired.
Processor 100 may include one or more execution units 126 to execute uops. The execution units may include one or more ALU (arithmetic logic unit) execution units and one or more memory load and memory store execution units, for example. A data cache (D$) 128 may be provided to cache data, execution results, etc. Although not shown, the processor 100 may include one or more store buffers. An instruction window logic 130 may be provided to handle retirement of uops.
Other types of branch predictors may rely on global branch history, such as by using a branch history register (BHR), which may be a shift register or other structure that may keep the history of N most recent branch outcomes (e.g., N most recent branch instructions). In general, predictors that use global history may benefit from correlations between subsequent branches in the program execution flow, while local predictors may be based on correlation between subsequent executions of the same branch instruction.
Referring to
As shown in
As shown in
Referring to
The prediction output by each predictor (via lines 220, 230 and 240 for predictors 206, 208 and 210, respectively) may be the branch prediction for this branch instruction (or IP), e.g., taken or not taken. As noted above, each branch predictor (e.g., 206, 208, 210) may use a variety of different techniques for branch prediction. In an embodiment, each predictor (206, 208, 210, etc.) may be a different type of predictor or may use a different technique for branch prediction, although this is merely another example embodiment and is not required.
The confidence level output by each predictor (output via lines 222, 232 and 242 for predictors 206, 208 and 210, respectively) may, for example, provide a measure of the predictor's accuracy, e.g., for this branch instruction. It may be based upon, for example, how often this predictor was correct over the last M times it predicted the outcome for this branch instruction. Therefore, the execution results (e.g., indicating whether a branch prediction was correct or not) from execution units 126 may be used to dynamically update the confidence level for each predictor (e.g., for each branch instruction or IP). The confidence level may be different for different branch instructions, and it may change over time (e.g., a dynamic value). Alternatively, the confidence level may be based upon, for example, the global history, e.g., how often this predictor was correct over the last M branch instructions. These are just a few examples of confidence levels, and this disclosure is not limited thereto. Confidence levels may be generated or provided in a number of different ways based on different types of information. In general, the prediction and confidence level for each predictor may be based upon, for example, one or more of: local per-IP branch prediction information (e.g., per-IP branch prediction table), global branch history (e.g., a global branch history register or table), execution results, data kept local to each branch predictor and accumulated over time, and/or other information.
In general, according to an example embodiment, an override signal, if asserted, may indicate that the override information may control (and override at least some other signals) in the selection of a prediction, instead of the other signals being used to control the selection of a branch prediction.
The override signal output by each predictor (e.g., override signal 222, override signal 232 and override signal 242 output from branch predictors 206, 208 and 210, respectively) may indicate when the predictor that is asserting the override signal should be trusted, regardless of short term history and/or confidence levels output by the predictors. There may be a variety of conditions that may be detected or measured, which may cause a branch predictor to assert its override signal (also known as a positive override signal). In an example embodiment, where a predictor has asserted its override signal (positive override signal), BP controller 204 may use the prediction from such predictor, without regard to short term history and the confidence levels by the different predictors.
In another embodiment, the override signal may actually include two different override signals: a positive override signal that may indicate the predictor asserting the positive override signal should be trusted, regardless of short term history and the signals (e.g., confidence levels) output by other predictors. This positive override signal is described above.
However, in addition to a positive override signal, each branch predictor may assert a negative override signal that may indicate that the predictor asserting the negative override signal should not be trusted, e.g., regardless of short term history and confidence levels output by each predictor. There may be a variety of conditions that may be detected or measured, which may cause a branch predictor to assert its negative override signal. Thus, according to an example embodiment, when a predictor asserts its negative override signal, BP controller 204 may ignore (e.g., not select) the prediction from the asserting predictor, even if that predictor outputs the highest confidence level, for instance.
At operation 620, if a positive override signal has been asserted by one of the branch predictors (e.g., 206, 208, 210), then the branch prediction from the branch predictor that asserted the override signal is selected, e.g., by BP controller 204. In an example embodiment, this branch prediction (of the asserting predictor) may be selected regardless of short term history or confidence levels of the predictors.
Otherwise, at operation 630, if no positive override signal has been asserted, then a branch prediction may be selected (e.g., by BP controller 204) from the branch predictor having the highest confidence level.
At operation 720, if a negative override signal was asserted by one of the branch predictors, then the prediction from the predictor asserting the negative override signal may be ignored, and the prediction from another predictor having the highest confidence level may be selected. Thus, according to an example embodiment, the prediction from a predictor asserting a negative override signal may be ignored even if the asserting predictor has the highest confidence level.
At operation 730, otherwise, if no negative override signal has been asserted, then a branch prediction may be selected (e.g., by BP controller 204) from the branch predictor having the highest confidence level.
According to an example embodiment, the branch prediction system 114 may be used in isolation, or may be used in combination with one or more other branch predictors, and/or may be used at any level of a hierarchical or multilevel branch predictor. For example, in a multilevel branch predictor, the latest resolving branch prediction may control or override previous branch predictions. Therefore, in addition to selecting a branch prediction, BP controller 204 may (or may not) terminate a previously selected branch prediction, if such previously selected branch prediction is not the branch prediction selected by controller 204, for example, although this is not required. Therefore, controller 204 may both select a branch prediction and may also deselect or terminate a previously selected branch prediction, e.g., based on the confidence level, prediction and override signal from each predictor.
While certain features of the described implementations have been illustrated as disclosed herein, many modifications, substitutions, changes and equivalents will now occur to those skilled in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the true spirit of the various embodiments.
This application is a continuation of U.S. patent application Ser. No. 11/215,835, filed Aug. 29, 2005 and entitled “Processor with Branch Predictor,” which is hereby incorporated by reference. The subject matter of this application is related to the subject matter of co-pending U.S. patent application Ser. No. 11/215,833, filed on Aug. 29, 2005 and entitled “Hierarchical Processor,” which is hereby incorporated by reference.
Number | Name | Date | Kind |
---|---|---|---|
5379428 | Belo | Jan 1995 | A |
5592679 | Yung | Jan 1997 | A |
5613126 | Schmidt | Mar 1997 | A |
5644784 | Peek | Jul 1997 | A |
5694589 | Glew et al. | Dec 1997 | A |
5701439 | James et al. | Dec 1997 | A |
5701508 | Glew et al. | Dec 1997 | A |
5708843 | Abramson et al. | Jan 1998 | A |
5717882 | Abramson et al. | Feb 1998 | A |
5721855 | Hinton et al. | Feb 1998 | A |
5721857 | Glew et al. | Feb 1998 | A |
5724527 | Karnik et al. | Mar 1998 | A |
5724536 | Abramson et al. | Mar 1998 | A |
5727176 | Clift et al. | Mar 1998 | A |
5729728 | Colwell et al. | Mar 1998 | A |
5740393 | Vidwans et al. | Apr 1998 | A |
5748937 | Abramson | May 1998 | A |
5749084 | Huck et al. | May 1998 | A |
5751983 | Abramson et al. | May 1998 | A |
5751986 | Fetterman et al. | May 1998 | A |
5751996 | Glew et al. | May 1998 | A |
5778245 | Papworth et al. | Jul 1998 | A |
5778407 | Glew et al. | Jul 1998 | A |
5796637 | Glew et al. | Aug 1998 | A |
5809271 | Colwell et al. | Sep 1998 | A |
5819079 | Glew et al. | Oct 1998 | A |
5826094 | Colwell et al. | Oct 1998 | A |
5826109 | Abramson et al. | Oct 1998 | A |
5835748 | Orenstein et al. | Nov 1998 | A |
5852726 | Lin et al. | Dec 1998 | A |
5854914 | Bodas et al. | Dec 1998 | A |
5860154 | Abramson et al. | Jan 1999 | A |
5872972 | Boland et al. | Feb 1999 | A |
5881223 | Agrawal et al. | Mar 1999 | A |
5881262 | Abramson et al. | Mar 1999 | A |
5909696 | Reinhardt et al. | Jun 1999 | A |
5913050 | Boggs et al. | Jun 1999 | A |
5933840 | Menon et al. | Aug 1999 | A |
5935240 | Mennemeier et al. | Aug 1999 | A |
5948097 | Glew et al. | Sep 1999 | A |
5950211 | Shealy | Sep 1999 | A |
5951670 | Glew et al. | Sep 1999 | A |
5956753 | Glew et al. | Sep 1999 | A |
5974523 | Glew et al. | Oct 1999 | A |
5987600 | Papworth et al. | Nov 1999 | A |
6035393 | Glew et al. | Mar 2000 | A |
6047369 | Colwell et al. | Apr 2000 | A |
6079014 | Papworth et al. | Jun 2000 | A |
6117079 | Brackett et al. | Sep 2000 | A |
6170997 | Glew et al. | Jan 2001 | B1 |
6185221 | Aybay | Feb 2001 | B1 |
6204174 | Glew et al. | Mar 2001 | B1 |
6297843 | Glew | Oct 2001 | B1 |
6374349 | McFarling | Apr 2002 | B1 |
6378062 | Abramson et al. | Apr 2002 | B1 |
6427206 | Yeh et al. | Jul 2002 | B1 |
6430191 | Klausmeier et al. | Aug 2002 | B1 |
6505283 | Stoney | Jan 2003 | B1 |
6581151 | Henry et al. | Jun 2003 | B2 |
6629175 | Manning et al. | Sep 2003 | B1 |
6647482 | Ronen et al. | Nov 2003 | B1 |
6678816 | Ronen et al. | Jan 2004 | B2 |
6792523 | Lin | Sep 2004 | B1 |
6820086 | Iacobovici et al. | Nov 2004 | B1 |
6829764 | Cohen et al. | Dec 2004 | B1 |
6873184 | McMinn et al. | Mar 2005 | B1 |
7000097 | Senter et al. | Feb 2006 | B2 |
7024555 | Kozuch et al. | Apr 2006 | B2 |
7035988 | Marino | Apr 2006 | B1 |
7124273 | Glew et al. | Oct 2006 | B2 |
7130990 | Brekelbaum et al. | Oct 2006 | B2 |
7133906 | Price et al. | Nov 2006 | B2 |
7149882 | Glew et al. | Dec 2006 | B2 |
7343513 | Basu et al. | Mar 2008 | B1 |
7362765 | Chen | Apr 2008 | B1 |
7844797 | Senter et al. | Nov 2010 | B2 |
20010042188 | Tremblay et al. | Nov 2001 | A1 |
20020044563 | Magill et al. | Apr 2002 | A1 |
20020083307 | Sager et al. | Jun 2002 | A1 |
20020120663 | Binns | Aug 2002 | A1 |
20020194464 | Henry et al. | Dec 2002 | A1 |
20030084346 | Kozuch et al. | May 2003 | A1 |
20030088756 | Vishkin | May 2003 | A1 |
20030126442 | Glew et al. | Jul 2003 | A1 |
20030126453 | Glew et al. | Jul 2003 | A1 |
20030126454 | Glew et al. | Jul 2003 | A1 |
20030147410 | Hsu et al. | Aug 2003 | A1 |
20030163662 | Glew et al. | Aug 2003 | A1 |
20030196065 | Ronen et al. | Oct 2003 | A1 |
20030229794 | Sutton, II et al. | Dec 2003 | A1 |
20040003321 | Glew et al. | Jan 2004 | A1 |
20040073653 | Hunt et al. | Apr 2004 | A1 |
20040117539 | Bennett et al. | Jun 2004 | A1 |
20040163083 | Wang et al. | Aug 2004 | A1 |
20040210741 | Glew et al. | Oct 2004 | A1 |
20040225872 | Bonanno et al. | Nov 2004 | A1 |
20050038977 | Glew et al. | Feb 2005 | A1 |
20050058149 | Howe | Mar 2005 | A1 |
20050080934 | Cota-Robles et al. | Apr 2005 | A1 |
20050204118 | Jen et al. | Sep 2005 | A1 |
20050210472 | Accapadi et al. | Sep 2005 | A1 |
20060075402 | Neiger et al. | Apr 2006 | A1 |
20060112388 | Taniguchi et al. | May 2006 | A1 |
20060143373 | Jain et al. | Jun 2006 | A1 |
20070030277 | Prokopenko et al. | Feb 2007 | A1 |
20070083735 | Glew | Apr 2007 | A1 |
20070083739 | Glew | Apr 2007 | A1 |
20080133868 | Glew | Jun 2008 | A1 |
20080133883 | Glew | Jun 2008 | A1 |
20080133885 | Glew | Jun 2008 | A1 |
20080133889 | Glew | Jun 2008 | A1 |
20080133893 | Glew | Jun 2008 | A1 |
Number | Date | Country | |
---|---|---|---|
20080052500 A1 | Feb 2008 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 11215835 | Aug 2005 | US |
Child | 11931203 | US |