reorder buffer
play

Reorder Buffer Method Issue Execute Write Classic 5-stage - PowerPoint PPT Presentation

Reorder Buffer Method Issue Execute Write Classic 5-stage pipeline In-order In-order In-order Multi-cycle FP pipeline In-order In-order Out-of-order Scoreboard In-order Out-of-order Out-of-order Tomasulo


  1. Reorder Buffer • Method Issue Execute Write • Classic 5-stage pipeline In-order In-order In-order • Multi-cycle FP pipeline In-order In-order Out-of-order • Scoreboard In-order Out-of-order Out-of-order • Tomasulo In-order Out-of-order Out-of-order • Maintaining precise interrupts : • Complicated when instructions can complete (write) out of order. • Earlier instruction may raise interrupt long after later instructions have completed write • Later instructions may have overwritten registers • Reorder Buffer: • Mechanism for emulating In-order writes without sacrificing concurrency •Buffer the results of completing instructions reorder them and write them in order •Idea of reorder buffer can be used to implement aggressive branch speculation 0

  2. Speculative Execution Block 1 Decision Delayed ? A B Block 2 1

  3. Speculative Execution Speculative task: Block 1 Decision Delayed Task that is performed without assurance that it is required Guess future execution path ? A B Speculatively Executed Block Overlap Execution with Stall Delay Block 2 2

  4. Speculative Execution Block 1 Decision Delayed Guess future execution path ? Speculatively Executed A B Block Also Block 2 Speculatively Executed 3

  5. Speculative Execution Block 1 Decision Delayed Guess future execution path ? Speculatively Executed A B Block Also Decision Resolved Block 2 Speculatively Rollback to decision Executed point 4

  6. Speculative Execution Block 1 Decision Delayed Guess future execution path ? Speculatively Executed A B Block Speculative task: Incorporate rollback mechanism to undo consequences of the Also Block 2 task Speculatively Rollback to decision Executed point 5

  7. Checkpoint Based Speculation • Create checkpoint immediately prior to speculation • At checkpoint: Take a snapshot of relevant system state • On rollback: Restore saved system state Checkpoint: • Make copies of register contents • Copy-On-Write mechanism to make copies of memory locations written by speculative instructions • Primarily used in software implementations of fault tolerance or for maintaining transactional semantics 6

  8. Reorder Buffer for Speculation • Do not allow speculative instructions to update system state • Writes by speculative instruction are stalled till speculative status is resolved • Use renaming mechanisms to transfer information between speculative instructions • Rename source registers (a la Tomasulo) • On resolution • Mis-speculation: Squash the speculative instructions • Correct execution: Commit (the writes) of the speculative instructions • Reorder Buffer: • Mechanism to force In-Order Writes of Instructions • Buffer the results of completing instructions reorder them and writethem in order 7

  9. Extending Tomasulo Pipeline with Reorder Buffer ISSUE DISPATCH EX WRITE COMMIT Commit Unit removes ready to commit instructions from head of Q Tail Head Issue Unit adds newly issued instructions to tail of Q RoB : • Storage to buffer writes until ready to commit • Circular queue written and released in FIFO (instruction) order • Each entry allocates space for 1 instruction to store its results + identifying information 8

  10. Tomasulo’s Pipeline with RoB based Commit EX RS IR Issue Dispatch COMMIT WB LSQ REG RoB Accesses FILE RoB and EX REG FILE Common Data Bus (CDB) 9

  11. Extending Tomasulo Pipeline with Reorder Buffer ISSUE DISPATCH EX WRITE COMMIT Destination registers need to distinguish between 3 possible states: 1. Available (A): No pending write to register. Register has its final value. 2. In Flight (I): Writer instruction is in flight: The last instruction with that destinationregister has not yet completed its wri 3. Ready (R): Writer has competed write but not yet committed. The value from the reorder buffer will be written to the register when it commits. Note: A and I are the same two register states of regular Tomasulo. The state of a register is used by an issuing instruction to find out where to get its source operand. 10

  12. Key Features (Tomasulo with Reorder) Issue instruction X (ALU instruction): 1. Stall issue until Free Reservation Station and Reorder Buffer slots are available • Let RS X and RB X denote the RS and RoB slots allocated to X. • Henceforth X is identified using its Reorder Buffer tag RB X • Reservation Station RS I fields exactly the same as regular Tomasulo • RB X made up of the following fields: • Tag Destination State Value Tag: The identifier for instruction X (usually implicit index into the buffer) Destination: The destination register of instruction X State: Yes/No---- RoB entry is valid result Yes: X has completed write No: X is In flight) Value: Result of X (broadcast during write by X) 11

  13. Example A: MUL F4, F0, F2 B: ADD F8, F4, F6 Issue A RS A RS A v 0 v 2 MUL F4 F4 Tomasulo’s without RoB RB A v 0 v 2 MUL RB A F 4 No ----- STATE: RB A I Tomasulo’s with RoB F4 F4 12

  14. Example A: MUL F4, F0, F2 B: ADD F8, F4, F6 Issue B RS A RS B RS B v 6 ADD F8 F4 Tomasulo’s without RoB RB A RB A F 4 No ----- RB B v 6 MUL RB B F 8 No ----- STATE: RB B I Tomasulo’s with RoB F8 F4 13

  15. Key Features: Instruction Issue ( contd …. ) 3. For each source operand register S: Action depends on state of source register (A, I, R) • A: copy value from S immediately to RS X • I (pending write by instruction J): tag the source field of RS X with RB J • R (pending update from RB J ): read value from RB J and copy to RS I • STATE: STATE: STATE: RB J RB J I A R F0 F0 F0 RB J RS X RS X RS X RoB entry RoB[RB A ] ADDD F2, F0, F4 14

  16. Key Features: Instruction Issue ( contd …. ) 4. For destination register D Make X the writer of D • Set the state of D to I (Implicitly cancels the previous write if any). • 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend