Presentation is loading. Please wait.

Presentation is loading. Please wait.

Analysis of Branch Predictors

Similar presentations


Presentation on theme: "Analysis of Branch Predictors"— Presentation transcript:

1 Analysis of Branch Predictors
Guang Pan Ming Lu Dec 12, 2006

2 Outline Motivation Introduction Previous works Our works
Simulation results Conclusion & Recommendations Future works

3 Motivation Branches are very frequent
Approx. 20% of all instructions Accurate branch prediction improves performance of a superscalars or superpipled processor. Decreasing miss prediction rate saves cycles. Decreasing miss prediction rate saves energy.

4 Introduction Need to know two things Direct jumps, function calls
Whether the branch is taken or not (direction) The target address if it is taken (target) Direct jumps, function calls Direction known (always taken), target easy to compute Conditional branches (typically PC-relative) Direction difficult to predict, target easy to compute Indirect jumps, function returns Direction known (always taken), target difficult

5 Introduction (cont’) Framework and traces are based on a branch predictor competition (Championship Branch Prediction) Focused on conditional branches, evaluated several branch predictors by measurements on real traces from IBS (Instruction Benchmark Set) Proposed two closely related modifications of global adaptive prediction mechanisms which can achieve satisfactory accuracy.

6 Previous Works Static predictor
Always predict Not taken (predictor_nottaken) Easy to implement 30-40% accuracy … not so good Always predict Taken (predictor_taken) 60-70% accuracy

7 Previous Works (cont’)
Local 2-bit predictor (with hysteresis) T NT Predict Taken Predict Taken T T NT NT Predict Not Taken Predict Not Taken T NT

8 Previous Works (cont’)
Bimodal predictor With a table of two-bit entries, indexed with the least significant bits of the instruction addresses. Entries typically do not have tags. A particular counter mapped to different branch instructions Each counter has one of four states: Strongly not taken Weakly not taken Weakly taken Strongly taken

9 Previous Works (cont’)
Branch address (4 bits) Correlating predictor Branch outcome correlates with the outcome of some recently executed branches Use this in our prediction Keep N bits of history of recent outcomes Use a different M-addr-bit predictor for each different history Note: N-bit history means 2^N different predictors for each branch 2-bits per branch local predictors Prediction 2-bit global branch history

10 Previous Works (cont’)
Gshare predictor Correlating predictors often wasteful Some histories are rare or even impossible Yet we dedicate a counter for each history Solution: hashing Use a single large predictor table Hash history and branch address together Use the hash to index into the table The hash is just an XOR, so it’s fast K bits of branch instruction address Index XOR Prediction N bits of global branch history Table of 2-bit predictors with 2^max(N,K) entries

11 Previous Works (cont’)
Why Gshare is bad? Needs a lot of branch instances to train the different 2-bit predictors Simple 2-bit predictor Has a prediction after it sees one instance of a branch The gShare predictor Has a prediction after it sees an instance of that branch and that particular history But for the same number of counters, gShare usually gives better prediction accuracy

12 Previous Works (cont’)
Tag-based PPM (Prediction by Partial Matching) predictor PPM was originally introduced for text compression, and it was used in for branch prediction. Tag-based, global-history predictor derived from PPM. Features five tables. (indexed with a different history length) Prediction is given by the up-down saturating counter associated with the longest matching history.

13 Previous Works (cont’)
The PPM predictor features 5 tables. The “bimodal” table on the left has 4k entries, with 4 bits per entry. Each of the 4 other tables has 1k entries, with 12 bits per entry. The table on the right is the one using the more global history bits (80 bits).

14 Our Work Hybrid_vote Predictor
Combination of bimodal, gshare, ppm predictors (hardware achievable) Three predictors predict a conditional branch simultaneously Using voting mechanism to predict Compare the predictions of three predictors Choose the final prediction from the majority. Update each of the predictors by its own updating method.

15 Our Work (Cont’) Hybrid_select Predictor
Combination of bimodal, gshare, ppm predictors (hardware achievable) Three predictors predict a conditional branch simultaneously Using bimodal selecting mechanism to predict Compare the predictions of three predictors Choose the final prediction by: Bimodal >= 2 choose ppm prediction Bimodal < 2 choose gshare prediction Update each of the predictors by its own updating method.

16 Simulation Results

17 Bench mark of MPKI (MPKI = Misses per 1000 Instructions)

18 Simulation Results (Cont’)

19 Simulation Results (Cont’)

20 Simulation Results (Cont’)
MPKI = Misses per 1000 Instructions

21 Simulation Results (Cont’)

22 Conclusion & Recommendations
Identifying a good branch predictor plays an important role in improving performance more effective. By combining current predictors, new hybrid predictors also perform well in the Benchmark. Different structures of branch prediction schemes perform well on different branch structures. The benchmark trace files are in favor of Not taken. Recommendations: For embedded systems -> gshare For desktop/server systems -> ppm, hybrid_vote

23 Future Works Research new methods for selecting more accurate predictions among the predictors. Research new algorithms for implementing more effective and accurate dynamic branch predictors.

24 References [1] David Tarjan & Kevin Skadron, “Merging Path and Gshare indexing in Perceptron Branch Prediction “, ACM Transactions on Architecture and Code Optimization, Vol. 2, No. 3, September 2005, Pages 280–300. [2] Wikipedia.org, “Branch predictor “, [3] A. N. Eden & T. Mudge, “The YAGS Branch Prediction Scheme,” Dept. EECS, University of Michigan, Ann Arbor. [4] Lecture notes, “Branch Prediction”, School of Computing, University of Utah [5] Pierre Michaud, “A PPM-like, tag-based predictor”, [6] John L. Hennessy & David A. Patterson, “Computer Archetecture – A Quantitative Approach”, Third Edition Morgan Kaufmann Publisher, 2003.

25 Thanks and Questions?


Download ppt "Analysis of Branch Predictors"

Similar presentations


Ads by Google