32
Modern Computer Architecture (Processor Design) Prof. Dan Connors [email protected]

Modern Computer Architecture (Processor Design)

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Modern Computer Architecture (Processor Design)

Modern Computer Architecture(Processor Design)

Prof. Dan [email protected]

Page 2: Modern Computer Architecture (Processor Design)

Computer Architecture Historic definition

Computer Architecture =

Instruction Set Architecture +

Computer Organization

Famous architects: Wright, Fuller, Herzog Famous computer architects: Smith, Patt, Hwu, Hennessey,

Patterson

Page 3: Modern Computer Architecture (Processor Design)

Instruction Set Architecture

Important acronym: ISA– Instruction Set Architecture

The low-level software interface to the machine– Assembly language of the machine– Must translate any programming language into this language– Examples: IA-32 (Intel instruction set), MIPS, SPARC, Alpha, PA-

RISC, PowerPC, …

Visible to programmer

Page 4: Modern Computer Architecture (Processor Design)

Differences between ISA’s Much more is similar between ISA’s than different.

Compare MIPS & x86:– Instructions:

• same basic types• different names and variable-length encodings• x86 branches use condition codes (like MIPS floating point)• x86 supports (register + memory) -> (register) format

– Registers:• Register-based architecture• different number and names, x86 allows partial reads/writes

– Memory:• Byte addressable, 32-bit address space• x86 has additional addressing modes and many instruction

types can access memory

Page 5: Modern Computer Architecture (Processor Design)

RISC vs. CISC MIPS was one of the first RISC architectures. It was started about 20

years ago by John Hennessy, one of the authors of our textbook. The architecture is similar to that of other RISC architectures, including

Sun’s SPARC, IBM and Motorola’s PowerPC, and ARM-basedprocessors.

Older processors used complex instruction sets, or CISC architectures.– Many powerful instructions were supported, making the assembly language

programmer’s job much easier.– But this meant that the processor was more complex, which made the

hardware designer’s life harder. Many new processors use reduced instruction sets, or RISC

architectures.– Only relatively simple instructions are available. But with high-level

languages and compilers, the impact on programmers is minimal.– On the other hand, the hardware is much easier to design, optimize, and

teach in classes. Even most current CISC processors, such as Intel 8086-based chips,

are now implemented using a lot of RISC techniques.

Page 6: Modern Computer Architecture (Processor Design)

Tracing an Instruction's Execution Step 1

Page 7: Modern Computer Architecture (Processor Design)

Tracing an Instruction's Execution Step 2

to controller

Page 8: Modern Computer Architecture (Processor Design)

Tracing an Instruction's Execution Step 3

Page 9: Modern Computer Architecture (Processor Design)

Instruction Set Architecture

I/O systemInstr. Set Proc.

Compiler

OperatingSystem

Application

Digital DesignCircuit Design

Instruction Set Architecture

Firmware

Datapath & Control

Layout

Software

Hardware

Page 10: Modern Computer Architecture (Processor Design)

Computer Organization Computer organization is the implementation of the

machine, consisting of two components:– High-level organization

• Memory system widths, bus structure, CPU internal organization, …– Hardware

• Precise logic and circuit design, mechanical packaging, …

Many implementations are possible for an ISA !!!– Intel i386, i486, Pentium, Pentium II, Core2Duo, QuadCore…– Performance, complexity, cost differences….

Invisible to the programmer (mostly)!

Page 11: Modern Computer Architecture (Processor Design)

Moore’s Law: 2x transistors every 18 months

Page 12: Modern Computer Architecture (Processor Design)

Technology => dramatic change

Processor logic capacity: about 30% increase per year clock rate: about 20% increase per year

Memory DRAM capacity: about 60% increase per year (4x every 3 years) Memory speed: about 10% increase per year Cost per bit: about 25% improvement per year

Higher logic density gave room for instruction pipeline & cache

Disk Capacity: about 60% increase per year

Performance optimization no longer implies smaller programs

Computers became lighter and more power efficient

Page 13: Modern Computer Architecture (Processor Design)

Pentium Die Photo 3,100,000 transistors 296 mm2

60 MHz Introduced in 1993

– 1st superscalarimplementation of IA32

Page 14: Modern Computer Architecture (Processor Design)

Four Organization Concepts/Trends

Pipelining– Frequency

Cache memory– To keep processor running must overcome memory latency

Superscalar execution– Out of order execution

Multi-core

Page 15: Modern Computer Architecture (Processor Design)

Pipelined Datapath

Pipe Registers– Inserted between stages– Labeled by preceding & following stage

PC

Instr. Mem.

Reg. Array

regA

regB

regW

datW

datA

datB

ALU

25:21

20:16

+4

Data Mem.

datIn

addr

datOut

aluA

aluB

IncrPC

Instr

4:0Wdest

Wdata

20:13

Xtnd

25:21

Wdata

Wdest

15:0

Xtnd << 2

Zero Test

25:21

Wdata

Wdest

20:0

25:21

Wdata

Wdest

IF/ID ID/EX EX/MEM MEM/WB

Adata

ALUout

Page 16: Modern Computer Architecture (Processor Design)

Pipelining: Use Multiple Resources

Instr.

Order

Time (clock cycles)

Inst 0

Inst 1

Inst 2

Inst 4

Inst 3

ALUIm Reg Dm Reg

ALUIm Reg Dm Reg

ALUIm Reg Dm Reg

ALUIm Reg Dm Reg

ALUIm Reg Dm Reg

Page 17: Modern Computer Architecture (Processor Design)

Conventional Pipelined Execution Representation

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WB

IFetch Dcd Exec Mem WBProgram Flow

Time

Improve performance by increasing instructionthroughputIdeal speedup? N Stages and I instructions

Page 18: Modern Computer Architecture (Processor Design)

Technology Trends and Performance

Computing capacity: 4× per 3 years– If we could keep all the transistors busy all the time– Actual: 3.3× per 3 years

Moore’s Law: Performance is doubled every ~18months– Trend is slowing: process scaling declines, power is up

Speed

1

10

100

1000

1980198319861989199219951998200120042007

Logic

DRAM

Capacity

1

10

100

1000

10000

100000

1000000

1980

1983

1986

1989

1992

1995

1998

2001

2004

2007

Logic

DRAM

2× in 3 years

1.1× in 3 years

CPU speed andMemory speedgrow apart

2× in 3 years

4× in 3 years

Page 19: Modern Computer Architecture (Processor Design)

µProc60%/yr.(2X/1.5yr)

DRAM9%/yr.(2X/10 yrs)1

10

100

1000

1980

1981

1983

1984

1985

1986

1987

1988

1989

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

2000

DRAM

CPU19

82

Processor-MemoryPerformance Gap:(grows 50% / year)

Perf

orm

ance

Time

“Moore’s Law”

Processor-DRAM Memory Gap (latency)

Page 20: Modern Computer Architecture (Processor Design)

Cache Memory Small, fast storage used to improve average access time to

slow memory. Exploits spatial and temporal locality In computer architecture, almost everything is a cache!

– Registers a cache on variables– First-level cache a cache on second-level cache– Second-level cache a cache on memory– Memory a cache on disk (virtual memory)

Proc/Regs

L1-CacheL2-Cache

DRAM Memory

Harddrive

Bigger Faster

Page 21: Modern Computer Architecture (Processor Design)

64 kBData

Cache

64 kBInstr.Cache

Load/Store

ExecutionUnit

Fetch ScanAlign

Micro-code

BusUnit

HyperTransport DDR Memory Interface

1 MB UnifiedInstruction/DataLevel 2 Cache

Floating-Point Unit

Memory Controller

Modern Processor

This is anAMD Operton CPU

Total Area: 193 mm2

Look at the relativesizes of each block:50% cache50% cache23% I/O20% CPU logic+ extra stuff

CPUs dedicate > 50% area for cache memorycache memory.

Page 22: Modern Computer Architecture (Processor Design)

CPI – Cycles Per Instruction

CPUs work according to a clock signal– Clock cycle is measured in nsec (10-9 of a second)– Clock frequency (= 1/clock cycle) measured in GHz

(109cyc/sec)

Instruction Count (IC)– Total number of instructions executed in the program

CPI – Cycles Per Instruction– Average #cycles per Instruction (in a given program)– IPC (= 1/CPI) : Instructions per cycles

CPI = #cycles required to execute the program IC

Page 23: Modern Computer Architecture (Processor Design)

Relating time to system measures Iron Law: Performance = 1/execution time Suppose that for some program we have:

– T seconds running time (the ultimate performancemeasure)

– C clock ticks, I instructions, P seconds/tick(performance measures of interest to the systemdesigner)

T secs = C ticks x P secs/tick = (I inst/I inst) x C ticks x P secs/tick T secs = I inst x (C ticks/I inst) x P secs/tick

runningtime instruction

countavg clockticks perinstruction(CPI)

clock period

Page 24: Modern Computer Architecture (Processor Design)

Pentium 4 Block Diagram

Microprocessor Report

Page 25: Modern Computer Architecture (Processor Design)

Out Of Order Execution Look ahead in a window of instructions and find instructions

that are ready to execute– Don’t depend on data from previous instructions still not

executed– Resources are available

Out-of-order execution– Start instruction execution before execution of a previous

instructions

Advantages:– Help exploit Instruction Level Parallelism (ILP)– Help cover latencies (e.g., L1 data cache miss, divide)

Page 26: Modern Computer Architecture (Processor Design)

Data Flow Analysis Example:

(1) r1 ← r4 / r7 ; assume divide takes 20 cycles(2) r8 ← r1 + r2(3) r5 ← r5 + 1(4) r6 ← r6 - r3(5) r4 ← r5 + r6(6) r7 ← r8 * r4

134

52

6

In-order execution

134

5 2 6

Out-of-order execution1 3 4

2 5

6

Data Flow Graph

r1 r5 r6

r4r8

Page 27: Modern Computer Architecture (Processor Design)

OOOE – General Scheme

Fetch & decode instructions in parallel but in order, to fill inst. pool Execute ready instructions from the instructions pool

– All the data required for the instruction is ready– Execution resources are available

Once an instruction is executed– signal all dependant instructions that data is ready

Commit instructions in parallel but in-order– Can commit an instruction only after all preceding instructions (in

program order) have committed

Fetch &Decode

Instructionpool

Retire(commit)

In-order In-order

Execute

Out-of-order

Page 28: Modern Computer Architecture (Processor Design)

Out Of Order Execution – Example

Assume that executing a divide operation takes 20 cycles

(1) r1 ← r5 / r4

(2) r3 ← r1 + r8

(3) r8 ← r5 + 1(4) r3 ← r7 - 2(5) r6 ← r6 + r7

Inst2 has a REAL (flow) dependency on r1 with Inst1– It cannot be executed in parallel with Inst1

Can successive instructions pass Inst2 ?– Inst3 cannot since Inst2 must read r8 before Inst3 writes to it– Inst4 cannot since it must write to r3 after Inst2– Inst5 can

1

3 4

2

5

Page 29: Modern Computer Architecture (Processor Design)

Overcoming False Dependencies OOOE creates new dependencies

– WAR (write after read): write to a register which is read by anearlier inst.

(1) r3 ← r2 + r1(2) r2 ← r4 + 3

– WAW (write after write): write to a register which is written by anearlier inst.

(1) r3 ← r1 + r2(2) r3 ← r4 + 3

These are false dependencies– There is no missing data– Still prevent executing instructions out-of-order

Solution: Register Renaming

Page 30: Modern Computer Architecture (Processor Design)

Pentium-4 Die Photo EBL/BBL - Bus logic, Front, Back MOB - Memory Order Buffer Packed FPU - MMX Fl. Pt. (SSE) IEU - Integer Execution Unit FAU - Fl. Pt. Arithmetic Unit MIU - Memory Interface Unit DCU - Data Cache Unit PMH - Page Miss Handler DTLB - Data TLB BAC - Branch Address Calculator RAT - Register Alias Table SIMD - Packed Fl. Pt. RS - Reservation Station BTB - Branch Target Buffer IFU - Instruction Fetch Unit (+I$) ID - Instruction Decode ROB - Reorder Buffer MS - Micro-instruction Sequencer1st Pentium4: 9.5 M transistors

Page 31: Modern Computer Architecture (Processor Design)

An Exciting Time for CE - CMPsProcessor coresProcessor cores

SharedSharedL2$L2$

SharedSharedL3$L3$

L2$L2$

L3$L3$

Chip multi-processorMonolithic uniprocessor

Page 32: Modern Computer Architecture (Processor Design)

Computer System Structure

CPU

PCI

North BridgeDDRII

Channel 1

mouse

LAN

LanAdap

ExternalGraphics

Card

Mem BUSCPU BUS

Cache

SoundCard

speakers

South Bridge

PCI express ×16

IDEcontroller

IO Controller

DVDDrive

HardDisk

Para

llel P

ort

Seria

l Por

t

FloppyDrive keybrd

DDRIIChannel 2

USBcontroller

SATAcontroller

PCI express ×1

Memorycontroller

On-boardGraphics