Download Modern Micro-Data Flow - Lecture Slides | ECE 569 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!
Modern Micro-dataflow
Lec 6
In-order State and Precise Interrupt
If an IBM 360/91 instruction
causes an exception, can
we stop the processor in a
precise state?
By the time j executes, k has already updated R4?
How do you rewind the register file to the state just
after i?
Recall, i never even got to update R4!!
Next time, how to maintain an “in-order” state of the
machine. (In-order state = the machine state as
viewed by the first not-yet-completed instruction.)
i: R4 ← R0 x R j: R2 ← R0 + R4 Exception!! k: R4 ← R0 + R l: R8 ← R4 x R
Tomasulo vs. Modern OoO
1 chip 300ps < $
3 x 66” x 15” x 78” 60ns cycle time 11-12 gate delays per pipe stage
$1 million
Implementation
Exceptions Imprecise Precise (ROB)
True dependences Tag-based forw. Tag-based forw.
Output dependences Renamed reg. tag Reg. renaming
Anti-dependences Operand copy Reg. Renaming
Many FU Many busses
2 FPU Single CDB
Structural hazards
Width Peak IPC = 1 4+
IBM 360/91 Modern
Dispatch Buffer
Reservation
Dispatch
Complete
Stations
Compl. Buffer
Branch
Reg. File Ren. Reg.
Forwarding results to Res. Sta. &
Allocate Reorder Buffer entries
Reg. Write Back
rename
Managed as a queue; Maintains sequential order of all Instructions in flight (“takeoff” = dispatching; “landing” = completion)
(Reorder Buff.)
Integer (^) Integer Float.- (^) Load/ Point Store
registers
Elements of Modern Micro-dataflow
inorder
out-of-order
inorder
Metaflow Datapath
ICache
issue
DRIS (Renaming + Reservation Stations + Reorder Buff.) Retire
Scheduler
Register File
Branch Pred.
Speculative State
In-order State
DRIS
Circular Queue Structure
Instructions stored in original
program order
New entries are allocated at the
head of the queue as new
instructions are issued
Entries are committed in-order
from the tail of the queue to the
register file and memory
youngest
oldest
n-
n
Steps during Dynamic Execution
DISPATCH:
- Read operands from Register File (ARF) and/or Rename Register File (RRF) (RRF may return value or Tag)
- Allocate new RRF entry and rename destination register to it
- Allocate Reorder Buffer (ROB) entry
- Advance instruction to appropriate Reservation Station (RS) EXECUTE:
- RS entry monitors result bus for rename register Tag(s) to latch in pending operand(s)
- When all operands ready, issue instruction into Functional Unit (FU) and deallocate RS entry (no further stalling in execution pipe)
- When execution finishes, broadcast result to waiting RS entries and RRF entry COMPLETE:
- When ready to commit result into “in-order” state:
- Update architectural register from RRF entry, deallocate RRF entry, and if it is a store instruction, advance it to Store Buffer
- Deallocate ROB entry and instruction is considered architecturally completed
Issue*: (Rename+Decode)
A new ID (aka Tag) is allocated to each instruction
when issued into DRIS
- ID is the index of the allocated DRIS entry location
- The ID is used to refer to the result of that instruction
Register operand lookup, add rd, rs, rt
- Search DRIS to see if an older instruction has rs or rt as its destination.
- If so, rename the sources by setting the ID field.
- If renamed, check to see if data are ready.
- If not, set the locked bit.
Lock1 RN1 ID
Source 1 Lock2 RN2 ID
Source 2 latest RD Data
Destination
Dispatching*: add rd,rs,rt
A dispatched instruction is sent to the functional unit
with its operands and its ID
Operands could come from:
- DRIS: Data[IDx[ ID ]] speculative state when DRIS[IDx[ ID ]] is active
- Register File: RF[RNx[ ID ]] in-order state when DRIS[IDx[ ID ]] is invalid or retired
Lock1 RN1 ID1 Lock2 RN2 ID2 latest RD Data
Dispatched Fxn Unit Executed PC
Update
A Fxn unit returns both the result and the associated ID
The DRIS entry is updated
Data[ ID ]=result ; Executed[ ID ]= true ;
Enable other instructions that uses this result
if (ID1[id]== ID ) Locked1[id]= false ; if (ID2[id]== ID ) Locked2[id]= false ;
Lock1 RN1 ID1 Lock2 RN2 ID2 latest RD Data
Retire
Instructions retires strictly in-order from the oldest
entry of the DRIS
Data[ retiree ] is written (aka. committed) to the
register file
(speculative ⇒ in-order state)
Store instructions are only executed when retiring
from DRIS
Metaflow Datapath
ICache
issue
DRIS (Renaming + Reservation Stations + Reorder Buff.) Retire
Scheduler
Register File
Branch Pred.
Speculative State
In-order State
To support N-way issue into DRIS per cycle
- N x3 simultaneous 5-bit associative lookups
To support N-way dispatch per cycle
- 1 prioritized associative lookup of N entries
- N x2 indexed lookup in DRIS
- N x2 indexed lookup in the GPR
To support N-way update per cycle
- N indexed write to DRIS
- N x2 associative lookup and write in DRIS
To support N-way retire per cycle
- N indexed lookup in DRIS
- N indexed write to GPR
The Cost of Implementing DRIS
Dispatch Buffer
Reservation
Dispatch
Complete
Stations
Compl. Buffer
Branch
Reg. File Ren. Reg. Allocate Reorder Buffer entries
Reg. Write Back
(Reorder Buff.)
Integer (^) Integer Float.- (^) Load/ Point (^) Store
Decentralized Reordering Structure
inorder
out-of-order
inorder
Register Renaming Alternatives
Number of rename registers
Organization of rename registers
- Separate rename register file
- Pooled architectural/rename register file
Allocation of rename registers
- Fixed for each architectural register
- Shared by all architectural registers
Physical Location of rename registers
- Attached to the architectural register file
- Attached to the reorder buffer
Methods for rename lookup
Register Renaming Mechanisms
Data Busy Tag Data Valid
RRF
Register specifier
Operand read
Next entry to complete
Next entry to be allocated
ARF Map Table
Elements of Register Renaming
A pool of extra registers
- managed as temporary, single-assignment registers (eliminates WAW and WAR)
- logically separate from architectural registers named in ISA
- many physical organizations are possible
An allocation and mapping mechanism
- given a logical/architectural destination register name,
- how to find an unused rename register
- how to establish a new mapping for later references
- given a logical/architectural register name, where is its current definition (value, location, ready or not)
- when to reclaim a mapping? when to reclaim a register?
Register Map Table with Separate Architectural and Rename Registers
data busy tag
logical register name
ARF Map Table
data
RRF
rdy (^) next to free
next to allocate
Operand Value/Tag
Issues: How large is RRF? How to manage RRF? How to recover the Map Table Pentium-Pro on br. mispredict. & exceptions?
How to recover the Rename Map
Metaflow DRIS: remembers everything about all outstanding
instructions
- associative lookup always gives the right answer from the perspective of the youngest instruction
Map Table: rename history of a logical register is overwritten after
each WAW Solutions:
- Discard all speculative state and revert to default ARF mapping
- Record the rename history
- add another field to RRF to remember the last rename register mapped by the same logical register
- map table can be rebuilt by tracing backwards sequentially in the active RRF region (recall RRF is “program-ordered”)
- Take snapshots of the entire rename table at strategic times, i.e. when predicting branches
What about exceptions?
Register Map Table with unified Physical Registers
tag
logical register name
Map Table
data
PRF (holds both inorder & speculative state)
rdy
Operand Value/Tag
Issues: How large is PRF? How to manage PRF? How to recover the Map Table
R10000, P4 on br. mispredict. & exceptions?
Reservation Stations / Instruction Queues
A place where instructions can wait for dataflow resolutions
- unresolved operand values are represented by a unique tag (usually the name of the “renamed” operand register or the instruction to produce the operand value, sometimes synonymous)
- a completing instruction can forward is result to all reservations holding the right tags
Management policies
- single vs. multi buffers
- random access or FIFO
- age-prioritized
- value vs. tag only
- when to deallocate Reservation stations for Ld/St units are more complicated
Reorder Buffer
An program-ordered record of all outstanding (out-of-
order) instructions
- delay update of in-order program state by instructions completing out-of-order
- allow inorder commit of in-order program state
in-order reg file
Reorder Buffer
in-order update out-of-order result
operand lookup
Don’t forget about PC
and memory writes!!
backup 2 backup 1 backup 0
Tracking the Three States: Other Options
Keeping history to rewind and restart execution
- rewinds to special points (i.e. branch instructions) in the program by checkpointing
- rewinds to arbitrary points (incremental history and recovery)
reg file
Checkpoint Stack
reg file regfile write history (FIFO)
out-of-order writeback
operand lookup discard history of completed inst’s in FIFO order
out-of-order writeback
displaced reg name & values
sequential restoration
MIPS R10000 circa 1996
4-way superscalar
(fetch, decode, dispatch and complete)
5 execution pipelines (2 Int, FP Add, FP Mult, Ld/St)
Micro-dataflow instruction scheduling
(16+16 instruction window)
Register renaming + memory renaming
64 physical integer registers to hold 33 logical registers + renamed registers
Speculative execution pass 4 unresolved branches
Precise Interrupts
Flow Path Model of Superscalars
I-cache
FETCH
DECODE
COMMIT D-cache
Branch Predictor (^) Instruction Buffer
Store Queue
Reorder Buffer
Integer Floating-point (^) Media Memory
Instruction
Register Data
Memory Data
Flow
EXECUTE
(ROB)
Flow
Flow