CS 3853 Computer Architecture Notes on Chapter 3 Section 3
Read Section 3.3
3.3: Reducing Branch Costs with Advanced Branch Prediction
Review of Branch Prediction from Appendix C
- Static Branch Prediction:
- Run the program.
- For each branch, record how often it is taken.
- Use this info to predict that branch on later runs.
- Dynamic Prediction using prediction buffers
- Use an array of size k, each containing a branch predictor.
- A branch at address n uses the entry at position n mod k.
- A 2-bit predictor only changes the prediction if branch does the same thing (taken or not) 2 times in a row.
- These predictors can keep misprediction rates below 7% for some SPEC benchmarks.
Correlating Branch Predictors
- A 2-bit predictor uses recent behavior of a single branch.
- Can do better if we also look at behavior of nearby branches.
- Correlating branch predictors are also called 2-level predictors.
- Use multiple 2-bit predictors, one for each combination of the results of the last n branches.
- Example: a (1,2) predictor uses the last (one) branch to choose one of 2 2-bit predictors.
- An (m,n) predictor uses the last m branches (2m possibilities) to choose among 2m
n-bit predictors.
- These predictors can keep misprediction rates below 4% for some SPEC benchmarks.
Tournament Predictor
- Use multiple predictors (usually both local and global).
- Choose among them dynamically based on which predictors are working the best.
- These predictors can keep misprediction rates below 3% for some SPEC benchmarks.