In: Computer Science
Assume a program requires the execution of 50 × 106 FP instructions, 110 × 106 INT instructions, 80 × 106 L/S instructions, and 16 × 106 branch instructions. The CPI for each type of instruction is 1, 1, 4, and 2, respectively. Assume that the processor has a 2 GHz clock rate.
a. Find the execution time?
b. By how much must we improve the CPI of FP instructions if we want the program to run two times faster?
c. By how much must we improve the CPI of L/S instructions if we want the program to run two times faster?
d. By how much is the execution time of the program improved if the CPI of INT and FP instructions is reduced by 40% and the CPI of L/S and Branch is reduced by 30%?
Answer a
Execution time = Total Clock Cycles / Clock Rate
Total Clock cycles = (50 x 106 x 1) + (110 x 106 x 1) + (80 x 106 x 4) + (16 x 106 x 2) = 512 x 106
so, execution time = 512 x 106 / 2 x 109 Hz = 256 ms
Answer b
Now, we want to execute program as 2 times faster by improving the clock cycle for FP instruction
so, assuming FP instruction takes P CPI
Total clock cycles (50 x 106 x P) + (110 x 106 x 1) + (80 x 106 x 4) + (16 x 106 x 2) = (462 + 50P) x 106
Execution time = 256/2 = 128 ms
So, 128 x 10-3 s = (462 + 50P) x 106 / 2 x 109 Hz
462+50P = (128 x 10-3) (2 x 103) = 256
P = - 4.12
New CPI is in negative which means it is not possible to execute program two times faster by Improving the clock cycle of FP instructions
Answer c
Now, we want to execute program 2 times faster by improving the clock cycle for L/S instruction
so, assuming L/S instruction takes P CPI
Total clock cycles (50 x 106 x 1) + (110 x 106 x 1) + (80 x 106 x P) + (16 x 106 x 2) = (192 + 80P) x 106
Execution time = 256/2 = 128 ms
So, 128 x 10-3 s = (192 + 80P) x 106 / 2 x 109 Hz
192+80P = (128 x 10-3) (2 x 103) = 256
P = 0.8
Answer d
(Execution time)new = Total Clock Cycles / Clock Rate
Total Clock cycles = (50 x 106 x 0.6) + (110 x 106 x 0.6) + (80 x 106 x 2.8) + (16 x 106 x 1.4) = 342.4 x 106
so, (Execution time)new = 342.4 x 106 / 2 x 109 Hz = 171.2 ms
Speedup = Execution Time / (Execution time)new = 256/171.2 = 1.495