Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMS 361 Computer Organization

Similar presentations


Presentation on theme: "COMS 361 Computer Organization"— Presentation transcript:

1 COMS 361 Computer Organization
Title: Performance Date: 9/06/2004 Lecture Number: 5

2 Announcements Homework 2 Due 9/14/04 (1 week)

3 Review Performance Know the criteria for measuring We choose
Execution time as our measure

4 Review System clock Clock rate (cycles/second)
Clock period (seconds/cycle) Common clock rate: 1 Giga Hz

5 Outline Orders of magnitude Performance MIPS, MOPS, FLOPS
The big and small of it Performance Relationship between Execution time and clock rate Execution time and the number of instructions Instruction and number of clocks MIPS, MOPS, FLOPS SPEC Benchmarks

6 Orders of Magnitude The small ones The BIG ones thousandths 10-3
milli, m millionths 10-6 micro, u billionths 10-9 nano, n trillionths 10-12 pico, p thousands 103 kilo, K millions 106 mega, M billions 109 giga, G trillions 1012 tera, T

7 Execution time vs clock/rate
Relation between execution time and clock rate Tells what happens to execution time as clock rate changes Increase performance Reduce the number of clocks cycles to execute the program Reduce the clock period (increase the clock rate)

8 Example Don't Panic, can easily work this out from basic principles
Our favorite program runs in 10 seconds on computer A, which has a 400 MHz. clock. We are trying to help a computer designer build a new machine B, that will run this program in 6 seconds. The designer can use new (or perhaps more expensive) technology to substantially increase the clock rate, but has informed us that this increase will affect the rest of the CPU design, causing machine B to require 1.2 times as many clock cycles as machine A for the same program. What clock rate should we tell the designer to target? Don't Panic, can easily work this out from basic principles

9 Solution What are we given? What do we want to determine?
CPU time(A) = 10sec Clock Rate(A) = 400MHz CPU time(B) = 6sec Clock cycles(B) = 1.2 * clock cycles(A) What do we want to determine? The clock rate(B) What do we need an equation to relate? CPU time Clock rate

10 Solution Rearrange to solve for the unknown
We need a relationship between machine A and B

11 Solution Plug in the known values
Clock rate of machine B must be twice that of machine A Example showed Giving machine B a faster clock required 20% more clock cycles to execute the same program Perhaps faster instructions do less work, more are needed

12 Execution time vs # of instructions
Execution time is proportional to the number of clocks required by the program The number of clocks to execute a program is proportional to the number of instructions executed

13 Execution time vs # of instructions
Various instructions may take different numbers of clock cycles to execute lw or sw compared to an add Memory instructions vs on processor instructions Consider the average number of clocks per instruction

14 Execution time vs # of instructions
CPI is the average number of clocks per instruction Useful in comparing different implementations of the same ISA Checking units

15 Execution time vs # of instructions
Same equation in terms of clock rate instead of clock period checking units

16 Execution time vs # of instructions
Execution time in terms of three parameters: Number of instructions per program Number of clocks per instruction Number of clocks per second

17 Execution time vs # of instructions
Execution time decreases (performance increases) Reduce the number of instructions per program Compiler writer or programmer has some control here Make instructions that perform many operations simultaneously Reduce CPI Make instructions simple so they do not require many clocks May make the number of instructions in the program go up Increase the clock rate May increase CPI unless instructions are simple May increase the number of instructions per program

18 Typical values CPU execution time Clock rate Instruction Count CPI
Determined (measured) for different programs msec, sec, min Clock rate Specified by the manufacturer 500MHz, 1GHz, 2.66MHz Instruction Count Depends on the compiler and program Can be determined CPI Usually not available Varies from one ISA to another

19 Typical values CPI Look at CPI for different instruction classes
Let n be the number of instruction classes C(i) be the number of instructions in class i CPI(i) be the number of clocks per instruction for class I CPI depends on the number of cycles for each instruction class and the percentage of instructions from each class

20 Example Given Which sequence executes the fastest?
CPI(A) = 1, CPI(B) = 2, CPI(C) = 3 Two code sequences (programs) with the following distribution of instructions 1) Num(A) = 2, Num(B) = 1, Num(C) = 2 2) Num(A) = 4, Num(B) = 1, Num(C) = 1 More instructions of class A, less instructions from class C Which sequence executes the fastest? 5 instructions for seq. 1 vs 6 instructions for seq. 2

21 Example How many clock cycles are required for each sequence?
CPU clock cycles(1) = 2*1 + 1*2 + 2*3 = 10 cycles CPU clock cycles(2) = 4*1 + 1*2 + 4*3 = 9 cycles Sequence 2 executes faster than sequence 1 even though there are more instructions in sequence 2!

22 Example What are the CPI’s for the 2 sequences?
CPI(2) < CPI(1) makes sense Sequence 2 has more instructions to execute Requires less clock cycles


Download ppt "COMS 361 Computer Organization"

Similar presentations


Ads by Google