Presentation is loading. Please wait.

Presentation is loading. Please wait.

COD Ch. 1 Introduction + The Role of Performance.

Similar presentations


Presentation on theme: "COD Ch. 1 Introduction + The Role of Performance."— Presentation transcript:

1 COD Ch. 1 Introduction + The Role of Performance

2 Introduction Rapidly changing field: vacuum tube -> transistor -> IC -> VLSI doubling every 1.5 years: memory capacity processor speed (due to advances in technology and hardware organization) cute example: if Boeing had kept up with IBM we could fly from Bangkok to HCM City in 10 minutes for 0.5 Saudi riyal!! Things we’ll be learning: how computers work, what’s a good design, what’s not how to make them – yes, we will actually build working computers!! issues affecting modern processors (e.g., caches, pipelines)

3 The Five Classic Components of a Computer Input (mouse, keyboard, …) Output (display, printer, …) Memory main (DRAM), cache (SRAM) secondary (disk, CD, DVD, …) Datapath Control Input Processor Control Datapath Output Memory 1001010010110000 0010100101010001 1111011101100110 1001010010110000 Processor (CPU)

4 Our Primary Focus The processor (CPU)… datapath control …implemented using millions of transistors …impossible to understand by looking at individual transistors

5 Abstraction Delving into the depths reveals more information, but… An abstraction omits “unneeded” detail, helps us cope with complexity From the figure on the right, how does abstraction help the programmer and how does it avoid too much detail?

6 instruction instruction : A command that computer hardware understands and obeys. be thought of as numbers. For example, the bits: 1000110010100000 Are represented in one memory location (or Word), as a sequence of“fields”, each of which holds a logically separate part of the instruction.

7 Instruction Set Architecture instruction set architecture : One of the most abstraction: interface between hardware and lowest-level software standardizes instructions, machine language bit patterns, etc. advantage: allows different implementations of the same architecture disadvantage: sometimes prevents adding new innovations Modern instruction set architectures: 80x86/Pentium/K6, PowerPC, DEC Alpha, MIPS, SPARC, HP

8 The Instruction Set: a Critical Interface instruction set software hardware

9 What is Computer Architecture? Easy Answer Computer Architecture = Instruction Set Architecture + Machine Organization

10 I/O systemInstars. Set Proc. Compiler Operating System Application Digital Design Circuit Design Instruction Set Architecture Firmware Datapath & Control Layout What is Computer Architecture? Better (More Detailed) Answer

11 Forces on Computer Architecture Computer Architecture Technology Programming Languages Operating Systems History Applications

12 Performance is the key to understanding underlying motivation for the hardware and its organization Measure, report, and summarize performance to enable users to make intelligent choices see through the marketing hype! Performance

13 Airplane Passengers Speed (mph) throughput Boeing 737-100101 598228,750 Boeing 747470610287,600 BAC/Sud Concorde1321350178,200 Douglas DC-8-5014654479,424 How much faster is the Concorde compared to the 747? How much bigger is the Boeing 747 than the Douglas DC-8? So which of these airplanes has the best performance?! Throughput: the total amount of work done in a given time (passengers × speed) What do we measure? Define performance….

14 Computer Performance Why is some hardware better than others for different programs? What factors of system performance are hardware related? (e.g., do we need a new machine, or a new operating system?) Do the following changes to a computer system increase throughput, decrease response time, or both? 1. Replacing the processor in a computer with a faster version -> decrease the response time 2. Adding additional processors to a system that uses multiple processors for separate tasks. -- > increase the throughput How does the machine's instruction set affect performance?

15 Response Time (elapsed time, latency): how long does it take for my job to run? how long does it take to execute (start to finish) my job? how long must I wait for the database query? Throughput: how many jobs can the machine run at once? what is the average execution rate? how much work is getting done? If we upgrade a machine with a new processor what do we increase? If we add a new machine to the lab what do we increase? Computer Performance Individual user concerns… Systems manager concerns…

16 Elapsed Time counts everything (disk and memory accesses, waiting for I/O, running other programs, etc.) from start to finish a useful number, but often not good for comparison purposes elapsed time = CPU time + wait time (I/O, other programs, etc.) system performance = 1 / elapsed time CPU time doesn't count waiting for I/O or time spent running other programs can be divided into user CPU time and system CPU time (OS calls) CPU time = user CPU time + system CPU time  elapsed time = user CPU time + system CPU time + wait time CPU performance = 1 / CPU time Our focus: user CPU time (CPU execution time or, simply, execution time) time spent executing the lines of code that are in our program (seconds / program) Execution Time

17 For some program running on machine X: Performance X = 1 / Execution time X X is n times faster than Y means: Performance X / Performance Y = n Definition of Performance

18 Clock Cycles Instead of reporting execution time in seconds, we often use cycles. In modern computers hardware events progress determined by cycle: in other words, each event, e.g., multiplication, addition, etc., is a sequence of cycles Clock ticks indicate start and end of cycles: cycle time = time between ticks = seconds per cycle clock rate (frequency) = cycles per second (1 Hz. = 1 cycle/sec, 1 MHz. = 10 6 cycles/sec) Example: A 200 Mhz. clock has a cycle time time cycle tick

19 Performance Equation I So, to improve performance one can either: reduce the number of cycles for a program, or reduce the clock cycle time, or, equivalently, increase the clock rate CPU execution time CPU clock cycles Clock cycle time for a program = CPU clock cycles / Clock cycle rate for a program =  equivalently

20 Could assume that # of cycles = # of instructions time 1st instruction2nd instruction3rd instruction4th 5th6th... How many cycles are required for a program? This assumption is incorrect! Because: Different instructions take different amounts of time (cycles) Why…?

21 Multiplication takes more time than addition Floating point operations take longer than integer ones Accessing memory takes more time than accessing registers Important point: changing the cycle time often changes the number of cycles required for various instructions because it means changing the hardware design. More later… time How many cycles are required for a program?

22 Our favorite program runs in 10 seconds on computer A, which has a 400Mhz. 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? Execution time = clock cycle / clock rate A: 10 = clock cycle(A) / 400Mhz B: 6 = 1.2 clock cycle(A) / clock rate (B)  0.6 = 1.2 * 400Mhz / clock rate (B)  clock rate (B) = 800Mhz Example

23 A given program will require: some number of instructions (machine instructions) some number of cycles some number of seconds We have a vocabulary that relates these quantities: cycle time (seconds per cycle) clock rate (cycles per second) (average) CPI (cycles per instruction) a floating point intensive application might have a higher average CPI MIPS (millions of instructions per second) this would be higher for a program using simple instructions Terminology

24 Performance Measure Performance is determined by execution time Do any of these other variables equal performance? # of cycles to execute program? # of instructions in program? # of cycles per second? average # of cycles per instruction? average # of instructions per second? Common pitfall : thinking one of the variables is indicative of performance when it really isn’t

25 Performance Equation II CPU execution time Instruction count average CPI Clock cycle time for a program Derive the above equation from Performance Equation I ; CPU execution time = CPU clock cycles × Clock cycle timefor a program CPU clock cycles = Instructions for a program × A verage clock cycles per instruction = 

26 Suppose we have two implementations of the same instruction set architecture (ISA). For some program: machine A has a clock cycle time of 10 ns. and a CPI of 2.0 machine B has a clock cycle time of 20 ns. and a CPI of 1.2 Which machine is faster for this program, and by how much? If two machines have the same ISA, which of our quantities (e.g., clock rate, CPI, execution time, # of instructions, MIPS) will always be identical? Execution time = I * CPI * clock time,,, Execution time (A)= I * 2 * 10 = 20 I ns Execution time (B)= I * 1.2 * 20 = 24 I ns Performance (A) / Performance (B) = 24 I / 20 I = 1.2 CPI Example I

27 A compiler designer is trying to decide between two code sequences for a particular machine. Based on the hardware implementation, there are three different classes of instructions: Class A, Class B, and Class C, and they require 1, 2 and 3 cycles (respectively). The first code sequence has 5 instructions: 2 of A, 1 of B, and 2 of C The second sequence has 6 instructions: 4 of A, 1 of B, and 1 of C. Which sequence will be faster? How much? What is the CPI for each sequence? CPI Example II

28 CPI Example II (cont.) CPU clock cycles1 = (2 × 1) + (1 × 2) + (2 × 3) = 2 + 2 + 6 = 10 cycles CPU clock cycles2 = (4 × 1) + (1 × 2) + (1 × 3) = 4 + 2 + 3 = 9 cycles Performance (2) / Performance (1) = 10 / 9 = 1.1 CPI 1 = CPU clock cycles 1 / Instruction count 1 = 10/5 = 2 CPI 2 = CPU clock cycles 2 / Instruction count 2 = 9/6 = 1.5

29 Two different compilers are being tested for a 500 MHz. machine with three different classes of instructions: Class A, Class B, and Class C, which require 1, 2 and 3 cycles (respectively). Both compilers are used to produce code for a large piece of software. Compiler 1 generates code with 5 billion Class A instructions, 1 billion Class B instructions, and 1 billion Class C instructions. Compiler 2 generates code with 10 billion Class A instructions, 1 billion Class B instructions, and 1 billion Class C instructions. Which sequence will be faster according to MIPS? Which sequence will be faster according to execution time? MIPS Example

30 MIPS Example (cont.) MIPS = Instruction count / ( Execution time x 10 6 ) Execution time = CPU cycles / clock rate Therefore, Execution time 1 = (5x1 + 1x2 + 1x3)x10 9 / (5x10 8 ) = 20 sec. Execution time 2 = (10x1 + 1x2 + 1x3)x10 9 / (5x10 8 ) = 30 sec. MIPS 1 = 7x10 9 / 20 x10 6 = 350. MIPS 2 = 12 x10 9 / 30 x10 6 = 400.

31 Performance is specific to a particular program total execution time is a consistent summary of performance For a given architecture performance increases come from: increases in clock rate (without adverse CPI affects) improvements in processor organization that lower CPI compiler enhancements that lower CPI and/or instruction count Pitfall: expecting improvement in one aspect of a machine’s performance to affect the total performance Summary


Download ppt "COD Ch. 1 Introduction + The Role of Performance."

Similar presentations


Ads by Google