Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(e) Suppose two different compilers, compiler A and compiler B, are used to comp

ID: 3802457 • Letter: #

Question

(e) Suppose two different compilers, compiler A and compiler B, are used to compile a program P thereby generating two versions, PA and PB, of program P. The table below shows the latency and dynamic instruction count of the program P. i. Compute the average overall CPI for program PA and PB if each program executes on a CPU with an operating time period of 1 ns per cycle. ii. Assume the average CPIs computed for PA and PB found in part (i), except that now programs PA and PB execute on two different CPUs. If the execution times on the two CPUs are the same, how much faster is the clock frequency of the CPU executing program PA versus the clock frequency of the CPU executing program PB? iii. A new compiler C is designed. Program P is compiled on compiler C and compiler C generates program version program PC. Program PC comprises 600M instructions and has an average CPI of 1.1 cycles/instr. when executing on the CPU of part (i). What is the speedup of executing program PC on the CPU of part (i) versus executing programs PA and PB on the same CPU?

Explanation / Answer

Solution:

(i)

For Compiler A

What we have: Latency= 1.1s, Instruction count= 1.0*10^9 and

For Compiler B

What we have: Latency= 1.5s, Instruction count= 1.2*10^9

Avg CPI= (1.1+1.5)/((10^9*10^-9)+(1.2*10^9*10^-9))= 1.18181818182

(ii) Suppose now both the compilers are taking 1s to execute.

Now CPI of A= 1/((10^9*10^-9)= 1

and CPI of B= 1/(1.2*10^9*10^-9)= 0.833333

Speedup= 1/0.83333= 1.2, this means that CPU A's clock frequency needs to be 1.2 times faster than the current clock speed.

(iii)

Avg CPI of PA and PB is= 1.181818

and for compiler C it is= 1.1

Speedup= 1.181818/1.1= 1.07438, this means that Program A and B together on the same CPU will be 1.07438 times faster.