Computer Architecture · Cluster
Branch Prediction
Speculation, misprediction cost, and recovery.
- 01 The Control Hazard and Why Fetch Must Guess the Next Instruction How a pipelined front end turns every branch into a bet, what a wrong bet costs in cycles, and why stalling instead of guessing is worse than it looks.
- 02 Static Branch Prediction and the Branch Delay Slot How compilers and instruction sets answered the control hazard before dynamic predictors existed, and why delay slots were abandoned once pipelines got deeper.
- 03 Two-Bit Saturating Counters and the Bimodal Predictor Why a two-bit hysteresis counter beats a single bit for branch prediction, how the index is computed, and where the table fails: aliasing, short loops, and correlated branches.
- 04 How a Branch Target Buffer Delivers the Target in the Fetch Cycle The BTB supplies a taken branch target before decode, which requires predicting the address as well as the direction and creates its own tagging, aliasing, and coherence problems.
- 05 Global History and the Gshare Index Hashing recent branch outcomes into the predictor index lets one branch learn from another; the mechanism, the XOR that spreads history across sets, and the interference it creates.
- 06 Misprediction Recovery: Checkpoints, Squash, and the Cost of Being Wrong How an out-of-order core unwinds speculative state when a branch resolves wrong, why checkpoints of the rename map beat walking a reorder buffer, and what limits recovery speed.
- 07 Return Address Stacks and the Prediction of Indirect Branches Why returns and indirect jumps cannot be predicted from address history alone, how a call stack mirror in the fetch unit handles returns, and what indirect predictors store instead.
- 08 Aliasing, Tournament Predictors, and Per-Branch Selection When two predictor tables disagree, a choice predictor decides which to believe; the mechanics of tagged entries, confidence counters, and the cost of mispredicting the chooser itself.
- 09 Geometric History Lengths in TAGE Predictors How TAGE uses several tables with exponentially different history lengths, tagged entries, and a usefulness counter to pick the longest matching prediction without collapsing into aliasing.
- 10 Speculative Execution and the Architectural Side Effects of a Wrong Guess Squashing removes speculative state from the architecture but not from caches, predictors, and timing; how that residual state becomes an observable channel and what mitigation costs.