Consider this question: A program has 1M instructions and 30% of them are SQRT with CPI=8. The CPI of the rest of the instructions are 3. If we reduce the CPI of SQRT to 2, how much speedup is obtained?

I have two solutions for that:

1- Using Amdahl's law, We have

 S= --------------------
      (1-alpha) + alpha

So, we have 1/(0.7+(0.3/4)) where 0.7 is the fraction that is not affected. and 4 is the speedup of reducing CPI of SQRT from 8 to 2. That speedup will be 1.29.

2- We can calculate

CPI_avg = sigma( I * CPI_class )

and we know SQRT instructions are 300K and the rest are 700K. So

CPI_old = (300000*8 + 700000*3) / 1000000 = 4.5
CPI_new = (300000*2 + 700000*3) / 1000000 = 2.7

So, the speedup will be 4.5/2.7 which is 1.66

The question is, which one is correct? 1.29 or 1.66?


1 Answer 1


Amdahl’s formula assumes that you know the percentage of execution time, but you only know the percentage of instruction. The percentage of execution time is 53.33%, not 30%.

The approach “total time before, divided by total time after” also works in more complicated cases.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.