Download presentation
Presentation is loading. Please wait.
1
Two-Level Adaptive Dynamic Branch Prediction Jeroen Lichtenauer
2
Contents The problem to be solvedThe problem to be solved Solutions OverviewSolutions Overview Prediction counterPrediction counter Two-Level Adaptive Branch PredictionTwo-Level Adaptive Branch Prediction SummarySummary ConclusionConclusion Related WorkRelated Work
3
Literature A Comparison of Dynamic Branch Predictors that use Two Levels of Branch History. Tse-Yu Yeh and Yale N. Patt. Department of Electrical Engineering and Computer Science. The University of Michigan, 1993 Also important:A Comparison of Dynamic Branch Predictors that use Two Levels of Branch History. Tse-Yu Yeh and Yale N. Patt. Department of Electrical Engineering and Computer Science. The University of Michigan, 1993 Also important: Target Prediction for Indirect Jumps Po-Yung Chang, Eric Hao and Yale N. Patt. Department of Electrical Engineering and Computer Science. The University of Michigan, 1997Target Prediction for Indirect Jumps Po-Yung Chang, Eric Hao and Yale N. Patt. Department of Electrical Engineering and Computer Science. The University of Michigan, 1997
4
Problem Increase in issue rateIncrease in issue rate Increase in pipeline depthIncrease in pipeline depth More speculative executionMore speculative execution More penalty for misprediction of branchesMore penalty for misprediction of branches Successful Branch Prediction becomes more and more important for reducing execution time!!
5
Solutions overview Static predictionStatic prediction –During compilation Dynamic predictionDynamic prediction –Hardware, for instance using branch history A combinationA combination –Compiler Synthesized Dynamic Branch Prediction
6
Prediction Counter Increase 1 if branch takenIncrease 1 if branch taken Decrease 1 if branch not takenDecrease 1 if branch not taken Predict taken if counter value larger than half of the rangePredict taken if counter value larger than half of the range 2 bit counter: 00 & 01 = Predict not taken 10 & 11 = Predict taken
7
Two-Level Adaptive Branch Prediction First level, execution history register(s): History of the last k branches encountered.First level, execution history register(s): History of the last k branches encountered. Second level, pattern history table(s): k refers to a place in the pattern history table that contains the prediction based on the outcome of the branches at the last j occurences of k, Predictor is for instance a prediction counter.Second level, pattern history table(s): k refers to a place in the pattern history table that contains the prediction based on the outcome of the branches at the last j occurences of k, Predictor is for instance a prediction counter.
8
1st Level Branch History Register or Table (BHR or BHT) Global History of all branches kept in a single register of length k.Global History of all branches kept in a single register of length k. Per-address Table that contains a history register of length k for each branch.Per-address Table that contains a history register of length k for each branch. Per Set Table that contains a history register of length k for each set of branches.Per Set Table that contains a history register of length k for each set of branches.
9
2nd level Pattern History Table (PHT) global Table with a prediction for all possible values of k.global Table with a prediction for all possible values of k. per-address Table with a prediction for all possible values of k for each branch address.per-address Table with a prediction for all possible values of k for each branch address. Per set Table with a prediction for all possible values of k for each branch set.Per set Table with a prediction for all possible values of k for each branch set.
10
The 9 Variations of 2-Level Adaptive Branch prediction
13
1 Global Branch History(GAs), function of History Length
14
1 Global Branch History(GAs), function of Pattern Tables
15
Per-Address Branch History(PAs) function of History length
16
Per-Address Branch History(PAs) function of Pattern Tables
17
Per-Address Branch History(PAs), function of PHTs
18
1 Global Branch History(GAs), function of PHTs 1 Global Branch History(GAs), function of PHTs
19
Per-Set Branch History(PAs), function of PHTs
20
Interpretation of results Pattern tables(PHTs) always best per-set (*As) or global (*Ag). *Ap is useless.Pattern tables(PHTs) always best per-set (*As) or global (*Ag). *Ap is useless. Global History schemes(GAs) perform best on integer programs, but only at high cost.Global History schemes(GAs) perform best on integer programs, but only at high cost. Per-address History schemes (PAs) perform better on floating point programs, even at low cost.Per-address History schemes (PAs) perform better on floating point programs, even at low cost. Per-set History schemes (SAs) can reach best overall performance, but have the highest cost so not cost-effective.Per-set History schemes (SAs) can reach best overall performance, but have the highest cost so not cost-effective.
21
Branch prediction is a very important factor in reducing CPI in modern processors that use extensive pipelining.Branch prediction is a very important factor in reducing CPI in modern processors that use extensive pipelining. A counter is often used for prediction (2 bit)A counter is often used for prediction (2 bit) Two-Level Adaptive Dynamic Branch Prediction ‘learns’ the outcome of branches in different program states.Two-Level Adaptive Dynamic Branch Prediction ‘learns’ the outcome of branches in different program states. 9 Variations of 2-L.A.B.P. (Global, Per-Address and Per-Set for both levels), but only 4 useful.9 Variations of 2-L.A.B.P. (Global, Per-Address and Per-Set for both levels), but only 4 useful.Summary
22
Two-level Adaptive Branch Prediction is very effective, up to +97% average accuracy.Two-level Adaptive Branch Prediction is very effective, up to +97% average accuracy. BHR length has more influence on precision then number of PHTs.BHR length has more influence on precision then number of PHTs. Pattern tables(PHTs) always per-set (*As) or even just 1 global table (*Ag).Pattern tables(PHTs) always per-set (*As) or even just 1 global table (*Ag). At low cost PAs is best, at high cost GAs is bestAt low cost PAs is best, at high cost GAs is bestConclusion
23
Compiler Synthesised Dynamic Branch Prediction Scott Mahlke and Balas Natarajan Hewlett-Peckard Laboratories, Palo Alto, 1996 Uses not only branch history but also other info, for instance the contents of the architectural registers. This does not provide significant better prediction results then 2- Level Branch Predictors.Compiler Synthesised Dynamic Branch Prediction Scott Mahlke and Balas Natarajan Hewlett-Peckard Laboratories, Palo Alto, 1996 Uses not only branch history but also other info, for instance the contents of the architectural registers. This does not provide significant better prediction results then 2- Level Branch Predictors. The Effect of Process Switches on Branch Prediction Accuracy T. Kisuki, H. Corporaal and P.M.W. Knijnenburg Department of Computer Science, Leiden University Department of Electrical Engineering, Delft University of Technology 1999 The effect of ‘cold starts’ after process switches is only significant if the process switches occur more than once every 100K clock cycles.The Effect of Process Switches on Branch Prediction Accuracy T. Kisuki, H. Corporaal and P.M.W. Knijnenburg Department of Computer Science, Leiden University Department of Electrical Engineering, Delft University of Technology 1999 The effect of ‘cold starts’ after process switches is only significant if the process switches occur more than once every 100K clock cycles. Related Work
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.