![Page 1: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/1.jpg)
Prophet/Critic Hybrid Branch Prediction
Falcon, Stark, Ramirez, Lai, ValeroPresenter: Christian Wanamaker
![Page 2: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/2.jpg)
Outline
Overview & MotivationHybrid Branch PredictionThe Prophet/Critic Branch PredictorResultsConclusions
![Page 3: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/3.jpg)
Overview
Better Branch Prediction is a highly desirable technique because it does not require trade-offs between performance, power, and energy
Despite much research on Branch Prediction, it is by no means solved
Branch prediction is liable to become even more important as pipelines deepen and issue-widths increase
![Page 4: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/4.jpg)
Overview (continued)
Issue width = # of uOps (micro ops) issued per clock cycle
Using the Branch Target Buffer to look ahead for branches
Perceptrons – simple neural network. Can look at a longer history than simpler counters.
![Page 5: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/5.jpg)
Hybrid Branch Predictors
• Use two or more different branch prediction techniques
• One may override another (either based on a third selector or one may always override)
• The predictions may be combined, for instance as a majority vote
• Example: Tournament predictors (often a branch prediction buffer and a Correlating branch predictor with a third predictor choosing which of the two is used in this situation)
![Page 6: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/6.jpg)
Prophet/Critic Branch Predictor
Basic Idea – the Prophet makes a series of predictions of future branches, the Critic critiques and if necessary alters them.
The Prophet makes predictions based on the history of the branch.
The Critic looks at the branches prediction of the Prophet after the prophet has predicted a certain number of steps ahead, then critiques the prophecy
![Page 7: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/7.jpg)
Prophet Critic Basics
BTB looks ahead, Prophet predicts whether BTB branches are taken/not taken
Branch Outcome Register – the predictions that are in the critics “future” - the number of future bits allowed.
More future bits allow for more accurate viewing of the future
![Page 8: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/8.jpg)
Prophet Critic Basics
![Page 9: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/9.jpg)
Prophet Critic Basics
The branch predictions are kept in the Fetch Target Queue (FTQ)
Once the future bits are received, the critic makes it’s pronouncement
The critic overrides the prophet if it comes to a different conclusion
If so, the FTQ is purged of un-critiqued predictions, and the prophet is redirected to the path shown by the critic
![Page 10: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/10.jpg)
Prophet/Critic Architecture (cont)
![Page 11: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/11.jpg)
Prophet/Critic: How it works
![Page 12: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/12.jpg)
Prophet Critic: How it works
The Prophet will mispredict AThe Critic will note that the Prophet
mispredicted in this case the first time the misprediction occurs.
In the future, when the Critic sees the misprediction, it will correct it
More future bits increase the accuracy of prediction, but reduce the history, so there is an important tradeoff here.
![Page 13: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/13.jpg)
Prophet/Critic Filtering
The critic can be limited by multiple branches contending for the same resources
In addition, the critic is not always correctSo, easy to predict branches should be
filtered outThis is achieved with tags that are set when a
mispredict occcursIf not tagged, the critic’s critique is ignored.
![Page 14: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/14.jpg)
Prophet/Critic Filtering
![Page 15: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/15.jpg)
Testing and Result Testing was done on a cycle
accurate IA32 with Long Instruction Traces
The simulator had to follow bad branches, as otherwise the critic would not learn.
Branch Predictors: Gshare, 2bc-gskew, perceptron
uPC is uOps per cycle misp/kuops is misses per
thousand uops
![Page 16: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/16.jpg)
Hardware Budgets and predictor types
![Page 17: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/17.jpg)
Results of varying Future Bits
![Page 18: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/18.jpg)
Results
![Page 19: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/19.jpg)
Results
![Page 20: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/20.jpg)
Results
![Page 21: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/21.jpg)
Conclusions
Speedup of up to 8% with 12 future bits (using the same amount of branch prediction space)
The mispredict rate can be reduced up to 25-31%
Adding future bits helps, but more is not always better
Research suggests that the best future bits can be chosen dynamically
![Page 22: Prophet/Critic Hybrid Branch Prediction Falcon, Stark, Ramirez, Lai, Valero Presenter: Christian Wanamaker](https://reader030.vdocuments.site/reader030/viewer/2022032522/56649d6b5503460f94a4b039/html5/thumbnails/22.jpg)
Thank you
Any questions?