Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Architecture Metrics Reference
  • Workload Taxonomy for Architects
  • Architecture Glossary
  • Computer Architecture Cheatsheet
  • Pipeline Fundamentals14
    • Pipeline Throughput
    • Branch Prediction and Fetch
      • Predictor Structures
      • MPKI and Recovery Math
      • Fetch and Recovery Pipeline
      • Tuning, Cost and Interviews
    • Out-of-Order Superscalar Execution
  • Memory Hierarchy15
  • NoC and Interconnect Architecture6
  • Coherency and Memory Ordering9
  • Performance Analysis9
  • Accelerator Architectures6
  • SoC Architecture Tradeoffs9
  • Architecture Interview Prep14
Loading lesson

‹Branch Prediction and Fetch
  1. Topics
  2. Computer Architecture
  3. Pipeline Fundamentals
  4. Branch Prediction and Fetch
  5. MPKI and Recovery Math

Computer Architecture · All levels

MPKI and Recovery Math

MPKI, accuracy and recovery penalty tied to CPI with hand-checkable numbers.

On this page

    MPKI and accuracy

    MPKI counts mispredicts per thousand instructions: misses times 1000 divided by instructions. Accuracy percent counts correct predictions per hundred branches.

    The two disagree whenever branch frequency shifts. High accuracy on rare branches still leaves MPKI low, while modest accuracy on dense branches drives MPKI up.

    Assume 120 branches per 1000 instructions: 85 conditional, 10 indirect, 25 return. Each accuracy below is one minus its misses over its count.

    Branch type

    Misses per 1000 instr

    Accuracy

    MPKI contribution

    Conditional

    3.4 of 85

    96.0%

    3.4

    Indirect

    1.9 of 10

    81.0%

    1.9

    Return

    0.8 of 25

    96.8%

    0.8

    Total

    6.1 of 120

    94.9% overall

    6.1

    Penalty in CPI terms

    Each mispredict burns recovery cycles, so CPI added equals MPKI times penalty divided by 1000. Recovery severity needs both average and percentile cycles times frequency.

    Wrong-path uops add a second tax. They occupy issue slots and ROB entries that useful work could have used.

    Diagram
    CPI_add = MPKI x penalty / 1000
    before: 7.68 x 11.4 / 1000 = 87.552 / 1000 = 0.0876 (about 0.088)
    after:  6.12 x 11.2 / 1000 = 68.544 / 1000 = 0.0685 (about 0.069)
    delta:  0.087552 - 0.068544 = 0.019008 (about 0.019 CPI saved)

    Worked numbers

    Assume the branch-prediction tune with MPKI falling 7.68 to 6.12 (about 7.7 to 6.1) at average recovery 11.4 to 11.2 cycles. The CPI saving is about 0.019 by the formula above.

    Observed IPC rises 1.27 to 1.30, which is CPI 0.787 to 0.769, a delta of 0.018. That matches the predicted 0.019 within rounding, with a small wrong-path-uop improvement (16.0 to 15.4 percent) covering the rest.

    Diagram
    CPI = 1 / IPC
    before: 1 / 1.27 = 0.7874 (about 0.787)
    after:  1 / 1.30 = 0.7692 (about 0.769)
    delta:  0.7874 - 0.7692 = 0.0182 (about 0.018)
    Compare with 0.019 from MPKI math: consistent within rounding plus wrong-path gain.

    Common pitfall

    Quoting accuracy alone hides the cost. A 94.9 percent accuracy still adds about 0.069 CPI at these MPKI and penalty values, so always pair accuracy with MPKI and penalty.

    Check yourself MPKI is 5.0 and penalty is 12 cycles. What CPI is added, and what halves it?

    CPI added is 5.0 x 12 / 1000 = 0.060. Halving MPKI or halving penalty each halve it to 0.030.

    Check yourself Accuracy rises but MPKI is flat. What happened?

    Branch frequency rose to offset it, or the gains came on rare branches. CPI follows MPKI times penalty, not accuracy alone.

    Related topics

    • Performance method

    • Pipeline throughput

    Previous

    11 / 86

    Next: Fetch and Recovery Pipeline

    Up next

    Up nextFetch and Recovery Pipeline

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Tuning, Cost and Interviews