Lecture 17: Pipelining Today’s topics: 5-stage pipeline Hazards.

Slides:



Advertisements
Similar presentations
1 Lecture: Pipelining Hazards Topics: Basic pipelining implementation, hazards, bypassing HW2 posted, due Wednesday.
Advertisements

1 Lecture: Out-of-order Processors Topics: out-of-order implementations with issue queue, register renaming, and reorder buffer, timing, LSQ.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
Lecture: Pipelining Basics
1 Lecture 17: Basic Pipelining Today’s topics:  5-stage pipeline  Hazards and instruction scheduling Mid-term exam stats:  Highest: 90, Mean: 58.
1 Lecture 3: Pipelining Basics Biggest contributors to performance: clock speed, parallelism Today: basic pipelining implementation (Sections A.1-A.3)
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
1 Lecture 18: Pipelining Today’s topics:  Hazards and instruction scheduling  Branch prediction  Out-of-order execution Reminder:  Assignment 7 will.
Lecture 16: Basic CPU Design
1 Lecture 4: Advanced Pipelines Data hazards, control hazards, multi-cycle in-order pipelines (Appendix A.4-A.10)
Lecture: Pipelining Basics
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.
Chapter 2 Summary Classification of architectures Features that are relatively independent of instruction sets “Different” Processors –DSP and media processors.
Pipeline Hazards. CS5513 Fall Pipeline Hazards Situations that prevent the next instructions in the instruction stream from executing during its.
Winter 2002CSE Topic Branch Hazards in the Pipelined Processor.
Lecture 16: Basic Pipelining
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
1 Lecture 3: Pipelining Basics Today: chapter 1 wrap-up, basic pipelining implementation (Sections C.1 - C.4) Reminders:  Sign up for the class mailing.
1 Lecture: Pipelining Extensions Topics: control hazards, multi-cycle instructions, pipelining equations.
Computer Organization
Note how everything goes left to right, except …
CSCI206 - Computer Organization & Programming
Lecture 15: Basic CPU Design
Lecture 16: Basic Pipelining
Lecture: Pipelining Basics
Lecture 17: Pipelining Today’s topics: 5-stage pipeline Hazards
Pipeline Implementation (4.6)
CDA 3101 Spring 2016 Introduction to Computer Organization
\course\cpeg323-08F\Topic6b-323
Pipelining Lessons 6 PM T a s k O r d e B C D A 30
Lecture: Pipelining Basics
Forwarding Now, we’ll introduce some problems that data hazards can cause for our pipelined processor, and show how to handle them with forwarding.
Chapter 4 The Processor Part 3
Morgan Kaufmann Publishers The Processor
Lecture 6: Advanced Pipelines
Pipelining review.
Lecture 16: Basic Pipelining
CS 704 Advanced Computer Architecture
Lecture 15: Basic CPU Design
Lecture 19: Branches, OOO Today’s topics: Instruction scheduling
Lecture: Pipelining Hazards
Lecture 18: Pipelining Today’s topics:
Lecture: Pipelining Hazards
Lecture 5: Pipelining Basics
Lecture 18: Pipelining Today’s topics:
Pipelining in more detail
CSCI206 - Computer Organization & Programming
CSC 4250 Computer Architectures
Lecture: Pipelining Hazards
Pipelining Lessons 6 PM T a s k O r d e B C D A 30
CSCI206 - Computer Organization & Programming
Lecture: Out-of-order Processors
Lecture 8: Dynamic ILP Topics: out-of-order processors
\course\cpeg323-05F\Topic6b-323
Lecture 17: Pipelining Today’s topics: 5-stage pipeline Hazards.
Lecture 19: Branches, OOO Today’s topics: Instruction scheduling
Lecture: Pipelining Extensions
Lecture 18: Pipelining Today’s topics:
Instruction Execution Cycle
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Lecture 4: Advanced Pipelines
Lecture: Pipelining Hazards
Introduction to Computer Organization and Architecture
CMCS Computer Architecture Lecture 20 Pipelined Datapath and Control April 11, CMSC411.htm Mohamed.
Guest Lecturer: Justin Hsia
Lecture 9: Dynamic ILP Topics: out-of-order processors
Lecture: Pipelining Basics
©2003 Craig Zilles (derived from slides by Howard Huang)
Pipelining Hazards.
Presentation transcript:

Lecture 17: Pipelining Today’s topics: 5-stage pipeline Hazards

A 5-Stage Pipeline Source: H&P textbook

Pipeline Summary RR ALU DM RW ADD R1, R2,  R3 Rd R1,R2 R1+R2 -- Wr R3 BEQ R1, R2, 100 Rd R1, R2 -- -- -- Compare, Set PC LD 8[R3]  R6 Rd R3 R3+8 Get data Wr R6 ST 8[R3]  R6 Rd R3,R6 R3+8 Wr data --

Conflicts/Problems I-cache and D-cache are accessed in the same cycle – it helps to implement them separately Registers are read and written in the same cycle – easy to deal with if register read/write time equals cycle time/2 Instructions can’t skip the DM stage, else conflict for RW Consuming instruction may have to wait for producer Branch target changes only at the end of the second stage -- what do you do in the meantime?

Hazards Structural hazards: different instructions in different stages (or the same stage) conflicting for the same resource Data hazards: an instruction cannot continue because it needs a value that has not yet been generated by an earlier instruction Control hazard: fetch cannot continue because it does not know the outcome of an earlier branch – special case of a data hazard – separate category because they are treated in different ways

Structural Hazards Example: a unified instruction and data cache  stage 4 (MEM) and stage 1 (IF) can never coincide The later instruction and all its successors are delayed until a cycle is found when the resource is free  these are pipeline bubbles Structural hazards are easy to eliminate – increase the number of resources (for example, implement a separate instruction and data cache, add more register ports)

Data Hazards An instruction produces a value in a given pipeline stage A subsequent instruction consumes that value in a pipeline stage The consumer may have to be delayed so that the time of consumption is later than the time of production

Example 1 – No Bypassing IF IF IF IF IF IF IF IF D/R D/R D/R D/R D/R Show the instruction occupying each stage in each cycle (no bypassing) if I1 is R1+R2R3 and I2 is R3+R4R5 and I3 is R7+R8R9 CYC-1 CYC-2 CYC-3 CYC-4 CYC-5 CYC-6 CYC-7 CYC-8 IF IF IF IF IF IF IF IF D/R D/R D/R D/R D/R D/R D/R D/R ALU ALU ALU ALU ALU ALU ALU ALU DM DM DM DM DM DM DM DM RW RW RW RW RW RW RW RW

Example 1 – No Bypassing IF I1 IF I2 IF I3 IF I3 IF I3 IF I4 IF I5 IF Show the instruction occupying each stage in each cycle (no bypassing) if I1 is R1+R2R3 and I2 is R3+R4R5 and I3 is R7+R8R9 CYC-1 CYC-2 CYC-3 CYC-4 CYC-5 CYC-6 CYC-7 CYC-8 IF I1 IF I2 IF I3 IF I3 IF I3 IF I4 IF I5 IF D/R D/R I1 D/R I2 D/R I2 D/R I2 D/R I3 D/R I4 D/R ALU ALU ALU I1 ALU ALU ALU I2 ALU I3 ALU DM DM DM DM I1 DM DM DM I2 DM I3 RW RW RW RW RW I1 RW RW RW I2

Example 2 – Bypassing IF IF IF IF IF IF IF IF D/R D/R D/R D/R D/R D/R Show the instruction occupying each stage in each cycle (with bypassing) if I1 is R1+R2R3 and I2 is R3+R4R5 and I3 is R3+R8R9. Identify the input latch for each input operand. CYC-1 CYC-2 CYC-3 CYC-4 CYC-5 CYC-6 CYC-7 CYC-8 IF IF IF IF IF IF IF IF D/R D/R D/R D/R D/R D/R D/R D/R ALU ALU ALU ALU ALU ALU ALU ALU DM DM DM DM DM DM DM DM RW RW RW RW RW RW RW RW

Example 2 – Bypassing IF I1 IF I2 IF I3 IF I4 IF I5 IF IF IF D/R D/R Show the instruction occupying each stage in each cycle (with bypassing) if I1 is R1+R2R3 and I2 is R3+R4R5 and I3 is R3+R8R9. Identify the input latch for each input operand. CYC-1 CYC-2 CYC-3 CYC-4 CYC-5 CYC-6 CYC-7 CYC-8 IF I1 IF I2 IF I3 IF I4 IF I5 IF IF IF D/R D/R I1 D/R I2 D/R I3 D/R I4 D/R D/R D/R L3 L3 L4 L3 L5 L3 ALU ALU ALU I1 ALU I2 ALU I3 ALU ALU ALU DM DM DM DM I1 DM I2 DM I3 DM DM RW RW RW RW RW I1 RW I2 RW I3 RW

Problem 1 IF D/R ALU DM RW IF D/R ALU DM RW IF D/R ALU DM RW add $1, $2, $3 lw $4, 8($1) IF D/R ALU DM RW

Problem 2 IF D/R ALU DM RW IF D/R ALU DM RW IF D/R lw $1, 8($2)

Problem 3 IF D/R ALU DM RW IF D/R ALU DM RW IF D/R ALU DM RW lw $1, 8($2) sw $1, 8($3) IF D/R ALU DM RW

Title Bullet