Pipelining What is it? How does it work? What are the benefits? What could go wrong? By Derek Closson.

Slides:



Advertisements
Similar presentations
CH14 Instruction Level Parallelism and Superscalar Processors
Advertisements

Lecture 4: CPU Performance
Computer Organization and Architecture
Morgan Kaufmann Publishers The Processor
1 ECE369 ECE369 Pipelining. 2 ECE369 addm (rs), rt # Memory[R[rs]] = R[rt] + Memory[R[rs]]; Assume that we can read and write the memory in the same cycle.
1 Pipelining Part 2 CS Data Hazards Data hazards occur when the pipeline changes the order of read/write accesses to operands that differs from.
COMP25212 Further Pipeline Issues. Cray 1 COMP25212 Designed in 1976 Cost $8,800,000 8MB Main Memory Max performance 160 MFLOPS Weight 5.5 Tons Power.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Intro to Computer Org. Pipelining, Part 2 – Data hazards + Stalls.
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
Chapter 8. Pipelining.
1 Lecture: Pipelining Extensions Topics: control hazards, multi-cycle instructions, pipelining equations.
Pipelined Processor II (cont’d) CPSC 321
The Light at the End of the Tunnel – Doesn’t Mean You Died ! Part 3 - Branch Hazards – Easier! – 3/24/04 This is a control hazard – as opposed to data.
Chapter 6. (1)Long cycle time (2)Idle transistors.
Chapter 12 Pipelining Strategies Performance Hazards.
Pipelining III Andreas Klappenecker CPSC321 Computer Architecture.
1  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
Pipelining Andreas Klappenecker CPSC321 Computer Architecture.
1 Stalling  The easiest solution is to stall the pipeline  We could delay the AND instruction by introducing a one-cycle delay into the pipeline, sometimes.
RISC. Rational Behind RISC Few of the complex instructions were used –data movement – 45% –ALU ops – 25% –branching – 30% Cheaper memory VLSI technology.
Pipelined Processor II CPSC 321 Andreas Klappenecker.
7/2/ _23 1 Pipelining ECE-445 Computer Organization Dr. Ron Hayne Electrical and Computer Engineering.
From Essentials of Computer Architecture by Douglas E. Comer. ISBN © 2005 Pearson Education, Inc. All rights reserved. 7.2 A Central Processor.
ENGS 116 Lecture 51 Pipelining and Hazards Vincent H. Berk September 30, 2005 Reading for today: Chapter A.1 – A.3, article: Patterson&Ditzel Reading for.
Pipelining. Overview Pipelining is widely used in modern processors. Pipelining improves system performance in terms of throughput. Pipelined organization.
Computer Organization and Architecture Instruction-Level Parallelism and Superscalar Processors.
W.S Computer System Design Lecture 7 Wannarat Suntiamorntut.
Lecture 15: Pipelining and Hazards CS 2011 Fall 2014, Dr. Rozier.
9.2 Pipelining Suppose we want to perform the combined multiply and add operations with a stream of numbers: A i * B i + C i for i =1,2,3,…,7.
What have mr aldred’s dirty clothes got to do with the cpu
1 Pipelining Reconsider the data path we just did Each instruction takes from 3 to 5 clock cycles However, there are parts of hardware that are idle many.
Automobile Manufacturing 1. Build frame. 60 min. 2. Add engine. 50 min. 3. Build body. 80 min. 4. Paint. 40 min. 5. Finish.45 min. 275 min. Latency: Time.
RISC Architecture RISC vs CISC Sherwin Chan.
Chapter 4 The Processor. Chapter 4 — The Processor — 2 Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined.
CMPE 421 Parallel Computer Architecture
1 COMP541 Pipelined MIPS Montek Singh Mar 30, 2010.
Pipelining and Parallelism Mark Staveley
CS 1104 Help Session IV Five Issues in Pipelining Colin Tan, S
Winter 2002CSE Topic Branch Hazards in the Pipelined Processor.
1 COMP541 Pipelined MIPS Montek Singh Apr 9, 2012.
1  1998 Morgan Kaufmann Publishers Chapter Six. 2  1998 Morgan Kaufmann Publishers Pipelining Improve perfomance by increasing instruction throughput.
Branch Hazards and Static Branch Prediction Techniques
Oct. 18, 2000Machine Organization1 Machine Organization (CS 570) Lecture 4: Pipelining * Jeremy R. Johnson Wed. Oct. 18, 2000 *This lecture was derived.
Pipelining Example Laundry Example: Three Stages
Pipelining Pipelining is a design feature that allows multiple instructions to be run simultaneously. Speeds up the execution of instruction processing.
CBP 2005Comp 3070 Computer Architecture1 Last Time … All instructions the same length We learned to program MIPS And a bit about Intel’s x86 Instructions.
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
Introduction to Computer Organization Pipelining.
Lecture 9. MIPS Processor Design – Pipelined Processor Design #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System.
CMPE 421 REVIEW: MIDTERM 1. A MODIFIED FIVE-Stage Pipeline PC A Y R MD1 addr inst Inst Memory Imm Ext add rd1 GPRs rs1 rs2 ws wd rd2 we wdata addr wdata.
RISC / CISC Architecture by Derek Ng. Overview CISC Architecture RISC Architecture  Pipelining RISC vs CISC.
Real-World Pipelines Idea –Divide process into independent stages –Move objects through stages in sequence –At any given times, multiple objects being.
PipeliningPipelining Computer Architecture (Fall 2006)
Chapter Six.
Advanced Architectures
Stalling delays the entire pipeline
CS/COE 1541 (term 2174) Jarrett Billingsley
Lecture: Pipelining Extensions
Single Clock Datapath With Control
Pipeline Implementation (4.6)
Instruction Level Parallelism and Superscalar Processors
Chapter Six.
Chapter Six.
Lecture: Pipelining Extensions
Chapter 8. Pipelining.
Pipelining Chapter 6.
Need to stall for one cycle.
Presentation transcript:

Pipelining What is it? How does it work? What are the benefits? What could go wrong? By Derek Closson

What is pipelining? Pipelining is a design feature that allows individual common processor tasks to run simultaneously, such as: Fetch Decode Execute

What is pipelining? Or, more specifically in modern computers, Instruction read Decode Operand read Execute Operand write

What is pipelining? No more “one instruction at a time” processing Processor works simultaneously on multiple instructions Each instruction is at a different stage (or is being delayed until its next stage is open)

How does pipelining work? First instruction is fetched from memory

How does pipelining work? First instruction is fetched from memory First instruction is decoded; second instruction is fetched

How does pipelining work? First instruction is fetched from memory First instruction is decoded; second instruction is fetched First instruction’s operands are fetched; second instruction is decoded; third instruction is fetched

How does pipelining work? First instruction is fetched from memory First instruction is decoded; second instruction is fetched First instruction’s operands are fetched; second instruction is decoded; third instruction is fetched And on, and on, and on…

How does pipelining work? Because each instruction demands one stage of the processor, the maximum number of simultaneous instructions is the number of stages in the processor

How does pipelining work? A short animation of simple processor routines

How does pipelining work? A short(er) animation of pipelined processor routines

What are the benefits of pipelining? Uses most (if not all) of a processor’s ability at all times Efficiency goes up Relatively minor hardware changes give more completed cycles per second Speed goes up

What can go wrong in pipelines? Data hazards Control hazards Structural hazards

What can go wrong…? Data hazards Two instructions at different stages One instruction needs the results of the other instruction’s operation … add%r1,5, %r2 add%r2, 7, %r3 …

What can go wrong…? Data hazards Well-designed programs can anticipate this, and spread the connected commands out with other operations (or nop in a pinch) … add%r1, 5, %r2(i1 fetch) sub%r4, 7, %r8(i1 decode) mov%r5, %r6(i1 read) add%r2, 7, %r3 (i1 execute, i2 fetch) nop(i1 write, i2 decode) …

What can go wrong…? Data hazards Hardware can detect some data hazards and “forward” the information to the instructions that need it, even as the data goes to the registers Otherwise, programs may simply have bad data - testing and good programming are the best cures!

What can go wrong…? Control hazards Instructions are read sequentially from memory - even though loops may return to previous statements Instructions following the loop are already in the pipeline! Or, simple if/else blocks of code. Which block do you get instructions from?

What can go wrong…? Control hazards At worst, the entire pipeline must be flushed: hardware can stall the influx of new instructions until the conditional is evaluated

What can go wrong…? Control hazards Branch prediction inserts a couple instructions of its own to guess the outcome of the conditional If prediction is usually correct, fewer cycles lost on average If prediction is wrong, flush the pipeline and undo any improper commands

What can go wrong…? Structure hazards Two different instructions try to use the same hardware resource One instruction will obviously get access first, second instruction must be stalled (maybe along with all other instructions behind it) Again, careful programming will prevent this