Académique Documents
Professionnel Documents
Culture Documents
Most computers run synchronously utilizing a CPU clock running at a constant clock rate:
where: Clock rate = 1 / clock cycle
A computer machine instruction is comprised of a number of elementary or micro operations which vary in number and complexity depending on the instruction and the exact CPU organization and implementation.
A micro operation is an elementary hardware operation that can be performed during one clock cycle. This corresponds to one micro-instruction in microprogrammed CPUs. Examples: register operations: shift, load, clear, increment, ALU operations: add , subtract, etc.
Thus a single machine instruction may take one or more cycles to complete termed as the Cycles Per Instruction (CPI).
(Chapter 2)
EECC550 - Shaaban
#1 Lec # 3 Spring 2003 3-17-2003
EECC550 - Shaaban
#2 Lec # 3 Spring 2003 3-17-2003
EECC550 - Shaaban
#3 Lec # 3 Spring 2003 3-17-2003
CPU execution time is the product of the above three parameters as follows:
CPU time = Seconds Program = Instructions x Cycles Program Instruction x Seconds Cycle
T =
I x
CPI
EECC550 - Shaaban
#4 Lec # 3 Spring 2003 3-17-2003
CPU execution time = = CPU clock cycles x Clock cycle = Instruction count x CPI x Clock cycle = I x CPI x C
EECC550 - Shaaban
#5 Lec # 3 Spring 2003 3-17-2003
CPU time = Instruction count x CPI x Clock cycle = 10,000,000 x 2.5 x 1 / clock rate = 10,000,000 x 2.5 x 5x10-9 = .125 seconds
EECC550 - Shaaban
#6 Lec # 3 Spring 2003 3-17-2003
EECC550 - Shaaban
#7 Lec # 3 Spring 2003 3-17-2003
Instruction Count
CPI
Clock Cycle C
EECC550 - Shaaban
#8 Lec # 3 Spring 2003 3-17-2003
Speedup = (10,000,000 x 2.5 x 5x10-9) / (9,500,000 x 3 x 3.33x10-9 ) = .125 / .095 = 1.32 or 32 % faster after changes.
EECC550 - Shaaban
#9 Lec # 3 Spring 2003 3-17-2003
Then:
CPI v C
i i
CPU cycles for sequence 1 = 2 x 1 + 1 x 2 + 2 x 3 = 10 cycles CPI 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 cycles CPI for sequence 2 = 9 / 6 = 1.5 EECC550 - Shaaban
#11 Lec # 3 Spring 2003 3-17-2003
CPI ! CPI i v F i
i !1
CPIi x Fi CPI
EECC550 - Shaaban
#12 Lec # 3 Spring 2003 3-17-2003
CPIi x Fi CPI CPIi x Fi .5 1.0 .3 .4 % Time 23% = .5/2.2 45% = 1/2.2 14% = .3/2.2 18% = .4/2.2
CPI ! CPI i v F i
i !1
EECC550 - Shaaban
#14 Lec # 3 Spring 2003 3-17-2003
Microbenchmarks:
Small, specially written programs to isolate a specific aspect of performance characteristics: Processing: integer, floating point, local memory, input/output, etc.
EECC550 - Shaaban
#15 Lec # 3 Spring 2003 3-17-2003
Types of Benchmarks
Pros
Representative Actual Target Workload
Cons
Very specific. Non-portable. Complex: Difficult to run, or measure. Less representative than actual workload.
Easy to run, early in the design cycle. Identify peak performance and potential bottlenecks.
Easy to fool by designing hardware to run them well. Peak performance results may be a long way from real application performance
Microbenchmarks
EECC550 - Shaaban
#16 Lec # 3 Spring 2003 3-17-2003
SPEC92, 1992:
SPECInt92 (6 integer programs) and SPECfp92 (14 floating point programs).
SPEC95, 1995:
SPECint95 (8 integer programs): go, m88ksim, gcc, compress, li, ijpeg, perl, vortex SPECfp95 (10 floating-point intensive programs): tomcatv, swim, su2cor, hydro2d, mgrid, applu, turb3d, apsi, fppp, wave5 Performance relative to a Sun SuperSpark I (50 MHz) which is given a score of SPECint95 = SPECfp95 = 1
EECC550 - Shaaban
#17 Lec # 3 Spring 2003 3-17-2003
SPEC95 Programs
Benchmark go m88ksim gcc compress li ijpeg perl vortex tomcatv swim su2cor hydro2d mgrid applu trub3d apsi fpppp wave5 Description Artificial intelligence; plays the game of Go Motorola 88k chip simulator; runs test program The Gnu C compiler generating SPARC code Compresses and decompresses file in memory Lisp interpreter Graphic compression and decompression Manipulates strings and prime numbers in the special-purpose programming language Perl A database program A mesh generation program Shallow water model with 513 x 513 grid quantum physics; Monte Carlo simulation Astrophysics; Hydrodynamic Naiver Stokes equations Multigrid solver in 3-D potential field Parabolic/elliptic partial differential equations Simulates isotropic, homogeneous turbulence in a cube Solves problems regarding temperature, wind velocity, and distribution of pollutant Quantum chemistry Plasma physics; electromagnetic particle simulation
Integer
Floating Point
EECC550 - Shaaban
#18 Lec # 3 Spring 2003 3-17-2003
EECC550 - Shaaban
#19 Lec # 3 Spring 2003 3-17-2003
EECC550 - Shaaban
#20 Lec # 3 Spring 2003 3-17-2003
Language
C C C C C C C++ C C C C C Fortran 77 Fortran 77 Fortran 77 Fortran 77 C Fortran 90 C C Fortran 90 C Fortran 90 Fortran 90 Fortran 77 Fortran 77
Descriptions
Compression FPGA Circuit Placement and Routing C Programming Language Compiler Combinatorial Optimization Game Playing: Chess Word Processing Computer Visualization PERL Programming Language Group Theory, Interpreter Object-oriented Database Compression Place and Route Simulator Physics / Quantum Chromodynamics Shallow Water Modeling Multi-grid Solver: 3D Potential Field Parabolic / Elliptic Partial Differential Equations 3-D Graphics Library Computational Fluid Dynamics Image Recognition / Neural Networks Seismic Wave Propagation Simulation Image Processing: Face Recognition Computational Chemistry Number Theory / Primality Testing Finite-element Crash Simulation High Energy Nuclear Physics Accelerator Design Meteorology: Pollutant Distribution
CINT2000 (Integer)
EECC550 - Shaaban
Source: http://www.spec.org/osg/cpu2000/
#21 Lec # 3 Spring 2003 3-17-2003
Top 20 SPECfp2000
Processor fp peak POWER4 1169 Alpha 21264C 960 UltraSPARC-III Cu 827 Pentium 4 Xeon 802 Pentium 4 801 Alpha 21264B 784 Itanium 701 Alpha 21264A 644 Athlon XP 642 PA-RISC 8700 581 Athlon MP 547 MIPS R14000 529 SPARC64 GP 509 UltraSPARC-III 482 Athlon 458 Pentium III 456 PA-RISC 8600 440 POWER3-II 433 Alpha 21264 422 MIPS R12000 407 fp base 1098 776 701 779 779 643 701 571 596 526 504 499 371 427 426 437 397 426 383 382
EECC550 - Shaaban
Source: http://www.aceshardware.com/SPECmine/top.jsp
#22 Lec # 3 Spring 2003 3-17-2003
Faster execution time usually means faster MIPS rating. Problems with MIPS rating:
No account for the instruction set used. Program-dependent: A single machine does not have a single MIPS rating since the MIPS rating may depend on the program used. Easy to abuse: Program used to get the MIPS rating is often omitted. Cannot be used to compare computers with different instruction sets. A higher MIPS rating in some cases may not mean higher performance or better execution time. i.e. due to compiler design variations.
EECC550 - Shaaban
#23 Lec # 3 Spring 2003 3-17-2003
For a given program, two compilers produced the following instruction counts:
Instruction counts (in millions) for each instruction class A B C 5 1 1 10 1 1
CPI v C
i i
EECC550 - Shaaban
#25 Lec # 3 Spring 2003 3-17-2003
Computer Performance Measures : MFOLPS (Million FLOating-Point Operations Per Second) FLOating A floating-point operation is an addition, subtraction, multiplication, or division operation applied to numbers represented by a single or a double precision floating-point representation. MFLOPS, for a specific program running on a specific computer, is a measure of millions of floating point-operation (megaflops) per second:
MFLOPS = Number of floating-point operations / (Execution time x 106 )
MFLOPS is a better comparison measure between different machines than MIPS. Program-dependent: Different programs have different percentages of floating-point operations present. i.e compilers have no floatingpoint operations and yield a MFLOPS rating of zero. Dependent on the type of floating-point operations present in the program.
EECC550 - Shaaban
#26 Lec # 3 Spring 2003 3-17-2003
Suppose that enhancement E accelerates a fraction F of the execution time by a factor S and the remainder of the time is unaffected then:
Execution Time with E = ((1-F) + F/S) X Execution Time without E Hence speedup is given by: Execution Time without E 1 Speedup(E) = --------------------------------------------------------- = -------------------((1 - F) + F/S) X Execution Time without E (1 - F) + F/S
EECC550 - Shaaban
#27 Lec # 3 Spring 2003 3-17-2003
Affected fraction: F
Unchanged
F/S
Execution Time without enhancement E 1 Speedup(E) = ------------------------------------------------------ = -----------------Execution Time with enhancement E (1 - F) + F/S
EECC550 - Shaaban
#28 Lec # 3 Spring 2003 3-17-2003
CPI = 2.2
Branch 20% 2 .4 18% If a CPU design enhancement improves the CPI of load instructions from 5 to 2, what is the resulting performance improvement from this enhancement: Fraction enhanced = F = 45% or .45 Unaffected fraction = 100% - 45% = 55% or .55 Factor of enhancement = 5/2 = 2.5 Using Amdahls Law:
1 1 Speedup(E) = ------------------ = --------------------- = (1 - F) + F/S .55 + .45/2.5 1.37
EECC550 - Shaaban
#29 Lec # 3 Spring 2003 3-17-2003
CPI = 2.2
Branch 20% 2 .4 18% If a CPU design enhancement improves the CPI of load instructions from 5 to 2, what is the resulting performance improvement from this enhancement: Old CPI = 2.2 New CPI = .5 x 1 + .2 x 2 + .1 x 3 + .2 x 2 = 1.6
Original Execution Time Speedup(E) = ----------------------------------New Execution Time Instruction count x old CPI x clock cycle = ---------------------------------------------------------------Instruction count x new CPI x clock cycle old CPI = ------------ = new CPI 2.2 --------1.6
= 1.37
Which is the same speedup obtained from Amdahls Law in the first solution.
EECC550 - Shaaban
#30 Lec # 3 Spring 2003 3-17-2003
p 5 p n
= 80 seconds / n = 80/5 = 16
EECC550 - Shaaban
#31 Lec # 3 Spring 2003 3-17-2003
p 0
= 80 seconds / n
EECC550 - Shaaban
#32 Lec # 3 Spring 2003 3-17-2003
Speedup !
S
i
Speedup !
((1 F ) F )
i i i
EECC550 - Shaaban
#33 Lec # 3 Spring 2003 3-17-2003
Three CPU performance enhancements are proposed with the following speedups and percentage of the code execution time affected: Speedup1 = S1 = 10 Speedup2 = S2 = 15 Speedup3 = S3 = 30 Percentage1 = F1 = 20% Percentage1 = F2 = 15% Percentage1 = F3 = 10%
While all three enhancements are in place in the new design, each enhancement affects a different portion of the code and only one enhancement can be used at a time. What is the resulting overall speedup?
Speedup ! 1
((1 F ) F )
i i i i
Speedup = 1 / [(1 - .2 - .15 - .1) + .2/10 + .15/15 + .1/30)] = 1/ [ .55 + .0333 ] = 1 / .5833 = 1.71
EECC550 - Shaaban
#34 Lec # 3 Spring 2003 3-17-2003
F1 = .2
F2 = .15
F3 = .1 / 30
/ 10
Unchanged
/ 15
EECC550 - Shaaban
#35 Lec # 3 Spring 2003 3-17-2003