Example: dental hygienist

CPU Performance Evaluation: Cycles Per Instruction (CPI)

EECC550 EECC550 --ShaabanShaaban#1 Lec # 3 Winter 2011 12-6-2011 CPU Performance Evaluation: CPU Performance Evaluation: Cycles Per Instruction (CPI) Cycles Per Instruction (CPI) Most computers run synchronously utilizing a CPU clock running at a constant clock rate:where: Clock rate = 1 / clock cycle The CPU clock rate dependson the specific CPU organization (design)and hardware implementation technology (VLSI)used. A computer machine (ISA) Instruction is comprised of a number of elementary or micro operationswhich vary in number and complexity depending on the the instructionand the exact CPU organization (Design). A micro operationis an elementary hardware operation that can be performed during one CPU clock cycle. This corresponds to one micro- Instruction in microprogrammed CPUs.

Dec 06, 2011 · EECC550 - Shaaban #3 Lec # 3 Winter 2011 12-6-2011 • For a specific program compiled to run on a specific machine (CPU) “A”, has the following parameters: – The total executed instruction count of the program. – The average number of cycles per instruction (average CPI). – Clock cycle of machine “A” • How can one measure the performance of this …

Tags:

  Programs, Performance

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of CPU Performance Evaluation: Cycles Per Instruction (CPI)

1 EECC550 EECC550 --ShaabanShaaban#1 Lec # 3 Winter 2011 12-6-2011 CPU Performance Evaluation: CPU Performance Evaluation: Cycles Per Instruction (CPI) Cycles Per Instruction (CPI) Most computers run synchronously utilizing a CPU clock running at a constant clock rate:where: Clock rate = 1 / clock cycle The CPU clock rate dependson the specific CPU organization (design)and hardware implementation technology (VLSI)used. A computer machine (ISA) Instruction is comprised of a number of elementary or micro operationswhich vary in number and complexity depending on the the instructionand the exact CPU organization (Design). A micro operationis an elementary hardware operation that can be performed during one CPU clock cycle. This corresponds to one micro- Instruction in microprogrammed CPUs.

2 Examples: register operations: shift, load, clear, increment, ALU operations: add , subtract, etc. Thus:A single machine Instruction may take one or more CPU Cycles to complete termed as the Cycles Per Instruction (CPI). Average (or effective) CPI of a program:The average CPI of all instructions executed in the program on a given CPU : Chapter 1 ( , , )3rdEdition: Chapter 4 Clock cyclecycle 1cycle 2cycle 3 Cycles /sec = Hertz = HzMHz = 106Hz GHz = 109 HzInstructions Per Cycle = IPC = 1/CPIf = 1 /C Or clock frequency: fEECC550 EECC550 --ShaabanShaaban#2 Lec # 3 Winter 2011 12-6-2011 Generic CPU Machine Instruction Processing StepsGeneric CPU Machine Instruction Processing StepsInstructionFetchInstructionDecodeOp erandFetchExecuteResultStoreNextInstruct ionObtain Instruction from program memoryDetermine required actions and Instruction sizeLocate and obtain operand dataCompute result value or statusDeposit results in storage (data memory orregister) for later useDetermine successor or next instructionFrom data memory or registers( Update PC to fetch next Instruction to be processed)The Program Counter (PC)

3 Points to the Instruction to be processedCPI = Cycles per instructionEECC550 EECC550 --ShaabanShaaban#3 Lec # 3 Winter 2011 12-6-2011 For a specific programcompiled to run on a specific machine (CPU) A , has the following parameters: The total executed Instruction count of the program. The average number of Cycles per Instruction (average CPI). Clock cycle of machine A How can one measure the Performance of this machine (CPU) running this program? Intuitively the machine (or CPU) is said to be faster or has better Performance running this program if the total execution time is shorter. Thus the inverse of the total measured program execution time isa possible Performance measure or metric:PerformanceA= 1 / Execution TimeAHow to compare Performance of different machines?

4 What factors affect Performance ? How to improve Performance ?Computer Performance Measures: Computer Performance Measures: Program Execution TimeProgram Execution TimeCPIICOr effective CPIS econds/programPrograms/secondEECC550 EECC550 --ShaabanShaaban#4 Lec # 3 Winter 2011 12-6-2011 Comparing Computer Performance Using Execution TimeComparing Computer Performance Using Execution Time To compare the Performance of two machines (or CPUs) A , B running a given specific program:PerformanceA= 1 / Execution TimeAPerformanceB= 1 / Execution TimeB Machine A is n times faster than machine B means (or slower? if n < 1) : Example: For a given program:Execution time on machine A: ExecutionA= 1 secondExecution time on machine B: ExecutionB= 10 secondsPerformanceA/ PerformanceB = Execution TimeB / Execution TimeA= 10 / 1 = 10 The Performance of machine A is 10 times the Performance of machine B when running this program, or: Machine A is said to be 10 times faster than machine B when running this program.

5 Speedup = n = =PerformanceAPerformanceBExecution TimeBExecution TimeASpeedup=( Speedup is ratio of Performance , no units) The two CPUs may target different ISAs providedthe program is written in a high level language (HLL)EECC550 EECC550 --ShaabanShaaban#5 Lec # 3 Winter 2011 12-6-2011 CPU Execution Time: The CPU EquationCPU Execution Time: The CPU Equation A program is comprised of a number of instructions executed , I Measured in:instructions/program The average Instruction executed takes a number of Cycles per Instruction (CPI)to be completed. Measured in: Cycles / Instruction , CPI CPU has a fixed clock cycle time C = 1/clock rate Measured in:seconds/cycle CPU execution time is the product of the above three parameters as follows:CPU time= Seconds= Instructions x Cycles x SecondsProgramProgram Instruction CycleCPU time= Seconds= Instructions x Cycles x SecondsProgramProgram Instruction CycleT = I x CPI x Cexecution Timeper program in secondsNumber of instructions executedAverage CPI for programCPU Clock Cycle(This equation is commonly known as the CPU Performance equation)Or Instructions Per Cycle (IPC).

6 IPC = 1/CPIE xecutedC = 1 / fAKA Dynamic Instruction CountEECC550 EECC550 --ShaabanShaaban#6 Lec # 3 Winter 2011 12-6-2011 CPU Average CPI/Execution TimeCPU Average CPI/Execution TimeFor a given program executed on a given machine (CPU):CPI = Total program execution Cycles / Instructions count CPU clock Cycles = Instruction count x CPICPU execution time == CPU clock Cycles x Clock cycle= Instruction count x CPI x Clock cycleT = I x CPI x C( average or effective CPI)execution Timeper program in secondsNumber of instructions executedAverage or effective CPI for programCPU Clock Cycle(This equation is commonly known as the CPU Performance equation)(executed, I)CPI = Cycles Per InstructionExecuted (I)EECC550 EECC550 --ShaabanShaaban#7 Lec # 3 Winter 2011 12-6-2011 CPU Execution Time: ExampleCPU Execution Time: Example A Program is running on a specific machine (CPU) with the following parameters: Total executed Instruction count.

7 10,000,000 instructions Average CPI for the program: Cycles / Instruction . CPU clock rate: 200 MHz. (clock cycle = C = 5x10-9 seconds) What is the execution time for this program:CPU time = Instruction count x CPI x Clock cycle= 10,000,000 x x 1 / clock rate = 10,000,000 x x 5x10-9= secondsCPU time= Seconds= Instructions x Cycles x SecondsProgramProgram Instruction CycleCPU time= Seconds= Instructions x Cycles x SecondsProgramProgram Instruction CycleT = I x CPI x 5 nanosecondsNanosecond = nsec =ns = 10-9secondMHz = 106 HzIEECC550 EECC550 --ShaabanShaaban#8 Lec # 3 Winter 2011 12-6-2011 Factors Affecting CPU PerformanceFactors Affecting CPU PerformanceCPU time= Seconds= Instructions x Cycles x SecondsProgramProgram Instruction CycleCPU time= Seconds= Instructions x Cycles x SecondsProgramProgram Instruction CycleCycles perInstructionClock Rate(1/C)InstructionCountProgramCompiler Organization(CPU Design)

8 Technology(VLSI) Instruction SetArchitecture (ISA)T = I x CPI x CT = I x CPI x CAverageEECC550 EECC550 --ShaabanShaaban#9 Lec # 3 Winter 2011 12-6-2011 Aspects of CPU Execution TimeAspects of CPU Execution TimeCPU Time = Instruction count executed x CPI x Clock cycleInstruction Count IInstruction Count IClockClockCycleCycleCCCPICPID epends on:CPU OrganizationTechnology (VLSI)Depends on:Program UsedCompilerISACPU OrganizationDepends on:Program UsedCompilerISA(executed)(AverageCPI)T = I x CPI x CEECC550 EECC550 --ShaabanShaaban#10 Lec # 3 Winter 2011 12-6-2011 Performance Comparison: ExamplePerformance Comparison: Example From the previous example: A Program is running on a specific machine (CPU) with the following parameters: Total executed Instruction count, I: 10,000,000 instructions Average CPI for the program: Cycles / Instruction .

9 CPU clock rate: 200 MHz. Using the same program with these changes: A new compiler used: New executed Instruction count, I: 9,500,000 New CPI: Faster CPU implementation: New clock rate = 300 MHz What is the speedup with the changes?Speedup = (10,000,000 x x 5x10-9) / (9,500,000 x 3 x )= .125 / .095 = 32 % faster after Old Execution Time = Ioldx CPIoldx Clock cycleoldNew Execution Time Inewx CPInewx Clock CyclenewSpeedup= Old Execution Time = Ioldx CPIoldx Clock cycleoldNew Execution Time Inewx CPInewx Clock CyclenewClock Cycle = C = 1/ Clock RateT = I x CPI x CThus: C = 1/(200x106)= 5x10-9secondsThus: C = 1/(300x106)= EECC550 --ShaabanShaaban#11 Lec # 3 Winter 2011 12-6-2011 Instruction Types & CPII nstruction Types & CPI Given a program with ntypes or classes of instructions executed on a given CPU with the following characteristics:Ci = Count of instructions of typeiexecutedCPIi= Cycles per Instruction for typeiThen:Then:CPI = CPU Clock Cycles / Instruction CountI Where.

10 Executed Instruction Count I = Ci()CPU clock cyclesiiinCPI C= = 1i = 1, 2, .. nT = I x CPI x average or effective CPID epends on CPU ALU, Branch EECC550 --ShaabanShaaban#12 Lec # 3 Winter 2011 12-6-2011 Instruction Types & CPI: An ExampleInstruction Types & CPI: An Example An Instruction set has three Instruction classes: Two code sequences have the following Instruction counts: CPU Cycles for sequence 1 = 2 x 1 + 1 x 2 + 2 x 3 = 10 cyclesCPI for sequence 1 = clock Cycles / Instruction count= 10 /5 = 2 CPU Cycles for sequence 2 = 4 x 1 + 1 x 2 + 1 x 3 = 9 cyclesCPI for sequence 2 = 9 / 6 = class CPIA1B2C3 Instruction counts for Instruction classCode Sequence A B C1 2 1 22 4 1 1()


Related search queries