4.0 Out-of-order execution Flashcards
What are some limitations with pipelines
1: treat all instructions the same (same execution time for the different stages)
2: maximum IPC: 1
3: Limits to in-order execution
What determines the clock frequency?
The slowest pipeline stage.
All the stages will execute at this frequency
What is a solution to unification happening during pipelining?
Diversification
What is diversification?
Update the pipeline by allowing the Execution phase to take different amount of cycles depending on operation to be done.
For example iteger operations take 1 cycle and memory operations take multiple.
What are a benefit with using diversification
Shorter clock cycles
What are some problems with diversification?
1: Might get out-of-order completion
2: Multiple write operations to the register file in the same clock cycle
3: Exceptions
How can out-of-order completion happen when using diversification?
If the first instruction uses 3 cycles during the execute phase and the next uses 1, the second instruction will complete before the first.
If both instruction write to the same register, we have a write after write hazard
What do we need to do to fix a write-after-write hazard caused by out-of-order execution?
Stall
What are some hazards that can happen as a result of out-of-order execution?
Write-after-write
Multiple writes per cycle
How can we fix the problem of having multiple writes per cycle as a result of out-of-order execution?
Multiple write ports, if different registers are being used
Consider write port as structural hazard. When detected, the pipeline can delay until the first write has finished
What are precise exceptions and how can out-of-order execution affect these?
Precise exceptions are when all instructions prior to the exception, has executed to their completion. And non instructions after the exception has completed at all.
Out-of-order instructions may allow for later instructions to complete write back before the excpetion happens.
What are interrupts?
Due to external factors
Asynchronous to program execution
Independent of program running
Of-of-order execution is not a problem for interrupts, as these don’t need to be handled immediately
How are interrupts handled?
Stop fetching new instruction
Drain pipeline (execute instructions in the pipeline)
Store state (registers, PC)
Handle interrupt
restore program state and resume execution
What are exceptions and how are these handled?
Synchronous: result of program execution
Precise exeption flow:
- Store architecture state from just before the instruction that caused exception
- handle exception
- restore state and resume execution from instruction that caused exception
Can guarantee precise exceptions by stalling pipeline
How can parallelism be exploited in pipelines?
Superscalar pipelines are pipelines where multiple instructions can complete each cycle.
Parallelism in time(pipelining)
Parallelism in space (superscalar execution)
Superscalar pipeline use both
How does superscalar pipelines handle hazards?
Handle hazard before sending instruction to a functioning unit
Whatcan cause performance loss when using in-order issue?
Even though some instructions are completely independent on the previous ones, if previous instructions are stalling, these also need to stall to ensure in-order execution.
What are a key-idea behind out-of-order execution (2)?
Register renaming: Remove all anti dependences
Data flow execution: instruction execute as soon as their inputs are evailable.
What is data flow limit
The only thing preventing execution is that input data is not ready yet
Can illustrate by setting instructions as nodes in a graph, and real (RAW) data dependences as edges
Height of graph show minimum number of cycles needed
Describe the out-of-order pipeline
Two new stages:
- register renaming
- dispatch
New structures:
- issue buffer
- reorder buffer
- store buffer and queue
writeback stage divided into two stages: complete and retire