CS 152 Computer Architecture and Engineering
CS252A Graduate Computer Architecture Lecture 12 - Out-of-Order Execution I

Chris Fletcher
UC Berkeley, Spring 2026

Complex Pipelining: Motivation

EventMeaning
DispatchLeave decode, enter the instruction pool
IssueLeave the pool for a functional unit
CompleteFinish execution, produce result/exception flags at writeback
CommitUpdate permanent architectural state (separated from completion later)

Issues in Complex Pipeline Control

Data Hazards: Register vs. Memory

HazardExampleKind
RAW$r_3 \leftarrow r_1\,op\,r_2$; $r_5 \leftarrow r_3\,op\,r_4$True dependence
WAR$r_3 \leftarrow r_1\,op\,r_2$; $r_1 \leftarrow r_4\,op\,r_5$Name (anti) dependence
WAW$r_3 \leftarrow r_1\,op\,r_2$; $r_3 \leftarrow r_6\,op\,r_7$Name (output) dependence

Data Hazards: An Example

InstructionLatency
I1FDIV.D f6, f6, f44
I2FLD f2, 45(x3)1
I3FMUL.D f0, f2, f43
I4FDIV.D f8, f6, f24
I5FSUB.D f10, f0, f61
I6FADD.D f6, f8, f21
  • RAW: 1→4, 1→5 (f6); 2→3, 2→4, 2→6 (f2); 3→5 (f0); 4→6 (f8)
  • WAR: 4→6, 5→6 (f6)
  • WAW: 1→6 (f6)
  • Valid orders: in order; I2, I1, I3…; I1, I2, I3, I5, I4, I6

In-Order Issue: In- vs. Out-of-Order Completion

k = Ik issues, k = Ik completes

In-order completion: 15 cycles

cycle123456789101112131415
12··1234·354656

Out-of-order completion: 12 cycles

cycle123456789101112
122314355466

In-Order Issue Limitations

InstructionLatencyDepends on
1FLD f2, 34(x2)1
2FLD f4, 45(x3)long
3FMULT.D f6, f4, f231, 2
4FSUB.D f8, f2, f211
5FDIV.D f4, f2, f841, 4; WAR on 3 (f4)
6FADD.D f10, f6, f413, 5

In-order issue (20 cycles): 1 2,1 · · · · · · 2 3 4 4 3 5 · · · 5 6 6

Check Your Understanding

1. Name the three data hazards. Which is a true dependence?
RAW (true), WAR (anti), WAW (output). Only RAW is true; WAR and WAW are name dependences.
2. In the long-load trace, why did instruction 4 sit idle for 8 cycles though f2 was ready early?
Instruction 3 was stalled on the long load, and in-order issue forbids issuing 4 before 3.

Out-of-Order Issue

Long-load example, OoO issue without renaming:

c123456789101314181920
12,144····2335566

5 can't go: WAR on f4 with stalled 3. Still 20 cycles.

This Is a Typical Problem in Loops

while (...) {
    A[i] += x;
}
L1: FLD  f4, 0(x3)
    ADDD f6, f4, f2
    FST  0(x3), f6
    ADD  x3, x3, 8
    j    L1
  • Every iteration reuses f4 and f6
  • If the first FLD misses, iteration 2's FLD into f4 is blocked by WAR/WAW
  • The number of ISA registers limits how many instructions can be in flight
  • OoO issue alone gives no significant speedup

Register Renaming

3: FMULT.D f6,  f4, f2
5: FDIV.D  f4', f2, f8     # f4 renamed
6: FADD.D  f10, f6, f4'
c12345910111213
12,144523,5366

The divide overlaps the long load: 20 → ~13 cycles

Renaming in the Pipeline

Check Your Understanding

1. Why did naive OoO issue not speed up the long-load sequence?
Instruction 5 had a WAR hazard on f4 with stalled instruction 3, blocking 5 and 6.
2. Which hazards does renaming eliminate, and which remain?
WAR and WAW are eliminated; RAW (true dependences) remains.

Renaming Structures (Data-in-ROB)

Rename table & regfile

regpdata / tag
f11value
f20t₃
…

p = 1: value valid
p = 0: tag of the producing ROB slot

Reorder buffer (FIFO, tags t₁…tₙ, head = oldest)

iopp1src1p2src2pdregresultexc?

src = value if p = 1, producer tag if p = 0

Instruction Lifecycle (Data-in-ROB)

  1. Dispatch (in order): allocate the tail slot (its tag); read sources (value, or result from the producer's ROB slot, or its tag with p = 0); set the destination's rename entry to <0, tail>
  2. Issue (out of order): entry with i = 0, p1 = p2 = 1, free unit → i = 1, send to the unit
  3. Complete (out of order): broadcast <t, result>; write result and exc into slot t; associatively search every source field for t and fill in values (expensive CAM)
  4. Commit (in order, at head): wait for pd = 1; if no exception, write the regfile (set p = 1 only if the rename tag still points here); dequeue

A tag can be reused only when its instruction commits.

Separating Completion from Commit

Historical Perspective: IBM 360/91 FPU

Check Your Understanding

1. In Data-in-ROB, when are source tags replaced by values, and when can a ROB tag be reused?
Tags are replaced when a unit produces data (associative broadcast). A tag is reused only when its instruction commits at the head.
2. Why does separating completion from commit fix imprecise traps?
Results and exception flags wait in the ROB; state changes only in program order, so younger instructions can be killed before touching state when an older one traps.