160 likes | 398 Views
CPU Performance using Different Parameters. CS 250: Andrei D. Coronel, MS,CEH,PhD Cand. CPU time. CPU time = CPU clock cycles for a program X Clock cycle time = CPU clock cycles for a program Clock rate. CPI (Cycles per Instruction). Cycles per Instruction
E N D
CPU Performance using Different Parameters CS 250: Andrei D. Coronel, MS,CEH,PhD Cand
CPU time CPU time = CPU clock cycles for a program X Clock cycle time = CPU clock cycles for a program Clock rate
CPI (Cycles per Instruction) Cycles per Instruction = CPU clock cycles for a program Instruction count Therefore: CPU clock cycles for a program = CPI * IC
Replace “clock cycles for a program” with (CPI*IC) CPU time = CPU clock cycles for a program X Clock cycle time = CPU clock cycles for a program Clock rate = (CPI * IC) * Clock cycle time = (CPI * IC) Clock rate
CPU performance is dependent on 3 factors • Clock cycle time • Cycles per Instruction (CPI) • Instructions per program • It is difficult to change one parameter in complete isolation from others because the basic technologies involved in changing each characteristic are also interdependent
CPU performance is dependent on 3 factors • Clock cycle time • Hardware technology and organization • Cycles per Instruction (CPI) • Organization and Instruction Set architecture • Instructions per program • Instruction set architecture and compiler technology
Another look at CPI * IC • CPU clock cycles = CPI * IC • Actual number of cycles per instruction multiplied by the actual number of that instruction in a program • However there may be more than one type of instruction
This is better CPU clock cycles = Σ CPIi * ICi Where i = 1 to n
Formula adjustment CPU time = (Σ CPIi * ICi ) * clock cycle time
Overall CPI therefore… CPI = (Σ CPIi * ICi ) IC
Overall CPI therefore… CPI = (Σ CPIi * ICi ) IC = Σ CPIi * (ICi ) IC
A familiar problem • FPSQR (floating pt sq root) is responsible for 20% of the exec time of a machine • FP instructions are responsible for 50% of the execution time • Which is faster? • Add FPSQR hardware that can speed up this operation by 10 • Make all FP instructions twice faster
Option A • Fractionenhanced = 20% • Speedupenhanced = 10 SpeedupFPSQR = 1 (1 – 0.2) + 0.2/10) = 1.25
Option B • Fractionenhanced = 50% • Speedupenhanced = 2 SpeedupFPSQR = 1 (1 – 0.5) + 0.5/2) = 1.33
Problem • Suppose we have made the following measurement: • Frequency of all FP operation = 25% • Average CPI of FP operations excluding FPSQR = 4.0 • Average CPI of all other (non-FP) instructions = 1.33 • Frequency of FPSQR = 3% • CPI of FPSQR = 20 • Assume that the two design alternatives are to reduce the CPI of FPSQR to two, or to reduce the CPI of all FP operations to 2
Answer • CPI original = 1.33 * (1 - 0.25) + 4 * (0.25 - 0.03) + 20 * (0.03) • = 2.4775 • CPI new FPSQR = 1.33 * (1 - 0.25) + 4 * (0.22) + 2 * (0.03) = 1.9375 • CPI new FP = 1.33 * (1- 0.25) + 2 * (0.22) + 2 * (0.03) = 1.4975 • Speedup = 2.4775 / 1.4975