computer systems architecture spring 2016 - 计算 … · computer systems architecture ... a...

32
Computer Systems Architecture Spring 2016 Shuai Wang Department of Computer Science and Technology Nanjing University Lecture 01: Introduction [Adapted from Computer Architecture: A Quantitative Approach, J. L. Hennessy and D. A. Patterson, 5rd Edition]

Upload: vodang

Post on 07-Sep-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Computer Systems Architecture

Spring2016

Shuai Wang

Department of Computer Science and Technology

Nanjing University

Lecture 01: Introduction

[Adapted from Computer Architecture: A Quantitative Approach, J. L. Hennessyand D. A. Patterson, 5rd Edition]

Page 2: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

What is Computer Architecture?

Page 3: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

What is Computer Architecture?

Page 4: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Computer Architecture

• Computer architecture, like other architecture, is the

art of determining the needs of the user of a

structure and then designing to meet those needs as

effectively as possible within economic and

technological constraints.

---Frederick P.Brooks Jr, Planning a Computer System: Project

Stretch, 1962

Page 5: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Critical Issues in Computer

Architecture• Pipeline

• Out-of-Order (OoO) Execution

• Superscalar

• Multithreading and Multiprocessor

• Caches

• Memories

• Power

• Reliability

• …etc.

Page 6: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Pipeline

Page 7: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Pipeline

Page 8: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Caches

SpeedIncreasing

CostIncreasing

Page 9: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Caches

• Why do we need caches?

– Latency vs. Cost

• Why do caches work?

– Principle of Locality

• Temporal locality

• Spatial locality

Page 10: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Hot Areas

• Performance– Moore’s Law

– Multi-core / Many-core Processor

• Power– Voltage/Frequency

– Thermal

• Reliability– Manufacture

– Aging

– Soft Errors

Page 11: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Soft Errors

• Reliability in Multi-/Many- core Processors

(Register files, Caches, and Memories).

0V1V

P1 P2

N1 N2

N3N4

!BL BL

WL WL

1V0V

Source Drain

Gate

+

+

+ +

+_

_

_

_

_

Cosm

ic R

ay

Page 12: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Power/Thermal Aware Design

• Low power design

– Especially in Embedded Systems

• Thermal-aware design

– Temperature Control

Page 13: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Networks on Chip (NoC)

• Many-Core Processors

– Interconnection

Page 14: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Networks on Chip (NoC)• 3D Networks On Chip

• Photonic Networks On Chip

Page 15: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

CourseContent

� A quantitative approach to computer design & analysis

� Techniques of quantitative analysis and evaluation of

modern computing systems, with an emphasis on major

component subsystems of high performance computers:

pipelining, instruction level parallelism, memory hierarchies,

input/output, and network-oriented interconnections.

Page 16: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

CourseAdministration

Instructor: Shuai Wang ([email protected])http://cs.nju.edu.cn/swangOffice: 416 CS Building

URL: http://cs.nju.edu.cn/swang/CA_16S/

Textbook:Computer Architecture: A QuantitativeApproach, by John L. Hennessy & David A. Patterson

Slides: Posted after the lecture

Page 17: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Textbook

Page 18: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

GradingPolicy

• Class Participation:10%

• Homework Assignments:15%

• Labs and Projects: 40%

• Final Exam:35%

Page 19: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

CourseStructure

Lecture outline• Fundamentals of Computer Architecture, Pipelining, Performance,

Caches, Virtual Memory, Cost• Instruction Sets, DSPs, SIMD, Vector Processors • Dynamic Execution • Static Execution• Memory Hierarchy• Multiprocessors• Input/Output and Storage• Networks and Clusters• Power Consumption• Reliability

Page 20: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Today’s Lecture

Reviewof the following topicsPipelining

Caches

Virtual memory

Fundamentals of computer designPerformance

Cost

Technology

Page 21: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Pipelining: AnExample

• Laundry Example

• Ann, Brian, Cathy, Daveeach have one load ofclothes to wash, dry, andfold

• “Washer” takes 30minutes

• “Dryer” takes 40 minutes• “Folder” takes 20

minutes

Page 22: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Sequential Laundry

Sequential laundry takes 6 hours for 4 loads

Page 23: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

PipelinedLaundry: Start WorkASAP

Pipelined laundry takes 3.5 hours for 4 loads

Page 24: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

• Pipelining doesn’t help latencyof single task, it helps throughput of entire workload.• Pipeline rate limited by

slowestpipeline stage.• Multiple tasks operatingsimultaneously.

• Potential speedup =Number

pipe stages.• Unbalanced lengths of pipe

stages reduces speedup.• Time to “ fill ” pipeline and

time to “ drain” it reduces speedup.

PipeliningObservations

Page 25: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Computer Pipelines

• Execute billions of instructions,throughputis what

matters

• Pipelining exploits parallelismamong sequential instruction stream• What is desirable in instruction set architectures forpipelining?

• Variable length instructions vs. all instructions same length?• Memory operands part of any operation vs. memory operands

only in loads or stores?• Register operand many places in instruction format vs.

registers located in same place?

Page 26: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

A “Typical” RISC ISA

• 32-bit fixed format instruction (3 formats)

• Memory access only via load/store instructions• 32 32-bit GPR(R0 contains zero)• 3-address, register-register arithmetic instruction;

registers in same place• Single address mode for load/store:

base + displacement• no indirection

• Simple branch conditions• Delayed branch

Page 27: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

Op

31 016 1521 2026 25

Rs1 Rd immediate

Op

026 25

Op

31 016 1521 2026 25

Rs1 Rs2

target

Rd Opx

Example: MIPS(Noteregister location)

6 511 10

Register-Immediate

Op

31 016 1521 2026 25

Rs1 Rs2/Opx immediate

Branch

Jump / Call31

Register-Register

Page 28: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

MU

XAdder

Addre

ss

MU

X

Re

gF

ile

Me

mory

Inst

ALU D

ata

Me

mory

MU

X MU

X5 Stepsof MIPSDatapath

MemoryAccess

WriteBack

LMD

SignExtend

ExecuteAddr. Calc

Zero?

InstructionFetch

Next PC

4

WB Data

RD

Instr. DecodeReg. Fetch

Next SEQ PC

RS1

RS2

Imm

Page 29: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

MU

XAdder

Addre

ss

MU

X

WB

Dat

a

Me

mory

ME

M/W

B

Re

gF

ile

EX

/ME

M

ID/E

X

IF/ID

ALU D

ata

Me

mory

MU

X MU

X5-StagePipelineof MIPSDatapath

MemoryAccess

WriteBack

InstructionFetch

Instr. DecodeReg. Fetch

ExecuteAddr. Calc

SignExtend

Zero?4

Next SEQ PC Next SEQ PC

RD RD RD

Next PC

RS1

RS2

Imm

Page 30: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

WBMEMEXIDIFInst. i+3

WBMEMEXIDIFInst. i+2

WBMEMEXIDIFInst. i+4

WBMEMEXIDIFInst. i+1

WBMEMEXIDIFInst. i

987654321Instruction #

VisualizingPipelining

Clock number

Page 31: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

ALU

ALU

ALU

ALU

Instr.

Order

VisualizingPipeliningTime (clock cycles)

DMemIfetch

Reg

Reg

DMem

Reg

Ifetch Reg

DMemIfetch

Reg

Reg

DMem

Reg

Ifetch Reg

Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 6 Cycle 7Cycle 5

Page 32: Computer Systems Architecture Spring 2016 - 计算 … · Computer Systems Architecture ... A quantitative approach to computer design & analysis ... Approach, by John L. Hennessy

PipelineHazards• Major hurdle to pipelining:hazardsprevent

the next instruction fromexecuting during itsdesignated clock cycle• Structural hazards: hardware cannot support all

possible combinations of instructions simultaneously

• Data hazards: instruction depends on result of a

previous instruction still in the pipeline

• Control hazards: caused by delay between the

fetching of instructions and decisions about changes

in control flow