Out-of-order execution: Difference between revisions

Content deleted Content added
review: rm WP:DUPLINK via redirect
review: spell out. mark unsourced section. clarification and thinning.
Line 43:
# If input [[operand]]s are available (in processor registers, for instance), the instruction is dispatched to the appropriate [[functional unit]]. If one or more operands are unavailable during the current clock cycle (generally because they must be fetched from [[Computer memory|memory]]), the processor stalls until they are available.
# The instruction is executed by the appropriate functional unit.
# The functional unit writes the results back to the [[register file]].<!--[[User:Kvng/RTH]]-->
 
Often, an in-order processor has a [[bit vector]] recording which registers will be written to by a pipeline.<ref>{{cite web |url=https://pages.cs.wisc.edu/~swilson/gem5-docs/minor.html#sb |title=Inside the Minor CPU model: Scoreboard |author=<!--Not stated--> |date=2017-06-09 |access-date=2023-01-09}}</ref> If any input operands have the corresponding bit set in this vector, the instruction stalls. Essentially, the vector performs a greatly simplified role of protecting against register hazards. Thus out-of-order execution uses 2D matrices whereas in-order execution uses a 1D vector for hazard avoidance.
 
=== Out-of-order processors ===
{{unreferenced section}}
This new paradigm breaks up the processing of instructions into these steps:
# Instruction fetch.
Line 58 ⟶ 59:
# Only after all older instructions have their results written back to the register file, then this result is written back to the register file. This is called the graduation or retire stage.
 
The key concept of OoOEout-of-order processing is to allow the processor to avoid a class of stalls that occur when the data needed to perform an operation are unavailable. In the outline above, the OoOE processor avoids the stall that occurs in step (2) of the in-order processor when the instruction is not completely ready to be processed due to missing data.
 
OoOEOut-of-order processors fill these ''slots'' in time with other instructions that ''are'' ready, then reorder the results at the end to make it appear that the instructions were processed as normal. The way the instructions are ordered in the original computer code is known as ''program order'', in the processor they are handled in ''data order'', the order in which the data, operands, becomebecomes available in the processor's registers. Fairly complex circuitry is needed to convert from one ordering to the other and maintain a logical ordering of the output; the processor itself runs the instructions in seemingly random order.
 
The benefit of OoOEout-of-order processing grows as the [[instruction pipeline]] deepens and the speed difference between [[main memory]] (or [[cache memory]]) and the processor widens. On modern machines, the processor runs many times faster than the memory, so during the time an in-order processor spends waiting for data to arrive, it could have theoretically processed a large number of instructions.<!--[[User:Kvng/RTH]]-->
 
== Dispatch and issue decoupling allows out-of-order issue ==