Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.

Slides:



Advertisements
Similar presentations
Morgan Kaufmann Publishers The Processor
Advertisements

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.
Lecture Objectives: 1)Define branch prediction. 2)Draw a state machine for a 2 bit branch prediction scheme 3)Explain the impact on the compiler of branch.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
The Pipelined CPU Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Revised 9/22/2013.
CMPT 334 Computer Organization
Chapter Six 1.
Instructor: Senior Lecturer SOE Dan Garcia CS 61C: Great Ideas in Computer Architecture Pipelining Hazards 1.
ECE 445 – Computer Organization
Pipelined Datapath and Control (Lecture #13) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
S. Barua – CPSC 440 CHAPTER 6 ENHANCING PERFORMANCE WITH PIPELINING This chapter presents pipelining.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania Computer Organization Pipelined Processor Design 1.
1  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
Chapter Six Enhancing Performance with Pipelining
CSCE 212 Quiz 9 – 3/30/11 1.What is the clock cycle time based on for single-cycle and for pipelining? 2.What two actions can be done to resolve data hazards?
Appendix A Pipelining: Basic and Intermediate Concepts
Pipelined Datapath and Control (Lecture #15) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
1  1998 Morgan Kaufmann Publishers Chapter Six Enhancing Performance with Pipelining.
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.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 17 - Pipelined.
-1.1- PIPELINING 2 nd week. -2- Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM PIPELINING 2 nd week References Pipelining concepts The DLX.
Lecture 15: Pipelining and Hazards CS 2011 Fall 2014, Dr. Rozier.
Pipeline Hazard CT101 – Computing Systems. Content Introduction to pipeline hazard Structural Hazard Data Hazard Control Hazard.
Chapter 2 Summary Classification of architectures Features that are relatively independent of instruction sets “Different” Processors –DSP and media processors.
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell CS352H: Computer Systems Architecture Topic 8: MIPS Pipelined.
Computer Organization CS224 Fall 2012 Lesson 28. Pipelining Analogy  Pipelined laundry: overlapping execution l Parallelism improves performance §4.5.
Pipelining Enhancing Performance. Datapath as Designed in Ch. 5 Consider execution of: lw $t1,100($t0) lw $t2,200($t0) lw $t3,300($t0) Datapath segments.
Morgan Kaufmann Publishers
Chapter 4 CSF 2009 The processor: Pipelining. Performance Issues Longest delay determines clock period – Critical path: load instruction – Instruction.
Comp Sci pipelining 1 Ch. 13 Pipelining. Comp Sci pipelining 2 Pipelining.
Chapter 4 The Processor. Chapter 4 — The Processor — 2 Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined.
Chapter 4 The Processor CprE 381 Computer Organization and Assembly Level Programming, Fall 2012 Revised from original slides provided by MKP.
Pipeline Hazards. CS5513 Fall Pipeline Hazards Situations that prevent the next instructions in the instruction stream from executing during its.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Chapter 6 Pipelined CPU Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides Pipelined operation – laundry analogy Text Fig. 6.1.
1  1998 Morgan Kaufmann Publishers Chapter Six. 2  1998 Morgan Kaufmann Publishers Pipelining Improve perfomance by increasing instruction throughput.
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
Instructor: Senior Lecturer SOE Dan Garcia CS 61C: Great Ideas in Computer Architecture Pipelining Hazards 1.
LECTURE 7 Pipelining. DATAPATH AND CONTROL We started with the single-cycle implementation, in which a single instruction is executed over a single cycle.
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
10/11: Lecture Topics Execution cycle Introduction to pipelining
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.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
CS203 – Advanced Computer Architecture Pipelining Review.
Lecture 5. MIPS Processor Design Pipelined MIPS #1 Prof. Taeweon Suh Computer Science & Engineering Korea University COSE222, COMP212 Computer Architecture.
Chapter Six.
Computer Organization CS224
Pipelining Chapter 6.
CSCI206 - Computer Organization & Programming
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers The Processor
Single Clock Datapath With Control
Pipeline Implementation (4.6)
CDA 3101 Spring 2016 Introduction to Computer Organization
Chapter 4 The Processor Part 3
Morgan Kaufmann Publishers The Processor
Pipelining Chapter 6.
Morgan Kaufmann Publishers Enhancing Performance with Pipelining
CSCI206 - Computer Organization & Programming
Chapter Six.
Chapter Six.
CS203 – Advanced Computer Architecture
Pipelining: Basic Concepts
Pipelining.
Pipelining Chapter 6.
Morgan Kaufmann Publishers The Processor
Pipelining Chapter 6.
Guest Lecturer: Justin Hsia
Presentation transcript:

Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves computer performance. 4)Define structural hazard, data hazard, and control hazard. 5)Define the term stall. 6)Explain the concept of forwarding (bypassing).

Automotive Assembly Steps Build body Paint body Build engine assembly Attach engine assembly Add interior lining Add interior seats Add dash board Test vehicle CS2710 Computer Organization2

Assembly Line concept (conceived by Henry Ford) CS2710 Computer Organization3

Sequential instruction execution Five stages (steps) 1.IF: Instruction fetch from memory (200ps) 2.ID: Instruction decode & register read (100ps) 3.EX: Execute operation/calculate address (200ps) 4.MEM: Access memory operand (200ps) 5.WB: Write result back to register (100ps) CS2710 Computer Organization4

Chapter 4 — The Processor — 5 Pipelining is an implementation technique in which the stages of multiple instructions overlap Single-cycle (T c = 800ps) Pipelined (T c = 200ps) Stage duration varies All stages of equal duration

Pipeline speedup Ideal conditions – All stages are balanced (equal) If not balanced, speedup is less Speedup due to increased throughput – Latency (time for each instruction) does not decrease CS2710 Computer Organization6

Chapter 4 — The Processor — 7 MIPS ISA is designed for pipelining All MIPS instructions are 32-bits – Easier to fetch and decode in one cycle – Intel x86: 1- to 17-byte instructions Few and regular instruction formats – Can decode and read registers in one step Simple Load/Store addressing – Can calculate address in 3 rd stage, access memory in 4 th stage Consistent alignment of memory operands – Memory access takes only one cycle

Chapter 4 — The Processor — 8 Pipelining has hazards - situations that prevent starting the next instruction in the next cycle 1.Structure hazards – A required resource is busy 2.Data hazard – Need to wait for previous instruction to complete its data read/write 3.Control hazard – Deciding on control action depends on previous instruction

Chapter 4 — The Processor — 9 Structure Hazards Conflict for use of a resource In MIPS pipeline with a single memory – Load/store requires data access – Instruction fetch would have to stall for that cycle Would cause a pipeline “bubble” Hence, pipelined datapaths require separate instruction/data memories – Or separate instruction/data caches

Chapter 4 — The Processor — 10 Data Hazards An instruction depends on completion of data access by a previous instruction add$s0, $t0, $t1 sub$t2, $s0, $t3 $s0 is written here $s0 is read here

Chapter 4 — The Processor — 11 Workaround: Forwarding (aka Bypassing) Use result when it is computed – Don’t wait for it to be stored in a register – Requires extra connections in the datapath

Chapter 4 — The Processor — 12 Load-Use Data Hazard Can’t always avoid stalls by forwarding – If value not computed when needed – Can’t forward backward in time!

Chapter 4 — The Processor — 13 Code Scheduling to Avoid Stalls Reorder code to avoid use of load result in the next instruction C/Java code for A=B+E; C=B+F; lw$t1, 0($t0) #t1=B lw$t2, 4($t0) #t2=E add$t3, $t1, $t2 #B+E sw$t3, 12($t0) #t3=A lw$t4, 8($t0) #t4=F add$t5, $t1, $t4 #B+F sw$t5, 16($t0) #t5=C stall lw$t1, 0($t0) #t1=B lw$t2, 4($t0) #t2=E lw$t4, 8($t0) #t3=F add$t3, $t1, $t2 #B+E sw$t3, 12($t0) #A add$t5, $t1, $t4 #B+F sw$t5, 16($t0) #>C 11 cycles, no stalls 13 cycles including 2 stalls

Chapter 4 — The Processor — 14 Control Hazards Branch determines flow of control – Fetching next instruction depends on branch outcome – Pipeline can’t always fetch correct instruction Still working on ID stage of branch! In MIPS pipeline – Need to compare registers and compute target early in the pipeline – Add hardware to do it in ID stage (more complex!)

Chapter 4 — The Processor — 15 Stall on Branch Wait until branch outcome determined before fetching next instruction Is this the best possible outcome? Can you think of another alternative to avoid stalling?

Performance needs 17% of instructions executed in the SPECint2006 benchmark are branch instructions – If we always stalled for 1 clock cycle on the branch, what performance penalty would we have? CS2710 Computer Organization16

Branch Prediction – A method of resolving branch hazards that assumes a given outcome for the branch and proceeds from that assumption rather than waiting to ascertain the actual outcome CS2710 Computer Organization17