CPU Design · All levels
Branch Prediction & Speculation
Prediction structures and recovery behavior that control wrong-path cost and front-end stability.
Section goal
Prediction structures and recovery behavior that control wrong-path cost and front-end stability.
How to study this section
Start with each topic hub to establish mechanism-first framing.
Use reports and debug pages to separate symptoms from root cause.
Practice worked examples and interview drills under fixed metadata.
Close with checklist and silicon impact before signoff claims.
Topics
predictor-types-and-accuracy/ - Predictor Types and Accuracy
btb-and-return-stack/ - BTB and Return Stack
indirect-branch-prediction/ - Indirect Branch Prediction
mispredict-penalty-recovery/ - Mispredict Penalty and Recovery
Related topics
CPU deep dive
Speculation helps only when wrong-path cost and recovery bandwidth are tightly controlled.
Concept diagram
SPECULATION LOOP
predict direction/target -> speculative fetch/decode -> resolve -> flush/recoverMetric graph
SPECULATION COST MIX
wrong-path decode work █████
flush recovery delay ████
refill starvation ███Reports and artifacts
branch accuracy by workload
BTB/RAS pressure report
mispredict recovery timeline
bad-speculation CPI share
Mini case study
Indirect branch aliasing in one service raised wrong-path work enough to dominate total CPI despite high ALU utilization.
Debug branches
Break down mispredicts by branch family and code region
Measure flush depth and refill bandwidth separately
Validate predictor changes under security mitigation settings
Senior review question
Ask: which CPI/latency evidence proves this topic is truly closed beyond synthetic benchmarks?