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 |
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.
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)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.
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.CPI added is 5.0 x 12 / 1000 = 0.060. Halving MPKI or halving penalty each halve it to 0.030.
Branch frequency rose to offset it, or the gains came on rare branches. CPI follows MPKI times penalty, not accuracy alone.