Pipelining Wrapup Brief overview of the rest of chapter 3

Slides:



Advertisements
Similar presentations
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.
Advertisements

Advanced Computer Architectures Laboratory on DLX Pipelining Vittorio Zaccaria.
COMP 4211 Seminar Presentation Based On: Computer Architecture A Quantitative Approach by Hennessey and Patterson Presenter : Feri Danes.
Instruction Set Issues MIPS easy –Instructions are only committed at MEM  WB transition Other architectures are more difficult –Instructions may update.
CMSC 611: Advanced Computer Architecture Instruction Level Parallelism Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides.
Pipelining Two forms of pipelining
Lecture 6: Pipelining MIPS R4000 and More Kai Bu
1 Lecture: Pipeline Wrap-Up and Static ILP Topics: multi-cycle instructions, precise exceptions, deep pipelines, compiler scheduling, loop unrolling, software.
CIS429/529 Winter 2007 Pipelining II- 1 Additional pipelining topics Why pipelining is so hard: exception handling ILP techniques: loop unrolling.
CIS429/529 Winter 2007 Pipelining-1 1 Pipeling RISC/MIPS64 five stage pipeline Basic pipeline performance Pipeline hazards Branch hazards More pipeline.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed., Sep 24, 2003 Topic: Pipelining -- Intermediate Concepts (Multicycle Operations;
1 Lecture 5: Pipeline Wrap-up, Static ILP Basics Topics: loop unrolling, VLIW (Sections 2.1 – 2.2) Assignment 1 due at the start of class on Thursday.
Instruction Pipelining Review
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
EECC551 - Shaaban #1 Fall 2002 lec# Floating Point/Multicycle Pipelining in MIPS Completion of MIPS EX stage floating point arithmetic operations.
EENG449b/Savvides Lec 4.1 1/22/04 January 22, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
EENG449b/Savvides Lec 4.1 1/25/05 January 25 and 25, 2005 Prof. Andreas Savvides Spring g449b EENG 449b/CPSC.
ENGS 116 Lecture 61 Pipelining Difficulties and MIPS R4000 Vincent H. Berk October 6, 2008 Reading for today: A.3 – A.4, article: Yeager Reading for Wednesday:
EECC551 - Shaaban #1 Lec # 2 Winter Instruction Pipelining Review Instruction pipelining is CPU implementation technique where multiple.
CIS429.S00: Lec12- 1 Miscellaneous pipelining topics Why pipelining is so hard: exception handling Advanced pipelining techniques: loop unrolling.
EECC551 - Shaaban #1 Lec # 4 winter Data Hazards Requiring Stall Cycles In some code sequence cases, potential data hazards cannot be handled.
Instruction Pipelining Review:
EECC551 - Shaaban #1 Lec # 2 Winter DLX Instruction Format 16 bits6 bits5 bits Immediate rdrs1Opcode 6 bits5 bits 11 bits Opcoders1rs2rdfunc.
Computer Architecture
EECC551 - Shaaban #1 Fall 2001 lec# Floating Point/Multicycle Pipelining in DLX Completion of DLX EX stage floating point arithmetic operations.
1 Manchester Mark I, This was the second (the first was a small- scale prototype) machine built at Cambridge. A production version of this computer.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Lecture 5: Pipelining Implementation Kai Bu
1 Appendix A Pipeline implementation Pipeline hazards, detection and forwarding Multiple-cycle operations MIPS R4000 CDA5155 Spring, 2007, Peir / University.
CSC 4250 Computer Architectures September 26, 2006 Appendix A. Pipelining.
Pipeline Extensions prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University MIPS Extensions1May 2015.
Spring 2003CSE P5481 Precise Interrupts Precise interrupts preserve the model that instructions execute in program-generated order, one at a time If an.
F00: 1 CS/EE 5810 CS/EE 6810 Exceptions. F00: 2 CS/EE 5810 CS/EE 6810 Exceptions Just when you thought pipelines were not that hard… Pipeline benefit.
Appendix A. Pipelining: Basic and Intermediate Concept
LECTURE 10 Pipelining: Advanced ILP. EXCEPTIONS An exception, or interrupt, is an event other than regular transfers of control (branches, jumps, calls,
CSC 4250 Computer Architectures September 22, 2006 Appendix A. Pipelining.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Data Hazards Dependent instructions add %g1, %g2, %g3 sub %l1, %g3, %o0 Forwarding helps, but not all hazards can be avoided.
CMSC 611: Advanced Computer Architecture
Instruction-Level Parallelism
Exceptions Another form of control hazard Could be caused by…
Computer Organization CS224
Lecture 15: Pipelining: Branching & Complications
Lecture 07: Pipelining Multicycle, MIPS R4000, and More
Appendix C Pipeline implementation
Exceptions & Multi-cycle Operations
Pipelining: Advanced ILP
CS 5513 Computer Architecture Pipelining Examples
Lecture 6: Advanced Pipelines
Pipelining Multicycle, MIPS R4000, and More
Pipelining review.
Pipelining Chapter 6.
The processor: Pipelining and Branching
Instruction Pipelining Review:
Pipelining in more detail
How to improve (decrease) CPI
Project Instruction Scheduler Assembler for DLX
Overview What are pipeline hazards? Types of hazards
Pipelining Multicycle, MIPS R4000, and More
Extending simple pipeline to multiple pipes
Lecture 4: Advanced Pipelines
Control Hazards Branches (conditional, unconditional, call-return)
CMSC 611: Advanced Computer Architecture
Lecture 06: Pipelining Implementation
Throughput = #instructions per unit time (seconds/cycles etc.)
Lecture 5: Pipeline Wrap-up, Static ILP
Interrupts and exceptions
CS 3853 Computer Architecture Pipelining Examples
CMSC 611: Advanced Computer Architecture
Pipelining Hazards.
Presentation transcript:

Pipelining Wrapup Brief overview of the rest of chapter 3 Exceptions and the pipeline Multicycle pipelines : Floating Point

Exceptions An exception is when the normal execution order of instructions is changed. This has many names: Interrupt Fault Exception Examples: I/O device request Invoking OS service Page Fault Malfunction Undefined instruction Overflow/Arithmetic Anomaly Etc!

Exception Characteristics Synchronous vs. asynchronous Synchronous when invoked by current instruction Asynchronous when external device User requested vs. coerced Requested is predictable User maskable vs. non-maskable Can sometimes ignore some interrupts, e.g. overflows Within vs. Between Instructions Exception can happen anywhere in the pipeline Resume vs. Terminate Terminate if execution stops, resume if we need to return to some code and restart execution, must store some state

Stopping/Restarting Execution DLX – occurs in MEM or EX stages Pipeline must be shut down PC saved for restart Branches must be re-executed, condition code must not change DLX steps to restart Force trap instruction into pipe on next IF Erase following instructions by writing all 0’s to pipeline latches Allow preceding instructions to complete if possible Let all preceding instructions complete if they can; this freezes the state at the time the exception is handled After OS exception handling routine starts, it must save the PC of the faulting instruction

Complications Saving the single PC sometimes isn’t enough Using delayed branches, given two delay slots Both delay slots contain branch instructions Recall with delayed branches, we’ll always execute the instructions in the delay slots Say there is an exception processing the 1st delay slot; the 2nd delay slot is erased Upon return, the restart position is the PC which becomes the 1st delay slot We’ll then continue to execute the 2nd delay slot instruction AND the following instruction! If we branched on the 2nd delay slot, we just executed one instruction too many Complication arises from interaction with effective ordering in the delayed branch Solution : save needed delay slots and PC

DLX Exceptions Pipeline Stage Exception Possibilities IF Page fault on IF, misaligned memory access, memory-protection violation ID Undefined or illegal opcode EX Arithmetic exception MEM Page fault on data fetch; misaligned memory access; memory protection violation WB None

MultiCycle Operations Unfortunately, it is impractical to require all DLX floating point operations to complete in one clock cycle (or even two) Could, but it would result in a seriously slow clock! Consider we do this and we have the following units: Integer EX FP Multiple FP Add FP Divide The FP units merely require multiple cycles to complete

Unpipelined FP Units Unit Latency Int 0 FPAdd 3 FPMult 6 FPDiv 24 Solution: Pipeline FP units

Pipelined FP Units Not pipelined Need 24 cycles Allows 4 outstanding adds, 7 multiplies, 1 int, 1 divide

New Hazard Problems! Structural hazards with divide unit not fully pipelined WAW hazards now possible since instructions can reach WB stage at different times At least WAR hazards not possible, since reads still occur early in the ID stage Instructions can complete in a different order than issued, causing more problems with exception handling Longer latency increases frequency of stalls for RAW hazards How would you tell if the efforts here are worth it?

Example FP Sequence with RAW Hazard Uses forwarding for each stage when data is available SD stalled one extra cycle for MEM to not conflict with ADDD

Example FP Sequence with Hazards Cycle 9: three requirements for memory Cycle 11: three requirements for write-back More stalls What if the last instruction was issued one cycle earlier? We have a WAW conflict

WinDLX Code Example .data .align 4 X: .byte 50,50,23,25 ; Random FP Number .text .global main main: lf f1, X divf f1, f1, f1 addi r2, r0, #3 Finish: ;*** end trap 0 Try inserting other addi’s here! Causes WAW stall

FP Pipelining Performance Given all the new problems, is it worth it? See book for details Overall answer is yes Latency varies from 46-59% of functional units on the benchmarks Fortunately, divides are rare As before, compiler scheduling can help a lot