COSC4201 Pipelining. Prof. Mokhtar Aboelaze York University
|
|
- Lillian Bishop
- 5 years ago
- Views:
Transcription
1 COSC4201 Pipelining Prof. Mokhtar Aboelaze York University 1 Instructions: Fetch Every instruction could be executed in 5 cycles, these 5 cycles are (MIPS like machine). Instruction fetch IR Mem[PC] NPC PC+4 In this stage, we fetch the instruction from the memory and increment the program counter to point to the next instruction (all instruction in DLX are 32 bits long) 2
2 Instructions: Decode reg fetch Instruction decode/register fetch A Regs[IR ] B Regs[IR ] Imm ((IR 16 ) 16 ##IR Also, the instruction is decoded A and B are 2 temporary registers We can do that since we know the location of the 2 source operands before we start decoding 3 4
3 Instructions: EX/Effective Address Memory ref ALUoutput A + Imm (effective address) Reg-Reg ALU ALUoutput A op B Reg-Immediate ALU ALUoutput A op Imm Branch ALUoutput NPC + Imm; Cond (A op 0) 5 Instruction: Memory Access /Branch Memory reference LMD Mem[ALUoutput] or Mem[Aluoutput] B; Branch If (cond) PC ALUoutput else PC NPC 6
4 Instruction: Write Back Reg-Reg ALU Regs[IR ] ALUoutput Reg Imm ALU Regs[IR ] ALUoutput Load Regs[IR ] LMD 7 Pipelining Execute billions of instructions, so throughout is what matters All instructions same length, registers located in same place in instruction format, memory operands only in loads or stores Pipelining requires that adding a set of registers one between each pair of pipeline stages to convey values and control information between the stages (Fig. 3.5) 8
5 Pipelining 9 10
6 Performance of pipelining Pipelining does not reduce the time to execute the instruction (it actually increases it). It increases the throughput. We can not skip stages anymore, and the pipeline cycle = time for longest cycle longest cycle Example: a machine with 10-ns cycle, it takes 4 cycles for ALU and branches, and 5 for memory (40,20,40%), what is the effect of the pipelining Without execution time = 10*(0.6*4+0.4*5)= 44 ns With pipelining 10+1 (overhead)=11 Speedup = 4 11 Performance of Pipelining Pipelining is an implementation technique where multiple operations on a number of instructions are overlapped in execution. An instruction execution pipeline involves a number of steps, where each step completes a part of an instruction. Each step is called a pipe stage or a pipe segment. Instructions enter the first stage, and proceed till it exit the last stage Throughput the system is measured as the number of instructions completed per second. The time to move an instruction one step down the line is is equal to the machine cycle and is determined by the stage with the longest processing delay. 12
7 Performance of Pipelining The length of a machine clock cycle is determined by the time required for the slowest pipe stage. An important pipeline design consideration is to balance the length of each pipeline stage. If all stages are perfectly balanced, then the time per instruction on a pipelined machine (assuming ideal conditions with no stalls): Time per instruction on unpipelined machine Number of pipe stages Under these ideal conditions: Speedup from pipelining equals the number of pipeline stages: n, One instruction is completed every cycle, CPI = Pipelining Clock Number Time in clock cycles Instruction Number Instruction I IF ID EX MEM WB Instruction I+1 IF ID EX MEM WB Instruction I+2 IF ID EX MEM WB Instruction I+3 IF ID EX MEM WB Instruction I +4 IF ID EX MEM WB Time to fill the pipeline DLX Pipeline Stages: IF = Instruction Fetch ID = Instruction Decode EX = Execution MEM = Memory Access First instruction, I Completed WB = Write Back Last instruction, I+4 completed 14
8 15 Hazards There are situation called hazards that prevents the continuous flow of instructions in the pipe Structural hazards: resource conflicts Data hazards: instruction depends on the results from a previous instruction that is not ready yet. Control hazards: branches (we don t know the address of the next instruction) 16
9 Performance with Hazards Hazards in pipelines may make it necessary to stall the pipeline by one or more cycles and thus degrading performance from the ideal CPI of 1. CPI pipelined = Ideal CPI + Pipeline stall clock cycles per instruction If pipelining overhead is ignored and we assume that the stages are perfectly balanced then: Speedup = CPI unpipelined (1 + Pipeline stall cycles per instruction) When all instructions take the same number of cycles and is equal to the number of pipeline stages then: Speedup = Pipeline depth / (1 + Pipeline stall cycles per instruction) 17 Pipeline Perormance (hazards) If we think of pipelining as improving the effective clock cycle time, then given the the CPI for the unpipelined machine and the CPI of the ideal pipelined machine = 1, then effective speedup of a pipeline with stalls over the unpipelind case is given by: Speedup = 1 X Clock cycles unpiplined 1 + Pipeline stall cycles Clock cycle pipelined When pipe stages are balanced with no overhead, the clock cycle for the pipelined machine is smaller by a factor equal to the pipelined depth: Clock cycle pipelined = clock cycle unpipelined / pipeline depth Pipeline depth = Clock cycle unpipelined / clock cycle pipelined Speedup = 1 X pipeline depth 1 + pipeline stall cycles per instruction 18
10 Structural Hazards When we pipeline a machine, the overlapped instruction execution requires pipelining of functional units and duplication of resources to allow all possible combinations of instructions in the pipeline. If a resource conflict arises due to a hardware resource being required by more than one instruction in a single cycle, and one or more such instructions cannot be accommodated, then a structural hazard has occurred, for example: One example is when we have a single memory for both instructions and data
11 Time (clock cycles) Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 I n s t r. O r d e r Load Ifetch Instr 1 Instr 2 Instr 3 Instr 4 Reg Ifetch ALU Reg Ifetch DMem ALU Reg Ifetch Reg DMem ALU Reg Reg DMem ALU Reg DMem Reg Structural Hazard 21 22
12 Next PC 4 Adder Next SEQ PC RS1 Next SEQ PC Zero? MUX Address Instr Cache IF/ID RS2 Reg File ID/EX MUX MUX ALU EX/MEM Data Cache MEM/WB MUX Datapath Imm Sign Extend RD RD RD WB Data Control Path 23 Structural hazard Example EX: data reference is 40% of the instructions, ideal CPI (ignoring hazards)=1. Assume that a machine with structural hazards has a clock that is 1.05 times higher than the clock rate of a machine without structural hazard. Is pipelining faster? Average instruction time = CPI*T c = ( *1) * T ideal /1.05 = 1.3 * T ideal One solution is to provide a separate memory for instructions 24
13 Data Hazards Pipelining changes the relative timing of the instructions by overlapping their execution. If the timing of read/write accesses to the operands is changed, that might result in incorrect execution Example: DADD DSUB AND OR XOR R1, R2, R3 R4, R1, R5 R6, R1, R7 R8,R1,R9 R10, R1, R11 All the instructions after ADD use the result of the ADD instruction (ready in WB stage) Without proper precautions, SUB will read the old value in R1 SUB, AND instructions need to be stalled for correct execution. 25 Data Hazards X X X 26
14 Data Hazards XOR instruction works fine, since it reads in cycle 6, data written in cycle 5 OR instruction could be made correct if we assumed that writes to the registers is in the first half of the cycle, reads in the second half. And and SUB reads operands in the cycle before it is written (problem) But is that a real problem? 27 Data Hazards (Forwarding) It is one thing to read operand before it is written, and requesting an operand before it is produced. Results of ADD is written in CC 5, read by SUB in CC 3 BUT, the results of ADD is produced in CC 3, requested by SUB in CC 4 We can use Forwarding 1. The ALU result from EX/MEM register is always fed back to the input of the ALU 2. If the forwarding hardware detects that if the previous ALU op writes to a register that is the source of the current ALU op, use a MUX to choose the fed back value instead of source register We need to forward results not only from previous instruction, but from an instruction that started 3 28 cycles earlier
15 Forwarding 29 Forwarding NextPC Registers ID/EX mux mux ALU EX/MEM Data Memory MEM/WR Immediate mux 30
16 Forwarding Consider the following sequence ADD LW SW R1, R2, R3 R4, 0(R1) 12(R1), R4 To prevent stalls, we need to forward the values in R1 and R4 from the pipeline registers to the inputs of the ALU and data memory. We may require a forwarding path from any pipeline register to the input of any functional unit 31 R1 R1 R4 32
17 Data Hazards Classification A hazard is created whenever there is a dependence between instructions and they are close enough that the overlap caused by pipelining would change the order of an access to an operand. Could arise from the fact that the order writing or reading from a memory location is changed. Memory reference is always kept in order. Data Hazard may be classified as RAW, WAW, and WAR 33 Read After Write RAW Hazard Instruction i before instruction j Also called data dependence by compiler people Happens when j tries to read a source before it is written by i The most common of data hazards Dealt with before 34
18 Write after Write hazard (WAW) Example: (general hazard in multiprocessors) A= B+C A= 2.0 If the second instruction completes before the first one, we end up with the wrong value in A 35 Write after Write hazard (WAW) Write After Read (WAR) Instr J writes operand before Instr I reads it I: sub r4,r1,r3 J: add r1,r2,r3 K: mul r6,r1,r7 Called an anti-dependence by compiler writers. This results from reuse of the name r1. Can t happen in MIPS 5 stage pipeline because: All instructions take 5 stages, and Reads are always in stage 2, and Writes are always in stage 5 36
19 Write after Read (WAR) Hazards Ex SW R1, 0(R2) ADD R2, R3, R4 With variable depth pipeline, the first instruction might completes before the first one reads the R2, resulting in the wrong (new) value read. 37 Data Hazards requiring stalls Time (clock cycles) CC1 CC2 CC3 CC4 CC5 I n s t r. lw r1, 0(r2) sub r4,r1,r6 Ifetch Reg Ifetch ALU Reg DMem ALU Reg DMem Reg O r d e r and r6,r1,r7 or r8,r1,r9 Ifetch Reg Ifetch ALU Reg DMem ALU Reg DMem Reg 38
20 Data Hazards Requiring Stalls Consider the following code LW SUB AND OR R1,0(R2) R4,R1,R5 R6,R1,R7 R8,R1,R9 LW instruction does not have the data until the end of CC4 SUB needs the data by the beginning of CC4 No way but to stall the pipe for a cycle 39 Data Hazards Requiring Stalls In such a case, we need a hardware, called pipeline interlock, to detect the hazard and stall the pipeline. The interlock detects the hazard, and introduces a bubble stalling the pipeline That might change the forwarding. 40
21 41 42
22 Compiler Scheduling for Data Hazards Compiler may try to rearrange the code in order to avoid stalls. For example, avoid generating a code where there is a load followed by the immediate use of the loaded value Example, consider the code segment A=b+c D=e-f Here is two way of generating code 43 EX LW Rb,b LW Rc,c ADD Ra,Rb,Rc SW a,ra LW Rf,f LW Re,e SUB Rd,Re,Rf SW d,rd Stall Stall LW Rb,b LW Rc,c LW Re,e ADD Ra,Rb,Rc LW Re,e SW a,ra SUB Rd,Re,Rf SW d,rd 44
23 Control for DLX Pipeline The process of letting the instruction move from the ID to EX stage is called issuing the instruction For the DLX integer pipeline, all data hazards are detected before the instruction is issued That reduces the complexity of the control, since interlocks detect the hazard before any change to the state of the machine is done, we don t have to backtrack and restore. 45 Forwarding (Implementation) The following hardware is used to implement forwarding. Forwarding could be done from the ALU or memory (3.17 & 3.19) 46
24 47 48
25 Implementing Load Interlock The following comparison is used, change the control portion of ID/IX to zero, and recycle IF/ID registers. Operands Field of ID/IX Load Operand field of IF/ID Reg. Reg. ALU Comparison ID/IX.IR = IF/ID.IR Load Reg-Reg ALU ID/IX.IR = IF/ID.IR load Load, Store, ALU Imm ID/IX.IR = IF/ID.IR Control Hazards Control hazards arise from branching, where we don t know the next inst. If a branch is taken then we need the target address, otherwise, it is untaken or fall through The simplest method, is to stall the pipeline until we know the result of the branch That leads to 3 stall cycles 50
26 Control Hazards Branch instruction IF ID EX MEM WB Branch successor IF stall stall IF ID EX MEM WB Branch successor + 1 IF ID EX MEM WB Branch successor + 2 IF ID EX MEM Branch successor + 3 IF ID EX Branch successor + 4 IF ID Branch successor + 5 IF In order to reduce the branch penalty, we must do two things 1. Find out if the branch is taken or not as soon as possible 2. Compute the taken PC ASAP 51 Control Hazards In MIPS, the branches BEQZ and BNEZ require a comparison with 0, could be done easily by adding a comparator and performing it in the ID cycle. We can also calculate the branch target address during the ID stage by adding another adder The new architecture in Fig 3.22 That requires only one single stall cycle In some machines (CISC and deeply pipelined) may take a lot more than one cycle (another advantage of RISC) 52
27 53 Branch Behavior in Programs From Figure 3.24 and 3.25 we can say 1. Forward branches dominates backward branches 2. Branches varies from 4% to 25% 3. Probability of backward branches being taken is higher than forward branches taken (backwards mainly are loops) How can we use these facts to improve the performance of the machine. 54
28 Compile Time Solutions Compiler may decide to predicts during compilation if the branch is taken or not Easiest way is to freeze or flush the pipe (simple) Predict branch is not taken, proceed as usual but be careful either not to change the state of the machine (or back out if you do) until you know if the prediction was correct or not Predict taken Useful only if we know the target address before we know the result of the comparison (condition) 55 Sceduling the Branch Delay Slot In this case, the job of the compiler is to make the successor instruction valid and useful (Fig. 3.28) In (a) the scheduled instruction should be done anyway, no harm at all IN (b) and (c) the use of R1 in the branch condition prevents moving the instruction to after the branch In both cases, it must be O.K. to execute the SUB instruction when the branch will go the opposite direction In (b) useful when the branch is taken with a high probability, the reverse in (c). 56
29 57 Canceling Branches Cancelling or nullifying branch works as follows The instruction include the direction that the branch was predicted. When the branch behaves as predicted, the instruction in the branch delay slot is executed as it would normally be with a delayed branch. Otherwise, the instruction is cancelled and is changed to no-op. 58
30 The behavior of a predict taken canceling branch depends on whether the branch is taken or not. The instruction in the delay slot is executed on;y if the branch is taken and is otherwise made into a no-op 59 Performance of branch Schemes Consider an R4000-style pipeline with the following penalty for branches What is the addition to the CPI if we assume the following. Unconditional=4%, conditional untaken =10%, conditional taken = 6% Branch Scheme Penalty unconditional Penalty untaken Penalty taken Flush pipeline Predict taken Predict untaken
31 Perormance Scheme Uncond Untaken Taken total Frequency 4% 10% 6% 20% stall 0.04*2= *3= *3= Predict taken 0.04*2= *3= *2= Predict untaken 0.04*2= *3= Static Branch Prediction If we can predict branches, w can improve the performance of the code LW R1,0(R2) SUB R1,R1,R3 BEQZ R1,L OR R4,R5,R6 L: ADD R7,R8,R9 Almost always, R7 not needed on the fall through Rarely take, R4 no needed on the taken path LW ADD SUB BEQZ OR L: LW OR SUB BEQZ L: ADD R1,0(R2) R7,R8,R9 R1,R1,R3 R1,L R4,R5,R6 R1,0(R2) R4,R5,R6 R1,R1,R3 R1,L 62
32 Static Branch Predictions From Figure??, most branches are taken, so predict taken (mis-prediction ranges from 59% to 9%). Predict backward branches to be take, forward not taken (for some programs that could be beneficial). Use profile information, we run the program and keep information about what branches are taken and what are not, then use this information for regular runs. 63 Pipelines and Exceptions The problem is what to do if an instruction in the pipe caused an exception, keep in mind that there are more than one instruction in different stages of execution in the pipeline. Many situation cause exceptions, (interrupt, fault) such as I/O interrupt, operating system call, overflow or underflow, page fault, misalligned memory access, memory protection violation, undefined instructions,. 64
33 Exceptions (Characterization) Synchronous vs. Asynchronous: if the exception occurs in the same place each time the program is executed with the same set of input it is synchronous (failure is not). User requested vs. Coerced: If the user request them (debugging, ) User Maskable vs. nonmaskable: if the exception could be masked (not responded to) or not Within vs. between instructions: usually within instructions is harder to handle Resume, vs. terminate: Can we continue with the program or must we terminate 65 Stopping and Restarting The correct way to deal with exceptions is to stop the pipeline, deal with the exception, and restart execution, these steps are taken 1. Force a trap instruction into the pipeline on the next IF 2. Until the trap is taken (completed), turn off all writes for the faulting instructions and the following ones. Place no-op in all the latches 3. After the exception handling routine receives control, it first save the PC of the faulting instruction, in case of branch delay scheduling, we must save the addresses of all the instruction in the pipeline 66
34 Stopping and Restarting If the pipeline can be stopped such that all the instructions before the faulting one are completed, and all the instructions starting from the faulting one can restart from scratch, the pipeline is said to have precise exception. If the state of the machine changes before detecting the exception (FP op) then we must be able to retrieve the old values (done by the hardware). Some machines has two modes, one is precise interrupt for debugging and one without for fast execution. In precise mode, we may limit the amount of overlapping. 67 Exception in DLX Every state (except WB) can cause an exception, namely Page fault, undefined op-code, arithmetic exception,page fault. Consider the following case LW IF ID EX MEM WB ADD IF ID EX MEM WB LW may cause an exception in MEM, and ADD can cause an exception in IF, that will be detected earlier. Should not deal with ADD before LW 68
35 Exception in DLX The pipeline will not handle exception as they occur (out of order handling) The hardware posts the exceptions caused by any instruction in a status vector associated with that instruction, and turn off any control signal that might lead to writing. The exception status vector is carried along with the instruction Once the instruction is about to finish MEM, that status vector is examined, and exception is handled in order. 69 Instruction Set Complication Once the instruction is guaranteed to be completed, it is called committed In DLX, instruction is committed after the MEM stage, no change in the state of the machine before that. That is easy to handle, but on some machines, that might not be the case For example in autoincrement addressing, we must be able to back out of any changes. VAX and x86 string copying instruction uses the GPR as working registers, may restart from the middle of the instruction instead from the beginning 70
Pipeline Review. Review
Pipeline Review Review Covered in EECS2021 (was CSE2021) Just a reminder of pipeline and hazards If you need more details, review 2021 materials 1 The basic MIPS Processor Pipeline 2 Performance of pipelining
More informationInstruction Pipelining Review
Instruction Pipelining Review Instruction pipelining is CPU implementation technique where multiple operations on a number of instructions are overlapped. An instruction execution pipeline involves a number
More informationAppendix A. Overview
Appendix A Pipelining: Basic and Intermediate Concepts 1 Overview Basics of Pipelining Pipeline Hazards Pipeline Implementation Pipelining + Exceptions Pipeline to handle Multicycle Operations 2 1 Unpipelined
More informationOverview. Appendix A. Pipelining: Its Natural! Sequential Laundry 6 PM Midnight. Pipelined Laundry: Start work ASAP
Overview Appendix A Pipelining: Basic and Intermediate Concepts Basics of Pipelining Pipeline Hazards Pipeline Implementation Pipelining + Exceptions Pipeline to handle Multicycle Operations 1 2 Unpipelined
More informationSome material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier
Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier Science Cases that affect instruction execution semantics
More informationMinimizing Data hazard Stalls by Forwarding Data Hazard Classification Data Hazards Present in Current MIPS Pipeline
Instruction Pipelining Review: MIPS In-Order Single-Issue Integer Pipeline Performance of Pipelines with Stalls Pipeline Hazards Structural hazards Data hazards Minimizing Data hazard Stalls by Forwarding
More informationPipelining: Basic and Intermediate Concepts
Appendix A Pipelining: Basic and Intermediate Concepts 1 Overview Basics of fpipelining i Pipeline Hazards Pipeline Implementation Pipelining + Exceptions Pipeline to handle Multicycle Operations 2 Unpipelined
More informationPipeline Overview. Dr. Jiang Li. Adapted from the slides provided by the authors. Jiang Li, Ph.D. Department of Computer Science
Pipeline Overview Dr. Jiang Li Adapted from the slides provided by the authors Outline MIPS An ISA for Pipelining 5 stage pipelining Structural and Data Hazards Forwarding Branch Schemes Exceptions and
More informationComputer Architecture
Lecture 3: Pipelining Iakovos Mavroidis Computer Science Department University of Crete 1 Previous Lecture Measurements and metrics : Performance, Cost, Dependability, Power Guidelines and principles in
More informationCISC 662 Graduate Computer Architecture Lecture 6 - Hazards
CISC 662 Graduate Computer Architecture Lecture 6 - Hazards Michela Taufer http://www.cis.udel.edu/~taufer/teaching/cis662f07 Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer
More informationInstruction Pipelining
Instruction Pipelining Simplest form is a 3-stage linear pipeline New instruction fetched each clock cycle Instruction finished each clock cycle Maximal speedup = 3 achieved if and only if all pipe stages
More informationData Hazards Compiler Scheduling Pipeline scheduling or instruction scheduling: Compiler generates code to eliminate hazard
Data Hazards Compiler Scheduling Pipeline scheduling or instruction scheduling: Compiler generates code to eliminate hazard Consider: a = b + c; d = e - f; Assume loads have a latency of one clock cycle:
More informationSome material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier
Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier Science 6 PM 7 8 9 10 11 Midnight Time 30 40 20 30 40 20
More informationEI338: Computer Systems and Engineering (Computer Architecture & Operating Systems)
EI338: Computer Systems and Engineering (Computer Architecture & Operating Systems) Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building
More informationWhat is Pipelining? Time per instruction on unpipelined machine Number of pipe stages
What is Pipelining? Is a key implementation techniques used to make fast CPUs Is an implementation techniques whereby multiple instructions are overlapped in execution It takes advantage of parallelism
More informationModern Computer Architecture
Modern Computer Architecture Lecture2 Pipelining: Basic and Intermediate Concepts Hongbin Sun 国家集成电路人才培养基地 Xi an Jiaotong University Pipelining: Its Natural! Laundry Example Ann, Brian, Cathy, Dave each
More informationPipelining: Hazards Ver. Jan 14, 2014
POLITECNICO DI MILANO Parallelism in wonderland: are you ready to see how deep the rabbit hole goes? Pipelining: Hazards Ver. Jan 14, 2014 Marco D. Santambrogio: marco.santambrogio@polimi.it Simone Campanoni:
More informationLecture 3. Pipelining. Dr. Soner Onder CS 4431 Michigan Technological University 9/23/2009 1
Lecture 3 Pipelining Dr. Soner Onder CS 4431 Michigan Technological University 9/23/2009 1 A "Typical" RISC ISA 32-bit fixed format instruction (3 formats) 32 32-bit GPR (R0 contains zero, DP take pair)
More informationInstruction Pipelining
Instruction Pipelining Simplest form is a 3-stage linear pipeline New instruction fetched each clock cycle Instruction finished each clock cycle Maximal speedup = 3 achieved if and only if all pipe stages
More informationCPE Computer Architecture. Appendix A: Pipelining: Basic and Intermediate Concepts
CPE 110408443 Computer Architecture Appendix A: Pipelining: Basic and Intermediate Concepts Sa ed R. Abed [Computer Engineering Department, Hashemite University] Outline Basic concept of Pipelining The
More informationAppendix C. Instructor: Josep Torrellas CS433. Copyright Josep Torrellas 1999, 2001, 2002,
Appendix C Instructor: Josep Torrellas CS433 Copyright Josep Torrellas 1999, 2001, 2002, 2013 1 Pipelining Multiple instructions are overlapped in execution Each is in a different stage Each stage is called
More informationOutline. Pipelining basics The Basic Pipeline for DLX & MIPS Pipeline hazards. Handling exceptions Multi-cycle operations
Pipelining 1 Outline Pipelining basics The Basic Pipeline for DLX & MIPS Pipeline hazards Structural Hazards Data Hazards Control Hazards Handling exceptions Multi-cycle operations 2 Pipelining basics
More informationCOSC 6385 Computer Architecture - Pipelining
COSC 6385 Computer Architecture - Pipelining Fall 2006 Some of the slides are based on a lecture by David Culler, Instruction Set Architecture Relevant features for distinguishing ISA s Internal storage
More informationPage 1. Pipelining: Its Natural! Chapter 3. Pipelining. Pipelined Laundry Start work ASAP. Sequential Laundry A B C D. 6 PM Midnight
Pipelining: Its Natural! Chapter 3 Pipelining Laundry Example Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer takes 30 minutes A B C D Dryer takes 40 minutes Folder
More informationInstruction Level Parallelism. ILP, Loop level Parallelism Dependences, Hazards Speculation, Branch prediction
Instruction Level Parallelism ILP, Loop level Parallelism Dependences, Hazards Speculation, Branch prediction Basic Block A straight line code sequence with no branches in except to the entry and no branches
More informationPipelining. Maurizio Palesi
* Pipelining * Adapted from David A. Patterson s CS252 lecture slides, http://www.cs.berkeley/~pattrsn/252s98/index.html Copyright 1998 UCB 1 References John L. Hennessy and David A. Patterson, Computer
More informationWhat is Pipelining? RISC remainder (our assumptions)
What is Pipelining? Is a key implementation techniques used to make fast CPUs Is an implementation techniques whereby multiple instructions are overlapped in execution It takes advantage of parallelism
More informationAdvanced Parallel Architecture Lessons 5 and 6. Annalisa Massini /2017
Advanced Parallel Architecture Lessons 5 and 6 Annalisa Massini - Pipelining Hennessy, Patterson Computer architecture A quantitive approach Appendix C Sections C.1, C.2 Pipelining Pipelining is an implementation
More informationAppendix C: Pipelining: Basic and Intermediate Concepts
Appendix C: Pipelining: Basic and Intermediate Concepts Key ideas and simple pipeline (Section C.1) Hazards (Sections C.2 and C.3) Structural hazards Data hazards Control hazards Exceptions (Section C.4)
More informationEITF20: Computer Architecture Part2.2.1: Pipeline-1
EITF20: Computer Architecture Part2.2.1: Pipeline-1 Liang Liu liang.liu@eit.lth.se 1 Outline Reiteration Pipelining Harzards Structural hazards Data hazards Control hazards Implementation issues Multi-cycle
More informationEITF20: Computer Architecture Part2.2.1: Pipeline-1
EITF20: Computer Architecture Part2.2.1: Pipeline-1 Liang Liu liang.liu@eit.lth.se 1 Outline Reiteration Pipelining Harzards Structural hazards Data hazards Control hazards Implementation issues Multi-cycle
More informationAppendix C. Abdullah Muzahid CS 5513
Appendix C Abdullah Muzahid CS 5513 1 A "Typical" RISC ISA 32-bit fixed format instruction (3 formats) 32 32-bit GPR (R0 contains zero) Single address mode for load/store: base + displacement no indirection
More information第三章 Instruction-Level Parallelism and Its Dynamic Exploitation. 陈文智 浙江大学计算机学院 2014 年 10 月
第三章 Instruction-Level Parallelism and Its Dynamic Exploitation 陈文智 chenwz@zju.edu.cn 浙江大学计算机学院 2014 年 10 月 1 3.3 The Major Hurdle of Pipelining Pipeline Hazards 本科回顾 ------- Appendix A.2 3.3.1 Taxonomy
More informationMIPS An ISA for Pipelining
Pipelining: Basic and Intermediate Concepts Slides by: Muhamed Mudawar CS 282 KAUST Spring 2010 Outline: MIPS An ISA for Pipelining 5 stage pipelining i Structural Hazards Data Hazards & Forwarding Branch
More informationEITF20: Computer Architecture Part2.2.1: Pipeline-1
EITF20: Computer Architecture Part2.2.1: Pipeline-1 Liang Liu liang.liu@eit.lth.se 1 Outline Reiteration Pipelining Harzards Structural hazards Data hazards Control hazards Implementation issues Multi-cycle
More informationInstruction Level Parallelism. Appendix C and Chapter 3, HP5e
Instruction Level Parallelism Appendix C and Chapter 3, HP5e Outline Pipelining, Hazards Branch prediction Static and Dynamic Scheduling Speculation Compiler techniques, VLIW Limits of ILP. Implementation
More informationPipelining! Advanced Topics on Heterogeneous System Architectures. Politecnico di Milano! Seminar DEIB! 30 November, 2017!
Advanced Topics on Heterogeneous System Architectures Pipelining! Politecnico di Milano! Seminar Room @ DEIB! 30 November, 2017! Antonio R. Miele! Marco D. Santambrogio! Politecnico di Milano! 2 Outline!
More informationECEC 355: Pipelining
ECEC 355: Pipelining November 8, 2007 What is Pipelining Pipelining is an implementation technique whereby multiple instructions are overlapped in execution. A pipeline is similar in concept to an assembly
More informationLecture 05: Pipelining: Basic/ Intermediate Concepts and Implementation
Lecture 05: Pipelining: Basic/ Intermediate Concepts and Implementation CSE 564 Computer Architecture Summer 2017 Department of Computer Science and Engineering Yonghong Yan yan@oakland.edu www.secs.oakland.edu/~yan
More informationCMCS Mohamed Younis CMCS 611, Advanced Computer Architecture 1
CMCS 611-101 Advanced Computer Architecture Lecture 8 Control Hazards and Exception Handling September 30, 2009 www.csee.umbc.edu/~younis/cmsc611/cmsc611.htm Mohamed Younis CMCS 611, Advanced Computer
More informationPipelining. Each step does a small fraction of the job All steps ideally operate concurrently
Pipelining Computational assembly line Each step does a small fraction of the job All steps ideally operate concurrently A form of vertical concurrency Stage/segment - responsible for 1 step 1 machine
More informationDLX Unpipelined Implementation
LECTURE - 06 DLX Unpipelined Implementation Five cycles: IF, ID, EX, MEM, WB Branch and store instructions: 4 cycles only What is the CPI? F branch 0.12, F store 0.05 CPI0.1740.83550.174.83 Further reduction
More informationHY425 Lecture 05: Branch Prediction
HY425 Lecture 05: Branch Prediction Dimitrios S. Nikolopoulos University of Crete and FORTH-ICS October 19, 2011 Dimitrios S. Nikolopoulos HY425 Lecture 05: Branch Prediction 1 / 45 Exploiting ILP in hardware
More informationPipelining concepts The DLX architecture A simple DLX pipeline Pipeline Hazards and Solution to overcome
Thoai Nam Pipelining concepts The DLX architecture A simple DLX pipeline Pipeline Hazards and Solution to overcome Reference: Computer Architecture: A Quantitative Approach, John L Hennessy & David a Patterson,
More informationThere are different characteristics for exceptions. They are as follows:
e-pg PATHSHALA- Computer Science Computer Architecture Module 15 Exception handling and floating point pipelines The objectives of this module are to discuss about exceptions and look at how the MIPS architecture
More informationC.1 Introduction. What Is Pipelining? C-2 Appendix C Pipelining: Basic and Intermediate Concepts
C-2 Appendix C Pipelining: Basic and Intermediate Concepts C.1 Introduction Many readers of this text will have covered the basics of pipelining in another text (such as our more basic text Computer Organization
More informationLecture 2: Processor and Pipelining 1
The Simple BIG Picture! Chapter 3 Additional Slides The Processor and Pipelining CENG 6332 2 Datapath vs Control Datapath signals Control Points Controller Datapath: Storage, FU, interconnect sufficient
More informationCS4617 Computer Architecture
1/47 CS4617 Computer Architecture Lectures 21 22: Pipelining Reference: Appendix C, Hennessy & Patterson Dr J Vaughan November 2013 MIPS data path implementation (unpipelined) Figure C.21 The implementation
More informationExecution/Effective address
Pipelined RC 69 Pipelined RC Instruction Fetch IR mem[pc] NPC PC+4 Instruction Decode/Operands fetch A Regs[rs]; B regs[rt]; Imm sign extended immediate field Execution/Effective address Memory Ref ALUOutput
More informationComputer System. Agenda
Computer System Hiroaki Kobayashi 7/6/2011 Ver. 07062011 7/6/2011 Computer Science 1 Agenda Basic model of modern computer systems Von Neumann Model Stored-program instructions and data are stored on memory
More informationPipelining concepts The DLX architecture A simple DLX pipeline Pipeline Hazards and Solution to overcome
Pipeline Thoai Nam Outline Pipelining concepts The DLX architecture A simple DLX pipeline Pipeline Hazards and Solution to overcome Reference: Computer Architecture: A Quantitative Approach, John L Hennessy
More informationCSE 533: Advanced Computer Architectures. Pipelining. Instructor: Gürhan Küçük. Yeditepe University
CSE 533: Advanced Computer Architectures Pipelining Instructor: Gürhan Küçük Yeditepe University Lecture notes based on notes by Mark D. Hill and John P. Shen Updated by Mikko Lipasti Pipelining Forecast
More informationAdvanced Computer Architecture Pipelining
Advanced Computer Architecture Pipelining Dr. Shadrokh Samavi Some slides are from the instructors resources which accompany the 6 th and previous editions of the textbook. Some slides are from David Patterson,
More informationThe Processor Pipeline. Chapter 4, Patterson and Hennessy, 4ed. Section 5.3, 5.4: J P Hayes.
The Processor Pipeline Chapter 4, Patterson and Hennessy, 4ed. Section 5.3, 5.4: J P Hayes. Pipeline A Basic MIPS Implementation Memory-reference instructions Load Word (lw) and Store Word (sw) ALU instructions
More informationECE 486/586. Computer Architecture. Lecture # 12
ECE 486/586 Computer Architecture Lecture # 12 Spring 2015 Portland State University Lecture Topics Pipelining Control Hazards Delayed branch Branch stall impact Implementing the pipeline Detecting hazards
More informationComputer System. Hiroaki Kobayashi 6/16/2010. Ver /16/2010 Computer Science 1
Computer System Hiroaki Kobayashi 6/16/2010 6/16/2010 Computer Science 1 Ver. 1.1 Agenda Basic model of modern computer systems Von Neumann Model Stored-program instructions and data are stored on memory
More informationECE473 Computer Architecture and Organization. Pipeline: Control Hazard
Computer Architecture and Organization Pipeline: Control Hazard Lecturer: Prof. Yifeng Zhu Fall, 2015 Portions of these slides are derived from: Dave Patterson UCB Lec 15.1 Pipelining Outline Introduction
More informationLecture 7: Pipelining Contd. More pipelining complications: Interrupts and Exceptions
Lecture 7: Pipelining Contd. Kunle Olukotun Gates 302 kunle@ogun.stanford.edu http://www-leland.stanford.edu/class/ee282h/ 1 More pipelining complications: Interrupts and Exceptions Hard to handle in pipelined
More informationPipelining. Principles of pipelining. Simple pipelining. Structural Hazards. Data Hazards. Control Hazards. Interrupts. Multicycle operations
Principles of pipelining Pipelining Simple pipelining Structural Hazards Data Hazards Control Hazards Interrupts Multicycle operations Pipeline clocking ECE D52 Lecture Notes: Chapter 3 1 Sequential Execution
More informationComputer Architecture Spring 2016
Computer Architecture Spring 2016 Lecture 02: Introduction II Shuai Wang Department of Computer Science and Technology Nanjing University Pipeline Hazards Major hurdle to pipelining: hazards prevent the
More informationChapter 3. Pipelining. EE511 In-Cheol Park, KAIST
Chapter 3. Pipelining EE511 In-Cheol Park, KAIST Terminology Pipeline stage Throughput Pipeline register Ideal speedup Assume The stages are perfectly balanced No overhead on pipeline registers Speedup
More informationProcessor Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Processor Architecture Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Moore s Law Gordon Moore @ Intel (1965) 2 Computer Architecture Trends (1)
More informationmywbut.com Pipelining
Pipelining 1 What Is Pipelining? Pipelining is an implementation technique whereby multiple instructions are overlapped in execution. Today, pipelining is the key implementation technique used to make
More informationCSE 502 Graduate Computer Architecture. Lec 3-5 Performance + Instruction Pipelining Review
CSE 502 Graduate Computer Architecture Lec 3-5 Performance + Instruction Pipelining Review Larry Wittie Computer Science, StonyBrook University http://www.cs.sunysb.edu/~cse502 and ~lw Slides adapted from
More informationDepartment of Computer and IT Engineering University of Kurdistan. Computer Architecture Pipelining. By: Dr. Alireza Abdollahpouri
Department of Computer and IT Engineering University of Kurdistan Computer Architecture Pipelining By: Dr. Alireza Abdollahpouri Pipelined MIPS processor Any instruction set can be implemented in many
More informationAdvanced Computer Architecture
Advanced Computer Architecture Chapter 1 Introduction into the Sequential and Pipeline Instruction Execution Martin Milata What is a Processors Architecture Instruction Set Architecture (ISA) Describes
More informationInstr. execution impl. view
Pipelining Sangyeun Cho Computer Science Department Instr. execution impl. view Single (long) cycle implementation Multi-cycle implementation Pipelined implementation Processing an instruction Fetch instruction
More informationLecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1
Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1 Introduction Chapter 4.1 Chapter 4.2 Review: MIPS (RISC) Design Principles Simplicity favors regularity fixed size instructions small number
More informationPredict Not Taken. Revisiting Branch Hazard Solutions. Filling the delay slot (e.g., in the compiler) Delayed Branch
branch taken Revisiting Branch Hazard Solutions Stall Predict Not Taken Predict Taken Branch Delay Slot Branch I+1 I+2 I+3 Predict Not Taken branch not taken Branch I+1 IF (bubble) (bubble) (bubble) (bubble)
More informationCMSC 411 Computer Systems Architecture Lecture 6 Basic Pipelining 3. Complications With Long Instructions
CMSC 411 Computer Systems Architecture Lecture 6 Basic Pipelining 3 Long Instructions & MIPS Case Study Complications With Long Instructions So far, all MIPS instructions take 5 cycles But haven't talked
More informationSpeeding Up DLX Computer Architecture Hadassah College Spring 2018 Speeding Up DLX Dr. Martin Land
Speeding Up DLX 1 DLX Execution Stages Version 1 Clock Cycle 1 I 1 enters Instruction Fetch (IF) Clock Cycle2 I 1 moves to Instruction Decode (ID) Instruction Fetch (IF) holds state fixed Clock Cycle3
More informationProcessor Architecture
Processor Architecture Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationChapter 4 The Processor 1. Chapter 4A. The Processor
Chapter 4 The Processor 1 Chapter 4A The Processor Chapter 4 The Processor 2 Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware
More informationAdvanced Computer Architecture
ECE 563 Advanced Computer Architecture Fall 2010 Lecture 2: Review of Metrics and Pipelining 563 L02.1 Fall 2010 Review from Last Time Computer Architecture >> instruction sets Computer Architecture skill
More informationLECTURE 3: THE PROCESSOR
LECTURE 3: THE PROCESSOR Abridged version of Patterson & Hennessy (2013):Ch.4 Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU
More informationLecture 9. Pipeline Hazards. Christos Kozyrakis Stanford University
Lecture 9 Pipeline Hazards Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee18b 1 Announcements PA-1 is due today Electronic submission Lab2 is due on Tuesday 2/13 th Quiz1 grades will
More informationCAD for VLSI 2 Pro ject - Superscalar Processor Implementation
CAD for VLSI 2 Pro ject - Superscalar Processor Implementation 1 Superscalar Processor Ob jective: The main objective is to implement a superscalar pipelined processor using Verilog HDL. This project may
More informationCSE 502 Graduate Computer Architecture. Lec 3-5 Performance + Instruction Pipelining Review
CSE 502 Graduate Computer Architecture Lec 3-5 Performance + Instruction Pipelining Review Larry Wittie Computer Science, StonyBrook University http://www.cs.sunysb.edu/~cse502 and ~lw Slides adapted from
More informationBasic Pipelining Concepts
Basic ipelining oncepts Appendix A (recommended reading, not everything will be covered today) Basic pipelining ipeline hazards Data hazards ontrol hazards Structural hazards Multicycle operations Execution
More information14:332:331 Pipelined Datapath
14:332:331 Pipelined Datapath I n s t r. O r d e r Inst 0 Inst 1 Inst 2 Inst 3 Inst 4 Single Cycle Disadvantages & Advantages Uses the clock cycle inefficiently the clock cycle must be timed to accommodate
More informationPipelining Analogy. Pipelined laundry: overlapping execution. Parallelism improves performance. Four loads: Non-stop: Speedup = 8/3.5 = 2.3.
Pipelining Analogy Pipelined laundry: overlapping execution Parallelism improves performance Four loads: Speedup = 8/3.5 = 2.3 Non-stop: Speedup =2n/05n+15 2n/0.5n 1.5 4 = number of stages 4.5 An Overview
More information1 Hazards COMP2611 Fall 2015 Pipelined Processor
1 Hazards Dependences in Programs 2 Data dependence Example: lw $1, 200($2) add $3, $4, $1 add can t do ID (i.e., read register $1) until lw updates $1 Control dependence Example: bne $1, $2, target add
More informationAnti-Inspiration. It s true hard work never killed anybody, but I figure, why take the chance? Ronald Reagan, US President
Anti-Inspiration From pg. A-78 H&P It s true hard work never killed anybody, but I figure, why take the chance? Ronald Reagan, US President Hard work. Well, that s all right for people who don t know how
More informationCSE 502 Graduate Computer Architecture. Lec 4-6 Performance + Instruction Pipelining Review
CSE 502 Graduate Computer Architecture Lec 4-6 Performance + Instruction Pipelining Review Larry Wittie Computer Science, StonyBrook University http://www.cs.sunysb.edu/~cse502 and ~lw Slides adapted from
More information3/12/2014. Single Cycle (Review) CSE 2021: Computer Organization. Single Cycle with Jump. Multi-Cycle Implementation. Why Multi-Cycle?
CSE 2021: Computer Organization Single Cycle (Review) Lecture-10b CPU Design : Pipelining-1 Overview, Datapath and control Shakil M. Khan 2 Single Cycle with Jump Multi-Cycle Implementation Instruction:
More informationMIPS Pipelining. Computer Organization Architectures for Embedded Computing. Wednesday 8 October 14
MIPS Pipelining Computer Organization Architectures for Embedded Computing Wednesday 8 October 14 Many slides adapted from: Computer Organization and Design, Patterson & Hennessy 4th Edition, 2011, MK
More informationCS422 Computer Architecture
CS422 Computer Architecture Spring 2004 Lecture 07, 08 Jan 2004 Bhaskaran Raman Department of CSE IIT Kanpur http://web.cse.iitk.ac.in/~cs422/index.html Recall: Data Hazards Have to be detected dynamically,
More informationPipelining. Principles of pipelining. Simple pipelining. Structural Hazards. Data Hazards. Control Hazards. Interrupts. Multicycle operations
Principles of pipelining Pipelining Simple pipelining Structural Hazards Data Hazards Control Hazards Interrupts Multicycle operations Pipeline clocking ECE D52 Lecture Notes: Chapter 3 1 Sequential Execution
More informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN 5 Edition th The Hardware/Software Interface Chapter 4 The Processor 4.1 Introduction Introduction CPU performance factors Instruction count CPI and Cycle time Determined
More informationFull Datapath. Chapter 4 The Processor 2
Pipelining Full Datapath Chapter 4 The Processor 2 Datapath With Control Chapter 4 The Processor 3 Performance Issues Longest delay determines clock period Critical path: load instruction Instruction memory
More informationFull Datapath. Chapter 4 The Processor 2
Pipelining Full Datapath Chapter 4 The Processor 2 Datapath With Control Chapter 4 The Processor 3 Performance Issues Longest delay determines clock period Critical path: load instruction Instruction memory
More informationCISC 662 Graduate Computer Architecture Lecture 6 - Hazards
CISC 662 Gaduate Compute Achitectue Lectue 6 - Hazads Michela Taufe http://www.cis.udel.edu/~taufe/teaching/cis662f07 Powepoint Lectue Notes fom John Hennessy and David Patteson s: Compute Achitectue,
More information(Basic) Processor Pipeline
(Basic) Processor Pipeline Nima Honarmand Generic Instruction Life Cycle Logical steps in processing an instruction: Instruction Fetch (IF_STEP) Instruction Decode (ID_STEP) Operand Fetch (OF_STEP) Might
More informationECE 505 Computer Architecture
ECE 505 Computer Architecture Pipelining 2 Berk Sunar and Thomas Eisenbarth Review 5 stages of RISC IF ID EX MEM WB Ideal speedup of pipelining = Pipeline depth (N) Practically Implementation problems
More informationPipelining. CSC Friday, November 6, 2015
Pipelining CSC 211.01 Friday, November 6, 2015 Performance Issues Longest delay determines clock period Critical path: load instruction Instruction memory register file ALU data memory register file Not
More informationSuggested Readings! Recap: Pipelining improves throughput! Processor comparison! Lecture 17" Short Pipelining Review! ! Readings!
1! 2! Suggested Readings!! Readings!! H&P: Chapter 4.5-4.7!! (Over the next 3-4 lectures)! Lecture 17" Short Pipelining Review! 3! Processor components! Multicore processors and programming! Recap: Pipelining
More informationECSE 425 Lecture 6: Pipelining
ECSE 425 Lecture 6: Pipelining H&P, Appendix A Vu, Meyer Textbook figures 2007 Elsevier Science Last Time Processor Performance EquaQon System performance Benchmarks 2 Today Pipelining Basics RISC InstrucQon
More informationPipeline Hazards. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Pipeline Hazards Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Hazards What are hazards? Situations that prevent starting the next instruction
More informationComputer and Information Sciences College / Computer Science Department Enhancing Performance with Pipelining
Computer and Information Sciences College / Computer Science Department Enhancing Performance with Pipelining Single-Cycle Design Problems Assuming fixed-period clock every instruction datapath uses one
More informationWhat do we have so far? Multi-Cycle Datapath (Textbook Version)
What do we have so far? ulti-cycle Datapath (Textbook Version) CPI: R-Type = 4, Load = 5, Store 4, Branch = 3 Only one instruction being processed in datapath How to lower CPI further? #1 Lec # 8 Summer2001
More information