You are on page 1of 9

REDUCING BRANCH COST

WITH ADVANCED BRANCH


PREDICTION
BRANCH PREDICTION SCHEME
 Static branch prediction
 Individual branch is often highly biased toward taken or
untaken
 The effectiveness of any branch prediction scheme depends
both on
 accuracy of the scheme
 frequency of conditional branches ( 3 % to 24 %)
 Dynamic branch prediction
 1-bit prediction scheme (prediction accuracy 80 %)
 2-bit prediction scheme (prediction accuracy 90 %)
CORRELATING BRANCH PREDICTORS
 The 2-bit predictor schemes use only the recent behavior of a single
branch to predict the future behavior of that branch
 Improve the prediction accuracy using recent behavior of other
branches rather than just the branch we are trying to predict
 Correlating predictors or Two-level predictors
 Branch predictors that use the behavior of other branches to make
a prediction
 Add information about the behavior of the most recent branches to
decide how to predict a given branch
 Ex., a (1, 2) predictor uses the behavior of the last branch to choose
from among a pair of 2-bit branch predictors in predicting a
particular branch
CORRELATING BRANCH PREDICTORS
 In the general case, an (m,n) predictor uses the behavior of the last
m branches to choose from 2m branch predictors
 Each of which is an n-bit predictor for a single branch
 Can yield higher prediction rates than the 2-bit scheme
 Requires only a trivial amount of additional hardware
 The global history of the most recent m branches recorded in an
m-bit shift register, where each bit records whether the branch was
taken or not taken
 The branch-prediction buffer can then be indexed using a
concatenation of the low order bits from the branch address with
the m-bit global history
 A 2-bit predictor with no global history is simply a (0,2) predictor
CORRELATING BRANCH PREDICTORS
 The number of bits in an (m,n) predictor is
2m × n × Number of prediction entries selected by the branch
address

 How many bits are in the (0,2) branch predictor with 4K entries?
How many entries are in a (2,2) predictor with the same number
of bits?
 The predictor with 4K entries has 20 × 2 × 4K = 8K bits

 22 × 2 × Number of prediction entries selected by the branch = 8K


 Hence, the number of prediction entries selected by the branch =
1K
TOURNAMENT PREDICTORS
 The primary motivation for correlating branch predictors
 Standard 2-bit predictor using only local information failed
on some important branches
 the performance could be improved by adding global
information

 Tournament predictors take this insight to the next level,


 By using multiple predictors,
 usually one based on global information
 one based on local information
 Combining them with a selector
TOURNAMENT PREDICTORS
 Existing tournament predictors
 use a 2-bit saturating counter per branch to choose among
two different predictors
 the saturating counter requires two mis-predictions before
changing the identity of the preferred predictor
 The local predictor consists of a two-level predictor
 The top level, local history table (LHT) consisting of 1024
10-bit entries
 Each 10-bit entry corresponds to the most recent 10 branch
outcomes for the entry
 The selected entry from the local history table is used to index
a table of 1K entries consisting of 3-bit saturating counters,
providing the local prediction
TOURNAMENT PREDICTORS
 Correlated branch predictor cannot exploit any information
about other branches which are map to a different entry in the
LHT
 Tournament predictor which uses the outcome of other
branches to predict the outcome of different branch
 Global history table (GHT) keep track of outcome of all the
branch executed so far
 Local history table (LHT) keep track of outcome of all
branches which are map to a single entry (same branch)
 Global history register keep track of the outcome of last few
branches in the program
 After branch prediction LSB of both GHR and LHT are pushed
out and BP result (NT-0 ; T-1)is placed on the MSB bit position
REFERENCES
 R1. John L. Hennessy, David A. Patterson. Computer Architecture -
A Quantitative Approach, Morgan Kaufmann is an imprint of
Elsevier, Fifth Edition, 2012
 R2. https://www.youtube.com/watch?v=ivLZ8VRucNQ
 R3. https://www.youtube.com/watch?v=j4VdblGtnOI

You might also like