Samira Khan University of Virginia Feb 9, 2016 COMPUTER ARCHITECTURE CS 6354 Precise Exception The content and concept of this course are adapted from.

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Speeding it up Part 3: Out-Of-Order and SuperScalar execution dr.ir. A.C. Verschueren.
Advertisements

1 Lecture 11: Modern Superscalar Processor Models Generic Superscalar Models, Issue Queue-based Pipeline, Multiple-Issue Design.
CS6290 Speculation Recovery. Loose Ends Up to now: –Techniques for handling register dependencies Register renaming for WAR, WAW Tomasulo’s algorithm.
Computer Structure 2014 – Out-Of-Order Execution 1 Computer Structure Out-Of-Order Execution Lihu Rappoport and Adi Yoaz.
1 Lecture: Out-of-order Processors Topics: out-of-order implementations with issue queue, register renaming, and reorder buffer, timing, LSQ.
Computer Organization and Architecture (AT70.01) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: Based.
Out-of-Order Machine State Instruction Sequence: Inorder State: Look-ahead State: Architectural State: R3  A R7  B R8  C R7  D R4  E R3  F R8  G.
THE MIPS R10000 SUPERSCALAR MICROPROCESSOR Kenneth C. Yeager IEEE Micro in April 1996 Presented by Nitin Gupta.
Spring 2003CSE P5481 Reorder Buffer Implementation (Pentium Pro) Hardware data structures retirement register file (RRF) (~ IBM 360/91 physical registers)
CS 211: Computer Architecture Lecture 5 Instruction Level Parallelism and Its Dynamic Exploitation Instructor: M. Lancaster Corresponding to Hennessey.
© A. Moshovos (ECE, Toronto) ECE1773 – Spring 2002 ILP, cont. Maintaining Sequential Appearance –Precise Interrupts –RUU approach to OoO Scheduling.
February 28, 2012CS152, Spring 2012 CS 152 Computer Architecture and Engineering Lecture 11 - Out-of-Order Issue, Register Renaming, & Branch Prediction.
Computer Architecture 2011 – Out-Of-Order Execution 1 Computer Architecture Out-Of-Order Execution Lihu Rappoport and Adi Yoaz.
Mult. Issue CSE 471 Autumn 011 Multiple Issue Alternatives Superscalar (hardware detects conflicts) –Statically scheduled (in order dispatch and hence.
1 Lecture 7: Out-of-Order Processors Today: out-of-order pipeline, memory disambiguation, basic branch prediction (Sections 3.4, 3.5, 3.7)
Computer Architecture 2011 – out-of-order execution (lec 7) 1 Computer Architecture Out-of-order execution By Dan Tsafrir, 11/4/2011 Presentation based.
Trace Caches J. Nelson Amaral. Difficulties to Instruction Fetching Where to fetch the next instruction from? – Use branch prediction Sometimes there.
March 9, 2011CS152, Spring 2011 CS 152 Computer Architecture and Engineering Lecture 12 - Advanced Out-of-Order Superscalars Krste Asanovic Electrical.
1 Lecture 8: Branch Prediction, Dynamic ILP Topics: static speculation and branch prediction (Sections )
1 Lecture 9: Dynamic ILP Topics: out-of-order processors (Sections )
Computer Architecture 2010 – Out-Of-Order Execution 1 Computer Architecture Out-Of-Order Execution Lihu Rappoport and Adi Yoaz.
Intel Architecture. Changes in architecture Software architecture: –Front end (Feature changes such as adding more graphics, changing the background colors,
Ch2. Instruction-Level Parallelism & Its Exploitation 2. Dynamic Scheduling ECE562/468 Advanced Computer Architecture Prof. Honggang Wang ECE Department.
Computer Architecture Computer Architecture Superscalar Processors Ola Flygt Växjö University +46.
Implementing Precise Interrupts in Pipelined Processors James E. Smith Andrew R.Pleszkun Presented By: Ravikumar Source:
1 Out-Of-Order Execution (part I) Alexander Titov 14 March 2015.
© Wen-mei Hwu and S. J. Patel, 2005 ECE 412, University of Illinois Lecture Instruction Execution: Dynamic Scheduling.
Computer Architecture: Out-of-Order Execution
Spring 2003CSE P5481 Precise Interrupts Precise interrupts preserve the model that instructions execute in program-generated order, one at a time If an.
1 Lecture 7: Speculative Execution and Recovery Branch prediction and speculative execution, precise interrupt, reorder buffer.
Implementing Precise Interrupts in Pipelined Processors James E. Smith Andrew R.Pleszkun Presented By: Shrikant G.
Computer Architecture: Out-of-Order Execution II
OOO Pipelines - II Smruti R. Sarangi IIT Delhi 1.
1 Lecture: Out-of-order Processors Topics: a basic out-of-order processor with issue queue, register renaming, and reorder buffer.
Out-of-order execution Lihu Rappoport 11/ MAMAS – Computer Architecture Out-Of-Order Execution Dr. Lihu Rappoport.
15-740/ Computer Architecture Lecture 12: Issues in OoO Execution Prof. Onur Mutlu Carnegie Mellon University Fall 2011, 10/7/2011.
1 Lecture 10: Memory Dependence Detection and Speculation Memory correctness, dynamic memory disambiguation, speculative disambiguation, Alpha Example.
CS203 – Advanced Computer Architecture ILP and Speculation.
15-740/ Computer Architecture Lecture 7: Out-of-Order Execution Prof. Onur Mutlu Carnegie Mellon University.
Lecture: Out-of-order Processors
CS 352H: Computer Systems Architecture
Dynamic Scheduling Why go out of style?
Precise Exceptions and Out-of-Order Execution
Computer Architecture Lecture 14: Out-of-Order Execution
Design of Digital Circuits Lecture 18: Out-of-Order Execution
Smruti R. Sarangi IIT Delhi
PowerPC 604 Superscalar Microprocessor
CIS-550 Advanced Computer Architecture Lecture 10: Precise Exceptions
Lecture: Out-of-order Processors
Prof. Onur Mutlu Carnegie Mellon University Spring 2014, 2/21/2014
Sequential Execution Semantics
Lecture 6: Advanced Pipelines
Superscalar Pipelines Part 2
Lecture 8: ILP and Speculation Contd. Chapter 2, Sections 2. 6, 2
Smruti R. Sarangi IIT Delhi
Lecture 8: Dynamic ILP Topics: out-of-order processors
Adapted from the slides of Prof
15-740/ Computer Architecture Lecture 5: Precise Exceptions
Lecture 7: Dynamic Scheduling with Tomasulo Algorithm (Section 2.4)
Adapted from the slides of Prof
Prof. Onur Mutlu Carnegie Mellon University Fall 2011, 9/30/2011
15-740/ Computer Architecture Lecture 10: Out-of-Order Execution
Prof. Onur Mutlu Carnegie Mellon University
Lecture 9: Dynamic ILP Topics: out-of-order processors
Conceptual execution on a processor which exploits ILP
Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 2/15/2013
Design of Digital Circuits Lecture 15: Pipelining Issues
Prof. Onur Mutlu Carnegie Mellon University Spring 2015, 2/11/2015
Design of Digital Circuits Lecture 16: Out-of-Order Execution
ECE 721 Modern Superscalar Microarchitecture
Presentation transcript:

Samira Khan University of Virginia Feb 9, 2016 COMPUTER ARCHITECTURE CS 6354 Precise Exception The content and concept of this course are adapted from CMU ECE 740

AGENDA Review from last lecture – Pipelining – Issues in Pipelining: Control & Data Dependence – State Maintenance and Recovery Continue State Maintenance and Recovery 2

ISSUES IN PIPELINING: MULTI-CYCLE EXECUTE Instructions can take different number of cycles in EXECUTE stage – Integer ADD versus FP Multiply – What is wrong with this picture? What if FMUL incurs an exception? Sequential semantics of the ISA NOT preserved! FDEWFDEWEEEEEEE FMUL R4  R1, R2 ADD R3  R1, R2 FDEWFDEWFDEWFDEW FMUL R2  R5, R6 ADD R4  R5, R6 FDEWEEEEEEE 3

SOLUTIONS Reorder buffer History buffer Future register file Checkpointing Reading – Smith and Plezskun, “Implementing Precise Interrupts in Pipelined Processors” IEEE Trans on Computers 1988 and ISCA – Hwu and Patt, “Checkpoint Repair for Out-of-order Execution Machines,” ISCA

SOLUTION I: REORDER BUFFER (ROB) Idea: Complete instructions out-of-order, but reorder them before making results visible to architectural state When instruction is decoded it reserves an entry in the ROB When instruction completes, it writes result into ROB entry When instruction oldest in ROB and it has completed, its result moved to reg. file or memory Register File Func Unit Reorder Buffer Instruction Cache 5

REORDER BUFFER: INDEPENDENT OPERATIONS Results first written to ROB, then to register file at commit time What if a later operation needs a value in the reorder buffer? – Read reorder buffer in parallel with the register file. How? FDEW FDEREEEEEEE FDEW FDER FDER FDER FDEREEEEEEE W R R W W W W 6

REORDER BUFFER: HOW TO ACCESS? A register value can be in the register file, reorder buffer, (or bypass paths) Register File Func Unit Reorder Buffer Instruction Cache bypass path Content Addressable Memory (searched with register ID) 7

SIMPLIFYING REORDER BUFFER ACCESS Idea: Use indirection Access register file first – If register not valid, register file stores the ID of the reorder buffer entry that contains (or will contain) the value of the register – Mapping of the register to a ROB entry Access reorder buffer next 8

REGISTER RENAMING WITH A REORDER BUFFER Output and anti dependencies are not true dependencies – WHY? The same register refers to values that have nothing to do with each other – They exist due to lack of register ID’s (i.e. names) in the ISA The register ID is renamed to the reorder buffer entry that will hold the register’s value – Register ID  ROB entry ID – Architectural register ID  Physical register ID – After renaming, ROB entry ID used to refer to the register This eliminates anti- and output- dependencies – Gives the illusion that there are a large number of registers 9

REORDER BUFFER IN INTEL PENTIUM III Boggs et al., “The Microarchitecture of the Pentium 4 Processor,” Intel Technology Journal,

REORDER BUFFER PROS AND CONS Pro – Conceptually simple for supporting precise exceptions Con – Reorder buffer needs to be accessed to get the results that are yet to be written to the register file CAM or indirection  increased latency and complexity 11

SOLUTION II: HISTORY BUFFER (HB) Idea: Update architectural state when instruction completes, but UNDO UPDATES when an exception occurs When instruction is decoded, it reserves an HB entry When the instruction completes, it stores the old value of its destination in the HB When instruction is oldest and no exceptions/interrupts, the HB entry discarded When instruction is oldest and an exception needs to be handled, old values in the HB are written back into the architectural state from tail to head 12

HISTORY BUFFER Advantage: – Register file contains up-to-date values. History buffer access not on critical path Disadvantage: – Need to read the old value of the destination – Need to unwind the history buffer upon an exception  increased exception/interrupt handling latency Register File Func Unit History Buffer Instruction Cache Used only on exceptions 13

COMPARISON OF TWO APPROACHES Reorder buffer – Pessimistic register file update – Update only with non-speculative values (in program order) – Leads to complexity/delay in accessing the new values History buffer – Optimistic register file update – Update immediately, but log the old value for recovery – Leads to complexity/delay in logging old values Can we get the best of both worlds? – Idea: Have both types of register files 14

SOLUTION III: FUTURE FILE (FF) Idea: Keep two register files: – Arch reg file: Updated in program order for precise exceptions – Future reg file: Updated as soon as an instruction completes (if the instruction is the youngest one to write to a register) Future file is used for fast access to latest register values (speculative state) – Frontend register file Architectural file is used for recovery on exceptions (architectural state) – Backend register file 15

FUTURE FILE Advantage – No sequential scanning of history buffer: Upon exception, simply copy arch file to future file – No need for extra read of destination value Disadvantage – Multiple register files + reorder buffer Future File Func Unit Arch. File Instruction Cache Used only on exceptions ROB V Data or Tag 16

IN-ORDER PIPELINE WITH FUTURE FILE AND REORDER BUFFER Decode (D): Access future file, allocate entry in ROB, check if instruction can execute, if so dispatch instruction Execute (E): Instructions can complete out-of-order Completion (R): Write result to reorder buffer and future file Retirement/Commit (W): Check for exceptions; if none, write result to architectural register file or memory; else, flush pipeline, copy architectural file to future file, and start from exception handler In-order dispatch/execution, out-of-order completion, in-order retirement FD E W EEEEEEEE E EEE EEEEEEEE... Integer add Integer mul FP mul Load/store R 17

CAN WE REDUCE THE OVERHEAD OF TWO REGISTER FILES? Idea: Use indirection, i.e., pointers to data in frontend and retirement – Have a single storage that stores register data values – Keep two register maps (speculative and architectural); also called register alias tables (RATs) Future map used for fast access to latest register values (speculative state) – Frontend register map Architectural map is used for state recovery on exceptions (architectural state) – Backend register map 18

FUTURE MAP IN INTEL PENTIUM 4 Boggs et al., “The Microarchitecture of the Pentium 4 Processor,” Intel Technology Journal, Many modern processors are similar: -MIPS R10K -Alpha

REORDER BUFFER VS. FUTURE MAP COMPARISON 20

BEFORE WE GET TO CHECKPOINTING… Let’s cover what happens on exceptions And branch mispredictions 21

HANDLING EXCEPTIONS IN PIPELINING When the oldest instruction ready-to-be-retired is detected to have caused an exception, the control logic – Recovers architectural state (register file, IP, and memory) – Flushes all younger instructions in the pipeline – Saves IP and registers (as specified by the ISA) – Redirects the fetch engine to the exception handling routine 22

PIPELINING ISSUES: BRANCH MISPREDICTIONS A branch misprediction resembles an “exception” – Except it is not visible to software (i.e., it is microarchitectural) What about branch misprediction recovery? – Similar to exception handling except can be initiated before the branch is the oldest instruction (not architectural) – All three state recovery methods can be used Difference between exceptions and branch mispredictions? – Branch mispredictions are much more common  need fast state recovery to minimize performance impact of mispredictions 23

HOW FAST IS STATE RECOVERY? Latency of state recovery affects – Exception service latency – Interrupt service latency – Latency to supply the correct data to instructions fetched after a branch misprediction Which ones above need to be fast? How do the three state maintenance methods fare in terms of recovery latency? – Reorder buffer – History buffer – Future file 24

BRANCH STATE RECOVERY ACTIONS AND LATENCY Reorder Buffer – Flush instructions in pipeline younger than the branch – Finish all instructions in the reorder buffer History buffer – Flush instructions in pipeline younger than the branch – Undo all instructions after the branch by rewinding from the tail of the history buffer until the branch & restoring old values one by one into the register file Future file – Wait until branch is the oldest instruction in the machine – Copy arch. reg. file to future file – Flush entire pipeline 25

CAN WE DO BETTER? Goal: Restore the frontend state (future file) such that the correct next instruction after the branch can execute right away after the branch misprediction is resolved Idea: Checkpoint the frontend register state/map at the time a branch is decoded and keep the checkpointed state updated with results of instructions older than the branch – Upon branch misprediction, restore the checkpoint associated with the branch Hwu and Patt, “Checkpoint Repair for Out-of-order Execution Machines,” ISCA

CHECKPOINTING When a branch is decoded – Make a copy of the future file/map and associate it with the branch When an instruction produces a register value – All future file/map checkpoints that are younger than the instruction are updated with the value When a branch misprediction is detected – Restore the checkpointed future file/map for the mispredicted branch when the branch misprediction is resolved – Flush instructions in pipeline younger than the branch – Deallocate checkpoints younger than the branch 27

CHECKPOINTING Advantages – Correct frontend register state available right after checkpoint restoration  Low state recovery latency –…–… Disadvantages – Storage overhead – Complexity in managing checkpoints –…–… 28

MANY MODERN PROCESSORS USE CHECKPOINTING MIPS R10000 Alpha Pentium 4 Yeager, “The MIPS R10000 Superscalar Microprocessor,” IEEE Micro, April 1996 Kessler, “The Alpha Microprocessor,” IEEE Micro, March-April Boggs et al., “The Microarchitecture of the Pentium 4 Processor,” Intel Technology Journal,

SUMMARY: MAINTAINING PRECISE STATE Reorder buffer History buffer Future register file Checkpointing Readings – Smith and Plezskun, “Implementing Precise Interrupts in Pipelined Processors,” IEEE Trans on Computers 1988 and ISCA – Hwu and Patt, “Checkpoint Repair for Out-of-order Execution Machines,” ISCA

Samira Khan University of Virginia Feb 9, 2016 COMPUTER ARCHITECTURE CS 6354 Precise Exception The content and concept of this course are adapted from CMU ECE 740