edited by
935 views
13 votes
13 votes

Consider a five-stage pipeline with ideal CPI. Assume that $25\%$ of the instructions executed are branch instructions out of which $75\%$ are taken branches. If the branch target is known at the end of EX stage, what will be the pipeline speedup if taken is the default branch prediction and branch misprediction penalty on average is $10$ cycles?

  1. $3.34$
  2. $3.07$
  3. $4.00$
  4. $4.11$
edited by

2 Answers

Best answer
13 votes
13 votes
When taken branch is the actual branch target we have no penalty.

When taken branch is not the actual branch target (fall through is the actual branch target), we will know this after EX stage. And this has a $10$ cycle penalty on average.
    
So, effective instruction execution time with pipeline
    
$ = 1 + \text{Misprediction Penalty}$

$\quad = 1 + 0.25 \times 0.25 \times 10$
    
$\qquad =   1.625$
    
Speedup  $=\dfrac{\text{Depth}}{1.625} = \dfrac{5}{1.625} = 3.076.$
selected by
1 votes
1 votes

Why is it not solved in this way:

 

Fraction of non-branch instructions = 0.75

Fraction of branch instructions = 0.25

CPI of non-branch instructions (ideal CPI) = 1

CPI of branch instructions = (0.75 * 1 + 0.25 * 10) = 3.25, since 75% instructions don’t lose cycles due to correct branch predictions

 

Avg. CPI with pipelining = 0.75 * 1 + 0.25 * 3.25 = 1.5625

CPI without pipelining = 5

Speedup = 5 / 1.5625 = 3.2

Answer: