Pipeline Control Hazards and Instruction Variations Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.8 &

Slides:



Advertisements
Similar presentations
SE-292 High Performance Computing
Advertisements

Morgan Kaufmann Publishers The Processor
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.
CMSC 611: Advanced Computer Architecture Pipelining Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Instruction-Level Parallelism (ILP)
MIPS Pipeline Default behaviour and pipeline organization The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
1 RISC Pipeline Han Wang CS3410, Spring 2010 Computer Science Cornell University See: P&H Chapter 4.6.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Pipeline Hazards See: P&H Chapter 4.7.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University RISC Pipeline See: P&H Chapter 4.6.
Pipeline Hazards Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.7.
Pipeline Control Hazards and Instruction Variations Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.8 &
EECS 470 Pipeline Control Hazards Lecture 5 Coverage: Chapter 3 & Appendix A.
Pipelining III Andreas Klappenecker CPSC321 Computer Architecture.
1  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
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.
L17 – Pipeline Issues 1 Comp 411 – Fall /1308 CPU Pipelining Issues Finishing up Chapter 6 This pipe stuff makes my head hurt! What have you been.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
COMP381 by M. Hamdi 1 (Recap) Control Hazards. COMP381 by M. Hamdi 2 Control (Branch) Hazard A: beqz r2, label B: label: P: Problem: The outcome.
Lec 9: Pipelining Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University.
7/2/ _23 1 Pipelining ECE-445 Computer Organization Dr. Ron Hayne Electrical and Computer Engineering.
Pipelined Datapath and Control (Lecture #15) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed, Sep 21, 2005 Topic: Pipelining -- Intermediate Concepts (Control Hazards)
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 Stalls and flushes  So far, we have discussed data hazards that can occur in pipelined CPUs if some instructions depend upon others that are still executing.
Lecture 15: Pipelining and Hazards CS 2011 Fall 2014, Dr. Rozier.
Computer Science Education
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.
Pipeline Hazards. CS5513 Fall Pipeline Hazards Situations that prevent the next instructions in the instruction stream from executing during its.
CMPE 421 Parallel Computer Architecture
CS 1104 Help Session IV Five Issues in Pipelining Colin Tan, S
Chapter 6 Pipelined CPU Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides Pipelined operation – laundry analogy Text Fig. 6.1.
Branch Hazards and Static Branch Prediction Techniques
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 13: Branch prediction (Chapter 4/6)
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.
L17 – Pipeline Issues 1 Comp 411 – Fall /23/09 CPU Pipelining Issues Read Chapter This pipe stuff makes my head hurt! What have you been.
CSCE 212 Chapter 6 Enhancing Performance with Pipelining Instructor: Jason D. Bakos.
ECE/CS 552: Pipeline Hazards © Prof. Mikko Lipasti Lecture notes based in part on slides created by Mark Hill, David Wood, Guri Sohi, John Shen and Jim.
Pipelining: Implementation CPSC 252 Computer Organization Ellen Walker, Hiram College.
EECS 322 April 10, 2000 EECS 322 Computer Architecture Pipeline Control, Data Hazards and Branch Hazards.
Pipeline Control Hazards Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H Appendix 4.8.
Computer Organization CS224
Stalling delays the entire pipeline
CSCI206 - Computer Organization & Programming
Pipeline Hazards Hakim Weatherspoon CS 3410, Spring 2012
Pipeline Control Hazards and Instruction Variations
Pipeline Control Hazards
Single Clock Datapath With Control
CDA 3101 Spring 2016 Introduction to Computer Organization
Hakim Weatherspoon CS 3410 Computer Science Cornell University
Morgan Kaufmann Publishers The Processor
Pipelining review.
Data and Control Hazards
Pipeline Control Hazards and Instruction Variations
Pipelining in more detail
CSCI206 - Computer Organization & Programming
Data Hazards Data Hazard
Pipeline control unit (highly abstracted)
The Processor Lecture 3.6: Control Hazards
Pipeline control unit (highly abstracted)
Pipeline Control unit (highly abstracted)
Control unit extension for data hazards
Control unit extension for data hazards
Pipelining Hakim Weatherspoon CS 3410 Computer Science
Need to stall for one cycle.
Presentation transcript:

Pipeline Control Hazards and Instruction Variations Hakim Weatherspoon CS 3410, Spring 2011 Computer Science Cornell University See P&H Appendix 4.8 & 2.16 and 2.17

2 Announcements PA1 available: mini-MIPS processor PA1 due next Friday Work in pairs Use your resources FAQ, class notes, book, Sections, office hours, newsgroup, CSUGLab Prelims: Thursday, March 10 th in class Thursday, April 28 th Evening

3 Goals for Today Recap: Data Hazards Data dependencies Problem, detection, and solutions (delaying, stalling, forwarding, bypass, etc) Control Hazards What is the next instruction to execute if a branch is taken? Not taken? Instruction Variations sdf

4 Data Hazard Recap Delay Slot(s) Modify ISA to match implementation Stall Pause current and all subsequent instructions Forward/Bypass Try to steal correct value from elsewhere in pipeline Otherwise, fall back to stalling or require a delay slot Tradeoffs?

5 More Hazards beq r1, r2, L add r3, r0, r3 sub r5, r4, r6 L: or r3, r2, r4 data mem inst mem D B A PC +4

6 More Hazards beq r1, r2, L add r3, r0, r3 sub r5, r4, r6 L: or r3, r2, r4 data mem inst mem D B A PC +4

7 Control Hazards instructions are fetched in stage 1 (IF) branch and jump decisions occur in stage 3 (EX) i.e. next PC is not known until 2 cycles after branch/jump Delay Slot ISA says N instructions after branch/jump always executed –MIPS has 1 branch delay slot Stall (+ Zap) prevent PC update clear IF/ID pipeline register –instruction just fetched might be wrong one, so convert to nop allow branch to continue into EX stage

8 Delay Slot beq r1, r2, L ori r2, r0, 1 L: or r3, r1, r4 data mem inst mem D B A PC +4 branch calc decide branch

9 Control Hazards: Speculative Execution Control Hazards instructions are fetched in stage 1 (IF) branch and jump decisions occur in stage 3 (EX) i.e. next PC not known until 2 cycles after branch/jump Stall Delay Slot Speculative Execution Guess direction of the branch –Allow instructions to move through pipeline –Zap them later if wrong guess Useful for long pipelines

10 Loops

11 Branch Prediction

12 Pipelining: What Could Possibly Go Wrong? Data hazards register file reads occur in stage 2 (IF) register file writes occur in stage 5 (WB) next instructions may read values soon to be written Control hazards branch instruction may change the PC in stage 3 (EX) next instructions have already started executing Structural hazards resource contention so far: impossible because of ISA and pipeline design

13 Variations More shifts

14 Variations Condition flags

15 Variations Condition flags

16 Variations Conditional instructions top: CMP r3, r4 SUBGT r3, r3, r4 SUBLT r4, r4, r3 BNE top

17 Variations Stack operations & multiple destinations

18 Variations String instructions MOV AX, FFh MOV DI, 5000h MOV CX, 2000h REP STOSB

19 Variations Vector instructions vaddubs v3, v1, v2