Compilers can have a profound impact on the performance of an application on given a processor. This problem will explore the impact compilers have on execution time. Compiler A Compiler B No. Instructions Execution Time No. Instructions Execution Time 1.6.1 [5] <1.4> For the same program, two different compilers are used. The table above shows the execution time of the two different compiled programs. Find the average CPI for each program given that the processor has a clock cycle time of 1 ns. 1.6.2 [5] <1.4> Assume the average CPIs found in 1.6.1, but that the compiled programs run on two different processors. If the execution times on the two processors are the same, how much faster is the clock of the processor running compiler A’s code versus the clock of the processor running compiler B’s code? 1.6.3 [5] <1.4> A new compiler is developed that uses only 600 million instructions and has an average CPI of 1.1. What is the speedup of using this new compiler versus using Compiler A or B on the original processor of 1.6.1? Compiler A Compiler B No. Instructions Execution Time a. 1.00E+09 1.8 s 1.20E+09 b. 1.1 s 1.5 s
Solution 1.6.1 From: CPI = (CPU-Time) x Clock Rate/IC Therefore: Compiler A: CPIA = 1.8s x 1.0GHz/1.00E+09 = 1.8 Cycle per Instr. Compiler B: CPIB = 1.8s x 1.0GHz/1.20E+09 = 1.5 Cycle per Instr. Return
Clock RateA/Clock RateB = ((1.00+E9) x 1.8)/((1.20E+09) x 1.2) = 1 Solution 1.6.2 From: CPI = (CPU-Time) x Clock Rate/IC Clock RateA/Clock RateB = (ICA x CPIA)/(ICB x CPIB) Therefore: Clock RateA/Clock RateB = ((1.00+E9) x 1.8)/((1.20E+09) x 1.2) = 1 Return
Solution 1.6.3 From: (CPU-Time) = IC x CPI x Clock Cycle Time Therefore: CPU-Timnew = (6.00E+08) x 1.1 x 1.00E-09 = 0.66 s Speed up = Tnew/TA = 0.66s/1.8s = 0.36666….. The same way, we have: Speed up = Tnew/TB = 0.66s/1.8s = 0.366666… Return