A new table entry allocation method for TAGE branch predictor
By dynamically adjusting the new table entry allocation probability of the TAGE branch predictor, and using prediction information and random numbers to control allocation, the prediction accuracy of the TAGE branch predictor is improved, the cold counter problem is solved, and it is suitable for low-power processors.
Patent Information
- Application Number
- CN202111003800.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-08-30
AI Technical Summary
The cold counter problem in the TAGE branch predictor results in low prediction accuracy, and existing improvement methods are not applicable in area- and power-constrained processors.
By dynamically adjusting the allocation probability of new table entries and using the prediction information of the TAGE branch predictor, such as the saturation counter value, u bit and prediction result, to determine whether a new table entry needs to be allocated for the current mispredicted branch instruction, reducing the allocation and cost of new table entries The number of training times uses random numbers and throttling functions to control the distribution of enable signals.
The prediction accuracy of the TAGE branch predictor is improved, the impact of the cold counter problem is reduced, and no additional branch prediction table is required, making it suitable for processors with low power consumption and low area.
Smart Images

Figure CN113703846B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a new table item allocation method oriented to a TAGE branch predictor, and belongs to the field of branch predictor design of a processor. Background Art
[0002] In order to improve the performance of the processor, most modern processors are designed with the idea of superscalar architecture. For superscalar processors, in the instruction fetch stage of the pipeline, in addition to fetching multiple instructions from the instruction cache, it is also necessary to predict the instruction fetch of the next cycle based on the information of these fetched instructions. The branch predictor is a device that can complete this prediction task. However, when the branch predictor makes an error in predicting a branch instruction, it is necessary to erase the instructions that have entered the pipeline and are on the wrong prediction path from the pipeline, and continue to fetch instructions from the correct address, which wastes the power consumption of the processor and affects the instruction execution efficiency of the processor.
[0003] The branch predictor is one of the core structures of modern processors. A branch predictor with higher prediction accuracy can more effectively avoid pipeline flushing due to branch instruction prediction errors, thereby improving processor performance and reducing the power consumption of the processor when executing invalid instructions.
[0004] The TAGE (TAgged GEometric History Length) branch predictor has become one of the mainstream branch predictors due to its excellent prediction accuracy. However, the TAGE branch predictor also has some problems, among which the cold-counter problem seriously affects the further improvement of its prediction accuracy (see Pierre Michaud. An alternative TAGE-like conditional branch predictor [J]. ACM Trans, 2018, 15 (3): 1544-3566.).
[0005] The main reason for the cold counter problem of the TAGE branch predictor is that every time a prediction error occurs, the TAGE branch predictor allocates a new table entry for the branch instruction that is predicted incorrectly. The content of the table entry includes a tag, a saturation counter ctr, and a u bit. The tag is used to confirm whether the table entry matches the branch, the saturation counter ctr is used to determine the direction of the branch jump, and the u bit indicates the usefulness of the table entry. After the new table entry is allocated, it needs to be initialized according to the information of the branch instruction to which it belongs. Since the saturation counter value cannot be accurately estimated during initialization, the TAGE branch predictor will initialize the saturation counter of the new table entry to a weak attribute state (weak jump or weak no jump) according to the actual direction of the mispredicted branch instruction. This causes the new table entry to spend a certain amount of time to train the saturation counter value to improve its own prediction confidence. During the training period, the prediction accuracy of the TAGE branch predictor is generally very low, which will lead to many wrong predictions.
[0006] In order to reduce the impact of the cold counter problem on the TAGE branch predictor and improve the prediction accuracy, domestic and foreign experts and scholars have conducted a lot of research on this. André Seznec of the French National Institute of Information and Automation (see André Seznec. A case for (partially) Tagged GEometric history length branch prediction [J]. Journal of Instruction-Level Parallelism, 2006.) proposed a method for dynamically monitoring prediction using a meta-predictor USE_ALT_ON_NA, which can select the prediction result of the component with higher prediction accuracy from the Alternator and Provider as the final prediction output. When the prediction is wrong, it is not necessary to allocate a new table entry to the branch instruction every time, thereby reducing the number of allocation and training of new table entries, and effectively improving the cold counter problem of the TAGE branch predictor; since 2006, the meta-predictor USE_ALT_ON_NA has been recognized by the industry as an indispensable part of the TAGE branch predictor, and all traditional TAGE branch predictors recorded in this application also refer to TAGE branch predictors with meta-predictors. However, although this method improves the prediction accuracy and reduces the impact of the cold counter problem of the TAGE branch predictor, subsequent research shows that there is still much room for improvement in improving the cold counter problem of the TAGE branch predictor.
[0007] In order to further reduce the impact of the cold counter problem on the TAGE branch predictor, André Seznec (see André Seznec. A new case for the TAGE branch predictor [C]. In International Symposium on Microarchitecture, 2011: 117-127.) also proposed a method of adding a statistical deviation corrector SC (Statistical Corrector) based on the above-mentioned TAGE branch predictor structure. This method can correct the prediction results of branch instructions that are difficult to predict (have weak bias and no global historical correlation) by the TAGE branch predictor. This method can further reduce the allocation and training process of new table entries, thereby reducing the probability of the cold counter problem and improving the prediction accuracy. However, this method requires the design of an additional branch prediction table to store the prediction information of the statistical deviation corrector, and is not suitable for processors that have strict restrictions on area and power consumption, such as processors in wearable devices and aerospace equipment. Summary of the invention
[0008] In order to reduce the impact of the cold counter problem on the TAGE branch predictor, improve the prediction accuracy of the TAGE branch predictor, and make the TAGE branch predictor more applicable, the present invention provides a new table entry allocation method for the TAGE branch predictor based on the traditional TAGE branch predictor, characterized in that the method includes:
[0009] When the processor updates the TAGE branch predictor, the TAGE branch predictor generates an allocation enable signal ALLOC for a new entry based on the correctness of its last prediction result;
[0010] The TAGE branch predictor calculates the branch prediction result based on the saturation counter value of the hit table entry in the Provider, the prediction result of the Provider, and the component T i The saturation counter value of the internal index table entry, component T i The u bit of the internal index table entry updates the allocation enable signal ALLOC;
[0011] The TAGE branch predictor determines whether a new table entry needs to be allocated for the current mispredicted branch instruction based on the state of the allocation enable signal ALLOC;
[0012] Among them, the T i is a tagged component, i is the tagged component position number, P<i≤M, M is the total number of tagged components, and P is the component position number where the Provider is located.
[0013] Optionally, the TAGE branch predictor generates an allocation enable signal ALLOC of the new table entry according to the correctness of its prediction result, including: if the prediction result is correct, assigning the allocation enable signal ALLOC to 0; if the prediction result is wrong, assigning the allocation enable signal ALLOC to 1;
[0014] Optionally, the step of updating the allocation enable signal ALLOC includes:
[0015] S1: Record the saturation counter value of the hit table entry in the Provider as ctr P , if |2×ctr P +1|≤1 and the prediction result of Provider is correct, then update the allocation enable signal ALLOC to 0, otherwise do nothing; jump to S2;
[0016] S2: If the prediction result of the TAGE branch predictor is wrong, a random number rand is generated with a value range of 0 to (MINAP-1), where MINAP is a constant that increases as M increases;
[0017] The TAGE branch predictor determines whether the random number rand is not less than the allocation throttling function value. If not, the allocation enable signal ALLOC is updated to 0; if yes, no operation is performed;
[0018] Optionally, the allocation throttling function is:
[0019] f(tage_cat[INDCAT])=(tage_cat[INDCAT]×MINAP) / (CATMAX+1)
[0020] Among them, if the prediction result of Alternator is correct, INDCAT is 1, if it is incorrect, INDCAT is 0; NUM_tagged k For each tagged component (T 1 ~T M )
[0021] Optionally, the updating process of the independent variable tag_cat[INDCAT] of the allocation throttling function includes:
[0022] Step 1: Place component T i The saturation counter value of the internal hit table entry is recorded as ctr i , and initialize the variables NUM_MLConf_ctr and state_u to 0;
[0023] Step 2: TAGE branch predictor from component T P+1Start looping over component T i If the u bit of the index table entry is 0, the variable state_u is recorded as 1; if |2×ctr i +1|equals 3, then increment the variable NUM_MLConf_ctr by 1; if|2×ctr i +1|equal to 1, then exit this loop immediately and jump to step 3;
[0024] Step 3: Calculate tag_cat[INDCAT] using the values of NUM_MLConf_ctr and state_u obtained in step 2. The update formula is:
[0025] tage_cat[INDCAT]=tage_cat[INDCAT]+3-3×NUM_MLConf_ctr-state_u
[0026] Step 4: If the value of tage_cat[INDCAT] is less than 0, assign tage_cat[INDCAT] to 0; if the value of tage_cat[INDCAT] is greater than CATMAX, assign tage_cat[INDCAT] to CATMAX; otherwise, keep the original value unchanged.
[0027] Optionally, the TAGE branch predictor determines whether a new table entry needs to be allocated to the TAGE branch predictor according to the state of the allocation enable signal ALLOC, including:
[0028] If ALLOC is equal to 1, the TAGE branch predictor allocates a new table entry; if ALLOC is equal to 0, no new table entry is allocated and the next branch prediction is awaited.
[0029] Optionally, the allocation of the new table entry includes: TAGE branch predictor from component T P+1 Start looping over component T i The index table entries in the group are selected to allocate a group of index table entries with the smallest component number and meeting the allocation conditions; for the index table entries that do not meet the allocation conditions, their saturation counter values are decayed.
[0030] Optionally, the allocation condition is: u bit is 0 and |2×ctr i +1|≤3.
[0031] Optionally, the method for decaying the saturation counter value includes: if ctr i If it is greater than 0, ctr i Decrement by 1, if ctr i If it is less than 0, ctr i Add 1 to itself.
[0032] Optionally, the value range of MINAP is 4 to 8.
[0033] The beneficial effects of the present invention are:
[0034] The present invention provides a new table entry allocation method for a TAGE branch predictor. Compared with the new table entry allocation method of a traditional TAGE branch predictor, the method can make full use of the prediction information of the TAGE branch predictor, such as a saturated counter value, a u bit, and a prediction result, and dynamically adjust the allocation probability of new table entries when the TAGE branch predictor makes an incorrect prediction, so as to reduce the probability of the cold counter problem, thereby further improving the prediction accuracy of the TAGE branch predictor. Moreover, the new table entry allocation method does not need to design an additional branch prediction table like a statistical deviation corrector SC, and has a low storage resource occupation, so it is more suitable for application in low-power and low-area processors. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 It is a schematic diagram of the structure of the TAGE branch predictor.
[0037] Figure 2 It is a flow chart of a new table entry allocation method of a TAGE branch predictor provided by the present invention.
[0038] Figure 3 It is an APPA comparison simulation diagram of a TAGE branch predictor using the method of the present invention and a traditional TAGE branch predictor in a 57KB storage space.
[0039] Figure 4 It is a MPKI comparison simulation diagram of a TAGE branch predictor using the method of the present invention and a traditional TAGE branch predictor in a 57KB storage space. DETAILED DESCRIPTION
[0040] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0041] First, the basic theoretical knowledge involved in this application is introduced as follows:
[0042] The structure of the TAGE branch predictor is as follows Figure 1 As shown, it consists of a non-tagged component (T 0), M tagged components (T 1 ~T M ) and a history register (H). Among them, component T 0 It is a basic prediction table composed of saturation counter ctr, indexed by instruction PC address; component (T 1 ~T M ) is a label prediction table consisting of the branch instruction tag, the saturation counter ctr, and the u bit that marks whether this table entry is useful. It is indexed by the hash result of the instruction PC address and the history of length Li, where L M >L M-1 >…>L 1 >0.
[0043] When the TAGE branch predictor predicts a branch instruction, for component T 0 , the prediction result will be given directly based on the saturation counter of the index table item. For component T 1 ~T M , it is necessary to first determine whether the component is hit based on whether the tag in the index table item matches the tag obtained by hash calculation 2. Only when it is hit will the prediction result be given based on the saturation counter of the index table item. After obtaining the prediction status of each component, the TAGE branch predictor will comprehensively consider the prediction priority of each component (the larger the component number, the higher the priority) and the information of the meta-predictor USE_ALT_ON_NA, and select the prediction result of the appropriate component as the final prediction for output.
[0044] Some common definitions of the TAGE branch predictor involved in this application are introduced as follows:
[0045] (1) M: the total number of tagged components;
[0046] (2)T 0 : non-tagged components;
[0047] (3)T 1 ~T M : tagged components;
[0048] (4) Index: the index address of the tagged component;
[0049] (5) Provider: The tagged component with the longest history length and the tag matching (i.e. hit). If the tags of all tagged components are not matched, the component does not exist.
[0050] (6) Alternator: The tagged component whose tag matches (i.e. hits) and has the second longest history length. If the tags of all tagged components do not match, the component is a non-tagged component T 0 ;
[0051] Embodiment 1:
[0052] This embodiment provides a new table entry allocation method for a TAGE branch predictor, the method comprising:
[0053] When the processor updates the TAGE branch predictor, the TAGE branch predictor generates an allocation enable signal ALLOC for a new entry based on the correctness of its prediction result;
[0054] The TAGE branch predictor calculates the branch prediction result based on the saturation counter value of the hit table entry in the Provider, the prediction result of the Provider, and the component T i The saturation counter value of the internal index table entry, component T i The u bit of the internal index table entry updates the allocation enable signal ALLOC;
[0055] The TAGE branch predictor determines whether a new table entry needs to be allocated for the current mispredicted branch instruction based on the state of the allocation enable signal ALLOC;
[0056] Among them, the T i is a tagged component, i is the component position number, P<i≤M, M is the total number of tagged components, and P is the component position number where the Provider is located.
[0057] The design of this embodiment provides a new table entry allocation method for a TAGE branch predictor. Compared with the new table entry allocation method for a traditional TAGE branch predictor, this method can make full use of the prediction information of the TAGE branch predictor, such as the saturated counter value, the u bit, and the prediction result, and dynamically adjust the allocation probability of the new table entry when the TAGE branch predictor makes an incorrect prediction, so as to reduce the probability of the cold counter problem, thereby improving the prediction accuracy of the TAGE branch predictor for those difficult-to-predict branch instructions; and the new table entry allocation method of this embodiment does not need to design an additional branch prediction table like the statistical deviation corrector SC, and has a lower storage resource occupancy, so it is more suitable for application in low-power and low-area processors.
[0058] Embodiment 2:
[0059] This embodiment provides a new table entry allocation method for a TAGE branch predictor. Figure 2 , the method comprising:
[0060] First, when the processor updates the TAGE branch predictor, the TAGE branch predictor generates an allocation enable signal ALLOC for the new table entry based on the correctness of its prediction result;
[0061] Then the TAGE branch predictor calculates the branch prediction result based on the saturation counter value of the hit table entry in the Provider, the prediction result of the Provider, and the component T i The saturation counter value of the internal index table entry, component T i The u bit of the internal index table entry updates the allocation enable signal ALLOC; wherein the T i is a tagged component, i is the tagged component position number, P<i≤M, M is the total number of tagged components, and P is the component position number where the Provider is located;
[0062] Finally, the TAGE branch predictor determines whether to allocate a new table entry for the current mispredicted branch instruction according to the state of the allocation enable signal ALLOC. If not, it waits for the next branch prediction. If necessary, it allocates a new table entry according to the state of the allocation enable signal ALLOC. i Saturation counter value of internal index table entry and component T i The u bit of the inner index table entry selects a set of appropriate table entries for allocation.
[0063] like Figure 2 As shown, the specific process of the new table entry allocation method for TAGE branch predictor provided by the present application is:
[0064] Step 1: The TAGE branch predictor generates an allocation enable signal ALLOC of the new table entry according to the correctness of its prediction result. If the prediction result is correct, the allocation enable signal ALLOC is assigned a value of 0; if the prediction result is wrong, the allocation enable signal ALLOC is assigned a value of 1; jump to step 2;
[0065] Step 2: Record the saturation counter value of the hit table entry in the Provider as ctr P , if |2×ctr P +1|≤1 and the prediction result of Provider is correct, then update the allocation enable signal ALLOC to 0, otherwise do nothing; jump to step 3;
[0066] Step 3: If the prediction result of the TAGE branch predictor is wrong, a random number rand is generated with a value range of 0 to (MINAP-1), where MINAP is a constant that increases as M increases, and the value range of MINAP is 4 to 8;
[0067] Then determine the size relationship between the random number rand and the allocation throttling function f(tage_cat[INDCAT]): if the random number rand is less than the allocation throttling function f(tage_cat[INDCAT]), update the allocation enable signal ALLOC to 0; if the random number rand is not less than the allocation throttling function f(tage_cat[INDCAT]), do not perform any operation; jump to step 4;
[0068] The allocation throttling function f(tage_cat[INDCAT]) is:
[0069] f(tage_cat[INDCAT])=(tage_cat[INDCAT]×MINAP) / (CATMAX+1);
[0070] If the prediction result of Alternator is correct, INDCAT is 1; if it is incorrect, INDCAT is 0; CATMAX is NUM_tagged k For each tagged component (T 1 ~T M ) in the table.
[0071] Step 4: First, place component T i The saturation counter value of the internal hit table entry is recorded as ctr i , and initialize the variables NUM_MLConf_ctr and state_u to 0; then from component T P+1 Start looping over component T i If the u bit of the index table entry is 0, the variable state_u is recorded as 1; if |2×ctr i +1|equals 3, then increment the variable NUM_MLConf_ctr by 1; if|2×ctr i +1|equal to 1, then exit this loop immediately and jump to step 5;
[0072] Step 5: Use the variables NUM_MLConf_ctr and state_u obtained in step 4 to update the value of the independent variable tage_cat[INDCAT] of the allocation throttling function f(tage_cat[INDCAT]):
[0073] tage_cat[INDCAT]=tage_cat[INDCAT]+3-3×NUM_MLConf_ctr-state_u
[0074] Skip to step 6.
[0075] Step 6: If the independent variable tage_cat[INDCAT] of the allocation throttling function f(tage_cat[INDCAT]) obtained in step 5 is less than 0, then tage_cat[INDCAT] is assigned a value of 0; otherwise, if tage_cat[INDCAT] is greater than CATMAX, then tage_cat[INDCAT] is assigned a value of CATMAX, where CATMAX is NUM_tagged k For each tagged component (T 1 ~T M ) in the table; jump to step 7;
[0076] Step 7: The TAGE branch predictor determines whether it is necessary to allocate a new table entry for the current mispredicted branch instruction according to the state of the current allocation enable signal ALLOC. If ALLOC is equal to 1, it jumps to step 8 to allocate a new table entry; if ALLOC is equal to 0, it jumps to step 1 to wait for the next branch prediction;
[0077] Step 8: TAGE branch predictor from component T P+1 Start looping over component T i (P<i≤M), select a group of index table entries with the smallest component number and satisfying the allocation condition for allocation, the allocation condition is: u bit is 0 and |2×ctr i +1|≤3;
[0078] For those index table entries that do not meet the allocation conditions, their saturation counter values are decayed. The decay method is: if ctr i If it is greater than 0, ctr i Decrement by 1, if ctr i If it is less than 0, ctr i Increment by 1; then jump to step 1 to wait for the next branch prediction.
[0079] In order to verify the improvement of the prediction accuracy of the TAGE branch predictor by the new table entry allocation method of this embodiment, the present invention carried out an algorithm simulation experiment on the simulation model provided by the 5th Championship Branch Prediction (https: / / jilp.org / cbp2016 / ). The test stimulus of the simulation model includes 4 categories (LONG_SERVER, LONG_MOBILE, SHORT_SERVER, SHORT_MOBILE), a total of 440 applications, and each application has an average of about hundreds of millions of microinstructions.
[0080] The control experiment of this embodiment adopts the champion branch predictor TAGE-SC-L of the 64KB storage budget group of the 5th Branch Prediction Championship (refer to https: / / jilp.org / cbp2016 / program.html), only enabling its TAGE branch predictor (including meta-predictor USE_ALT_ON_NA), and not enabling its auxiliary predictors (statistical deviation corrector SC and loop predictor L). Among them, the TAGE branch predictor of the champion branch predictor TAGE-SC-L occupies a total of 463917-bit (about 57KB) of storage space, hereinafter referred to as the traditional TAGE branch predictor.
[0081] The parameter configuration information of the traditional TAGE branch predictor is shown in Table 1.
[0082] Table 1 Parameter configuration of traditional TAGE branch predictor
[0083]
[0084] This embodiment designs a new table entry allocation method for TAGE branch predictor provided by the present invention based on the structure of the traditional TAGE branch predictor, wherein the experimental parameters M of the new table entry allocation method are 36, MINAP is 8, and CATMAX is 147455.
[0085] Figure 3 The APPA (Allocation Probability Per Application) comparison simulation diagram of the TAGE branch predictor using the method of the present invention and the traditional TAGE branch predictor under the storage space limitation of 57KB is shown; APPA is the average new table entry allocation probability of each application, which can reflect the dynamic adjustment of the new table entry allocation probability of the TAGE branch predictor. Figure 3 The horizontal axis in the middle is the 440 applications (sorted) from the 5th Branch Prediction Championship, and the vertical axis is APPA TAGE* -APPA TAGE The result of , wherein TAGE* represents the TAGE branch predictor to which the method of the present invention is applied, and TAGE represents the traditional TAGE branch predictor; from Figure 3 It can be seen from the experimental results in that after applying the method of the present invention, the allocation probability of new entries is dynamically adjusted to find a more appropriate allocation probability.
[0086] Figure 4The MPKI (Mispredictions Per Thousand Instructions) comparison simulation diagram of the TAGE branch predictor using the method of the present invention and the traditional TAGE branch predictor under the storage space limitation of 57KB is shown; MPKI is the number of mispredicted branch instructions per 1000 instructions, which can reflect the prediction accuracy of the TAGE branch predictor for branch instructions. Figure 4 The horizontal axis in the middle is the 440 applications (sorted) from the 5th Branch Prediction Championship, and the vertical axis is MPKI TAGE* -MPKI TAGE The result of , wherein TAGE* represents the TAGE branch predictor to which the method of the present invention is applied, and TAGE represents the traditional TAGE branch predictor; from Figure 4 It can be seen from the experimental results in that the prediction accuracy of this embodiment is further improved compared with the traditional TAGE branch predictor.
[0087] Table 2 shows the average MPKI of each branch predictor when predicting 440 applications from the 5th Branch Prediction Championship.
[0088] Table 2 Average MPKI values of each branch predictor
[0089] Branch Predictor TAGE TAGE* TAGE+SC Storage Space 57KB 57KB 60KB MPKI 3.684 3.557 3.475
[0090] It can be seen from Table 2 that although the statistical deviation corrector SC reduces the average MPKI of the traditional TAGE branch predictor by 0.209, it also requires an additional 3KB of storage space overhead; the method of the present invention reduces the average MPKI of the traditional TAGE branch predictor by 0.127, and basically does not require additional storage space overhead.
[0091] In summary, the present invention can dynamically adjust the probability of allocating new table entries of the TAGE branch predictor, and reduce the number of occurrences of the cold counter problem on the basis of the traditional TAGE branch predictor, thereby improving the prediction accuracy of the traditional TAGE branch predictor; compared with the method of setting a statistical deviation corrector SC, although the performance of the present invention is slightly inferior in improving the prediction accuracy, it can save additional storage space overhead. Therefore, the present invention can achieve the purpose of saving overhead while improving the prediction accuracy, and has better applicability to processors with strict restrictions on area and power consumption, such as wearable devices, processors in aerospace equipment, etc.
[0092] Some steps in the embodiments of the present invention may be implemented using software, and the corresponding software program may be stored in a readable storage medium, such as a CD or a hard disk.
[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A new table entry allocation method for TAGE branch predictor, characterized in that: The method comprises: When the processor updates the TAGE branch predictor, the TAGE branch predictor generates an allocation enable signal ALLOC for a new entry based on the correctness of its prediction result; The TAGE branch predictor calculates the branch prediction result based on the saturation counter value of the hit table entry in the Provider, the prediction result of the Provider, and the component T i The saturation counter value of the internal index table entry, component T i The u bit of the internal index table entry updates the allocation enable signal ALLOC; The TAGE branch predictor determines whether a new table entry needs to be allocated for the current mispredicted branch instruction based on the state of the allocation enable signal ALLOC; Among them, the T i is a tagged component, i is the tagged component position number, P<i≤M, M is the total number of tagged components, and P is the component position number where the Provider is located; The TAGE branch predictor generates an allocation enable signal ALLOC of a new table entry according to the correctness of its prediction result, including: if the prediction result is correct, the allocation enable signal ALLOC is assigned a value of 0; if the prediction result is wrong, the allocation enable signal ALLOC is assigned a value of 1; The updating step of the allocation enable signal ALLOC comprises: S1: Record the saturation counter value of the hit table entry in the Provider as ctr P , if |2×ctr P +1|≤1 and the prediction result of Provider is correct, then update the allocation enable signal ALLOC to 0, otherwise do nothing; jump to S2; S2: If the prediction result of the TAGE branch predictor is wrong, a random number rand is generated with a value range of 0 to (MINAP-1), where MINAP is a constant that increases as M increases; The TAGE branch predictor determines whether the random number rand is not less than the allocation throttling function value. If not, the allocation enable signal ALLOC is updated to 0; if yes, no operation is performed; The allocation throttling function is: f(tage_cat[INDCAT])=(tage_cat[INDCAT]×MINAP) / (CATMAX+1) Among them, if the prediction result of Alternator is correct, INDCAT is 1, if it is incorrect, INDCAT is 0; NUM_tagged k is the number of entries in each tagged component; The updating process of the independent variable tag_cat[INDCAT] of the allocation throttling function includes: Step 1: Place component T i The saturation counter value of the internal hit table entry is recorded as ctr i , and initialize the variables NUM_MLConf_ctr and state_u to 0; Step 2: TAGE branch predictor from component T P+1 Start looping over component T i If the u bit of the index table entry is 0, the variable state_u is recorded as 1; if |2×ctr i +1| is equal to 3, then the variable NUM_MLConf_ctr is incremented by 1; if |2×ctr i +1| is equal to 1, then exit this loop immediately and jump to step 3; Step 3: Update tag_cat[INDCAT] using the values of NUM_MLConf_ctr and state_u obtained in step 2. The update formula is: tag_cat[INDCAT]=tage_cat[INDCAT]+3-3×NUM_MLConf_ctr-state_u Step 4: If the value of tage_cat[INDCAT] is less than 0, assign tage_cat[INDCAT] to 0; if the value of tage_cat[INDCAT] is greater than CATMAX, assign tage_cat[INDCAT] to CATMAX; otherwise, keep the original value unchanged.
2. The method according to claim 1, characterized in that The TAGE branch predictor determines whether a new table entry needs to be allocated to the TAGE branch predictor according to the state of the allocation enable signal ALLOC, including: If ALLOC is equal to 1, the TAGE branch predictor allocates a new table entry; if ALLOC is equal to 0, no new table entry is allocated and the next branch prediction is awaited.
3. The method according to claim 2, characterized in that The allocation of the new table entry includes: TAGE branch predictor from component T P+1 Start looping over component T i The index table entries in the group are selected to allocate a group of index table entries with the smallest component number and meeting the allocation conditions; for the index table entries that do not meet the allocation conditions, their saturation counter values are decayed.
4. The method according to claim 3, characterized in that The allocation conditions are: u bit is 0 and |2×ctr i +1|≤3.
5. The method according to claim 4, characterized in that The method of decaying the saturation counter value includes: if ctr i If it is greater than 0, ctr i Decrement by 1, if ctr i If it is less than 0, ctr i Add 1 to itself.
6. The method according to claim 5, characterized in that The value range of MINAP is 4-8.
Citation Information
Patent Citations
Instruction branch prediction method
CN111258654A
Branch instruction prediction-oriented deviation corrector and method
CN112988233A
Branch predictor and processor
JP2013058135A
Efficient random number generation for update events in multi-bank conditional branch predictor
US20180136937A1
