Arquitecturas para Procesamiento de Señal Capítulo 1. Abstracciones, Tecnología y Rendimiento de los Procesadores Chapter 1. Computer Abstractions and Technology Escuela Politécnica Superior Universidad Autónoma de Madrid Profesores: Sergio López Buedo Francisco J. Gómez Arribas Outline n n n The Computer Revolution n Moore´s Law Abstractions n Instruction Set Architecture n RISC vs CIS Performace n n n CPU performance: Execution Time, CPI. Amdahl´s law Measuring and evaluating performance: MIPS, SPEC Outline n n n The Computer Revolution n Moore´s Law Abstractions n Instruction Set Architecture n RISC vs CISC Performace n n n CPU performance: Execution Time, CPI. Amdahl´s law Measuring and evaluating performance: MIPS, SPEC Historical Perspective New Architectures: Eight Great Ideas n Design for Moore’s Law n Use abstraction to simplify design n Make the common case fast (Amdahl) n Performance via parallelism n Performance via pipelining n Performance via prediction n Hierarchy of memories n Dependability via redundancy Chapter 1 — Computer Abstractions and Technology — 5 Evolution of Processors in Computers Multi-everywhere: MT, CMP 1000000 100000 Multi-Threaded, Multi-Core 10000 Multi Threaded Speculative, OOO MIPS 1000 Era of Thread & Processor Level Parallelism Super Scalar 100 10 8086 286 386 486 Era of Pipelined Architecture 1 Era of Instruction Level Parallelism Special Purpose HW 0,1 0,01 1970 1980 1990 2000 2010 Chapter 1 — Computer Abstractions and Technology — 6 The Computer Revolution n Progress in computer technology n Underpinned by Moore’s Law Moore's law The number of transistors that can be fit on a computer chip will double every 18 months, resulting in periodic increases in computing power. _ Progress in computer technology Moore's law The number of transistors that can be fit on a computer chip will double every 1824 months, resulting in periodic increases in computing power. Parallelism and Moore’s Law Chapter 1 — Computer Abstractions and Technology — 9 Abstractions n Abstraction helps us deal with complexity n n Hide lower-level detail Instruction set architecture (ISA) A set of hardware-implemented instructions, the symbolic name and the binary code format of each instruction. n Is the structure of a computer that a machine language programmer (or a compiler) must understand to write a correct (timing independent) program for that machine. n n The hardware/software interface. Chapter 1 — Computer Abstractions and Technology — 10 Abstractions: ISA examples Chapter 1 — Computer Abstractions and Technology — 11 Understanding Performance n Algorithm n n Programming language, compiler, architecture n n Determine number of machine instructions executed per operation Processor and memory system n n Determines number of operations executed Determine how fast instructions are executed I/O system (including OS) n Determines how fast I/O operations are executed Chapter 1 — Computer Abstractions and Technology — 12 n Which airplane has the best performance? Boeing 777 Boeing 777 Boeing 747 Boeing 747 BAC/Sud Concorde BAC/Sud Concorde Douglas DC-8-50 Douglas DC8-50 0 100 200 300 400 0 500 Boeing 777 Boeing 777 Boeing 747 Boeing 747 BAC/Sud Concorde BAC/Sud Concorde Douglas DC-8-50 Douglas DC8-50 500 1000 Cruising Speed (mph) 4000 6000 8000 10000 Cruising Range (miles) Passenger Capacity 0 2000 §1.4 Performance Defining Performance 1500 0 100000 200000 300000 400000 Passengers x mph Chapter 1 — Computer Abstractions and Technology — 13 Response Time and Throughput n Response time n n How long it takes to do a task Throughput n Total work done per unit time n n e.g., tasks/transactions/… per hour How are response time and throughput affected by Replacing the processor with a faster version? n Adding more processors? n n We’ll focus on response time for now… Chapter 1 — Computer Abstractions and Technology — 14 Relative Performance Define Performance = 1/Execution Time n “X is n time faster than Y” n Performanc e X Performanc e Y = Execution time Y Execution time X = n n Example: time taken to run a program 10s on A, 15s on B n Execution TimeB / Execution TimeA = 15s / 10s = 1.5 n So A is 1.5 times faster than B n Chapter 1 — Computer Abstractions and Technology — 15 CPU Clocking n Operation of digital hardware governed by a constant-rate clock Clock (cycles) Data transfer and computation Update state n e.g., 250ps = 0.25ns = 250×10–12s Clock frequency (rate): cycles per second n 10n 80 24 2 1 Clock period: duration of a clock cycle n 2n 2 70 2 60 2 50 2 40 2 30 2 20 2 10 Clock period n Please remember prefixes! e.g., 4.0GHz = 4000MHz = 4.0×109Hz 2−10 2−20 2−30 2−40 2−50 2−60 2−70 2−80 10 10 21 10 18 10 15 10 12 10 9 10 6 10 3 10 2 10 1 1 10−1 10−2 10−3 10−6 10−9 10−12 10−15 10−18 10−21 10−24 Prefix Simb yotta zetta exa peta tera giga mega kilo hecto deca -deci centi mili micro nano pico femto atto zepto yocto Y Z E P T G M k h da -d c m µ n p f a z y Chapter 1 — Computer Abstractions and Technology — 16 CPU Time (Tcpu) CPU Time = CPU Clock Cycles ´ Clock Cycle Time = (# cycles ´ period ) CPU Clock Cycles # cycles = =( ) Clock Rate freq n Performance improved by Reducing number of clock cycles n Increasing clock rate n Hardware designer must often trade off clock rate against cycle count n Chapter 1 — Computer Abstractions and Technology — 17 Instruction Count and CPI Clock Cycles = Instruction Count ´ Cycles per Instruction CPU Time = Instruction Count ´ CPI ´ Clock Cycle Time Instruction Count ´ CPI = Clock Rate n Instruction Count for a program n n Determined by program, ISA and compiler Average cycles per instruction Determined by CPU hardware n If different instructions have different CPI n n Average CPI affected by instruction mix Chapter 1 — Computer Abstractions and Technology — 18 CPI Example Computer A: Cycle Time = 250ps, CPI = 2.0 n Computer B: Cycle Time = 500ps, CPI = 1.2 n Same ISA n Which is faster, and by how much? n CPU Time A = Instruction Count ´ CPI ´ Cycle Time A A = I ´ 2.0 ´ 250ps = I ´ 500ps A is faster… CPU Time = Instruction Count ´ CPI ´ Cycle Time B B B = I ´ 1.2 ´ 500ps = I ´ 600ps CPU Time B = I ´ 600ps = 1.2 CPU Time I ´ 500ps A …by this much Chapter 1 — Computer Abstractions and Technology — 19 CPI in More Detail n If different instruction classes take different numbers of cycles n Clock Cycles = å (CPIi ´ Instruction Count i ) i=1 n Weighted average CPI n Clock Cycles Instructio n Count i ö æ CPI = = å ç CPIi ´ ÷ Instructio n Count i=1 è Instructio n Count ø Relative frequency Chapter 1 — Computer Abstractions and Technology — 20 CPI Example n Alternative compiled code sequences using instructions in classes A, B, C IC stand for: Instruction Count n Class A B C CPI for class 1 2 3 IC in sequence 1 2 1 2 IC in sequence 2 4 1 1 Sequence 1: IC = 5 Clock Cycles = 2×1 + 1×2 + 2×3 = 10 n Avg. CPI = 10/5 = 2.0 n n Sequence 2: IC = 6 Clock Cycles = 4×1 + 1×2 + 1×3 =9 n Avg. CPI = 9/6 = 1.5 n Chapter 1 — Computer Abstractions and Technology — 21 Performance Summary Instructions Clock cycles Seconds CPU Time = ´ ´ Program Instruction Clock cycle n Performance depends on Algorithm: affects IC, possibly CPI n Programming language: affects IC, CPI n Compiler: affects IC, CPI n Instruction set architecture: affects IC, CPI, Tc n Chapter 1 — Computer Abstractions and Technology — 22 SpeedUp and Amdahl’s Law n Speedup is the improvement achieved in execution time. Execution timeold SpeedupOverall = Execution timenew n Amdahl´s Law is used to find the speedup to an overall system when only part of the system is improved. SpeedupOverall = 1 (1− Fractionenhanced ) + Fractionenhanced Speedupenhanced Chapter 1 — Computer Abstractions and Technology — 23 Amdahl´s law: 1 improvement Told Time unaffected Time affected Fraction 1−Fe Fraction Fe Time unaffected Time improved Tnew SpeedupOverall = 1 Fe (1− Fe ) + Se Time enhanced Se times Fe: Fraction enhanced Se: Speedup enhanced. Amount of improvement Amdahl´s law § Performance is limited to the non-speedup portion of the program. Execution time after improvement = Execution time of unaffected part + (Execution time of affected part / Amount of Improvement) § Corollary of Amdahl’s law: Make the common case fast. Amdahl´s law generalization Told Time unaffected Time to improve Time to improve mejorar Fraction Fe,1 Fracción 1−Fe,1−Fe,2 T1 enhanced Time unaffected Tnew Speedupoverall = Fraction Fe2 T2 enhanced Amount of improvement Se,2 times Amount of improvement Se1 times 1 n n Fe,i 1− ∑ Fe,i + ∑ i=1 i=1 Se,i Amdahl´s law: An exercise Example: Using the Amdahl’s law. Calculate the speed up of the system in both cases: Case 1: x10 in FP Operation ARITHMETIC LOGIC UNIT (ALU) INT FP SUM FP MUL FP DIV Instruction (%) 70 15 10 5 Old CPI 2 40 60 100 New CPI improved 2 4 6 10 ARITHMETIC LOGIC UNIT (ALU) Case 2: FP with different improvements INT FP SUM FP MUL FP DIV Instruction (%) 70 15 10 5 Old CPI 2 40 60 100 New CPI improved 2 2 15 10 Pitfall: MIPS as a Performance Metric n MIPS: Millions of Instructions Per Second n Doesn’t account for Differences in ISAs between computers n Differences in complexity between instructions n MIPS = Instructio n count Execution time ´ 10 6 Instructio n count Clock rate = = 6 Instructio n count ´ CPI CPI ´ 10 6 ´ 10 Clock rate n CPI varies between programs on a given CPU Chapter 1 — Computer Abstractions and Technology — 28 MFLOPs as a Performance Metric n MFLOPS: Millions of Floating-point Operations Per Second Floating point instruction count MFLOPS = Execution time ×106 The MFLOPS measure, as described by [ref1] , is widely employed because of its efficiency and effectiveness in terms of simplicity and its indicative abilities. See www.top500.org [1] Evaluating the Mflops Measure Ran Giladi , Journal IEEE Micro archive Vol 16 Issue 4, 1996, pp 69-75 Chapter 1 — Computer Abstractions and Technology — 29 MIPS vs MFLOPs: An exercise Example: Compare the performance @ 100 MHz of M1-CISC and M2-RISC. (Also using MIPS and MFLOPs metrics) : IC M1-cisc IC M2-risc CPI Alu INT 6 5x10 6 10x10 1 Mem 6 10 6 10 2 FP 6 10 6 10 3 • The performance of M1-CISC =1,5 x M2-RISC ( 50% better) • M1 MIPS < M2 MIPS • M1 MFLOPs > M2 MFLOPs SPEC CPU Benchmark n Programs used to measure performance n n Standard Performance Evaluation Corp (SPEC) n n Supposedly typical of actual workload Develops benchmarks for CPU, I/O, Web, … SPEC CPU2006 n Elapsed time to execute a selection of programs n Negligible I/O, so focuses on CPU performance Normalize relative to reference machine n Summarize as geometric mean of performance ratios n n CINT2006 (integer) and CFP2006 (floating-point) n n Õ Execution time ratio i i=1 Chapter 1 — Computer Abstractions and Technology — 31 CINT2006 for Intel Core i7 920 Chapter 1 — Computer Abstractions and Technology — 32 Material de apoyo adicional n Material Adicional Fórmulas y relaciones útiles para los ejercicios n Ejemplos n Trampas (Pitfalls) n Info Adicional: Fórmulas y relaciones útiles para los ejercicios TCPU = NI x CPI x TCICLO = Rendimiento(X) = 1 / TEJEC(X) = NroCiclosReloj / FreqReloj n= X es n veces más rápido que Y significa: Una mejora en el sistema se mide con la: Rendimiento(X) TEJEC (Y) = Rendimiento(Y) TEJEC (X) TEJ (sin mejora) R(con m.) Aceleración = = TEJ (con mejora) R(sin m.) La ley de Amdahl mide la mejora del rendimiento global de un sistema. Donde: Acc global = Fm: Fracción de tiempo mejorada y Accm: Aceleración mejorada Accglobal = 1 (1- Fm ) + Fm Acc m 1 Fm,i 1 - å Fm,i + å i =1 i =1 Accm ,i MIPS = NI / (TCPU x 106) = NI / (NI x CPI x TCiclo x 106) = Frec/ (CPI x 106) La ley de Amdahl para varias mejoras: n n CPU Time Example Computer A: 2GHz clock, 10s CPU time n Designing Computer B n n n n Aim for 6s CPU time Can do faster clock, but causes 1.2 × clock cycles How fast must Computer B clock be? Clock CyclesB 1.2 ´ Clock CyclesA Clock RateB = = CPU TimeB 6s Clock CyclesA = CPU Time A ´ Clock Rate A = 10s ´ 2GHz = 20 ´ 10 9 1.2 ´ 20 ´ 10 9 24 ´ 10 9 Clock RateB = = = 4GHz 6s 6s Chapter 1 — Computer Abstractions and Technology — 35 Amdahl´s law: example 1 § Suppose we enhance a machine making all floatingpoint instructions run five times faster. If the execution time of some benchmark before the floating-point enhancement is 12 seconds, what will the speedup be if half of the 12 seconds is spent executing floating-point instructions? Time = 6 (other instr) + 6 (FP instr) / 5 = 7.2 seconds. Speedup = 12 sec / 7.2 sec = 1.67 1 1 1 SpeedupOverall = = = =1.67 Fe 0.5 0.6 (1− Fe ) + (1− 0.5) + Se 5 Chapter 1 — Computer Abstractions and Technology — 36 Amdahl´s law: example 2 § We are looking for a benchmark to show off the new floating-point unit described in the previous example, and we want the overall benchmark to show a speedup of 3. One benchmark we are considering runs for 100 seconds with the old floating-point hardware. How much of the execution time would floating-point instructions have to account for in this program in order to yield our desired speedup on this benchmark? Speedup = 3 = 100 / (Time_FP / 5 + 100 – Time_FP) Time_FP= 83.33 seconds 1 1 5 SpeedupOverall = ; 3= ; 3= ; Fe = 0,83 Fe Fe 5 − 4Fe (1− Fe ) + (1− Fe ) + Se 5 Chapter 1 — Computer Abstractions and Technology — 37 n Improving an aspect of a computer and expecting a proportional improvement in overall performance Taffected Timproved = + Tunaffected improvemen t factor n Example: multiply accounts for 80s/100s n n §1.10 Fallacies and Pitfalls Pitfall: Amdahl’s Law How much improvement in multiply performance to get 5× overall? 80 n Can’t be done! 20 = + 20 n Corollary: make the common case fast Chapter 1 — Computer Abstractions and Technology — 38
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )