CS 152 Computer Architecture and Engineering
CS252A Graduate Computer Architecture Lecture 13 - Out-of-Order Execution II

Chris Fletcher
UC Berkeley, Spring 2026

OoO Design Choices

Every Tomasulo-style pipeline tracks five activities:

  1. Register rename
  2. Post-dispatch, pre-issue operand staging
  3. Post-completion, pre-commit result staging
  4. Post-commit result staging (architectural register file)
  5. Program order of in-flight instructions (if commit ≠ completion)

Three Classic Designs

ActivityTomasulo originalData-in-ROBUnified physical RF
1 RenameRename tableRename tableDecode map + committed map
2 Pre-issue operandsPer-unit reservation stationsROBUPRF
3 Pre-commit resultsNoneROBUPRF
4 Committed valuesARFARFUPRF
5 Program orderNone (no separate commit)ROBSeparate ROB, no data

Unified Physical Register File

Lifetime of Physical Registers

ld   x1, (x3)     ld   P1, (Px)
addi x3, x1, #4   addi P2, P1, #4
sub  x6, x7, x9   sub  P3, Py, Pz
add  x3, x3, x6   add  P4, P2, P3
ld   x6, (x1)     ld   P5, (P1)
add  x6, x6, x3   add  P6, P5, P4
sd   x6, (x1)     sd   P6, (P1)
ld   x6, (x11)    ld   P7, (Pw)
  • Freeing P1 when ld P1 commits is wrong
  • Younger ld P5, (P1) and sd P6, (P1) still read it
  • On a trap, architectural x1 is P1
  • P1 stays live until the next writer of x1 commits

Physical Register Management: Dispatch

Start: rename x1→P8, x3→P7, x6→P5, x7→P6 (all present). Free list: P0, P1, P3, P2, P4. LPRd = previous mapping of the destination.

Instructionp1PR1p2PR2RdLPRdPRdRename after
ld x1, 0(x3)pP7x1P8P0x1→P0
addi x3, x1, #4P0x3P7P1x3→P1
sub x6, x7, x6pP6pP5x6P5P3x6→P3
add x3, x3, x6P1P3x3P1P2x3→P2
ld x6, 0(x1)P0x6P3P4x6→P4

Reading LPRd needs a third rename-table read port per instruction.

Physical Register Management: Execute & Commit

On commit: PRd becomes the committed mapping (no copy); LPRd is freed.

Superscalar Register Renaming

  • Rename 2 instructions per cycle through the same table?
  • Fails if Inst 1 writes x1 and Inst 2 reads x1
  • Inst 2 reads the stale mapping before Inst 1 updates the table
  • Fix: intra-cycle RAW check in parallel
    • Compare Inst1.Dest with Inst2.Src1/Src2
    • Mux Inst 1's new PDest into Inst 2's PSrc on match
    • Same Dest: Inst 2's mapping wins
  • MIPS R10K renames 4 serially dependent instructions per cycle
Inst 1: Src, Dest Inst 2: Src, Dest Rename table =? mux Inst1PDest Inst 2 PSrc

Check Your Understanding

1. In a UPRF machine, what happens to PRd and to LPRd when an instruction commits?
PRd becomes the committed architectural register via the committed map (no copy); LPRd is freed to the free list.
2. Why does a 2-wide renamer need comparators and muxes between Inst 1 and Inst 2?
If Inst 2 reads a register Inst 1 writes in the same cycle, the table would return the old mapping; the comparators detect it and mux in Inst 1's new PDest.

Load-Store Queue Design

Speculative Store Buffer

  • Decode: allocate a slot in order: V, S, Tag (address), Data
  • Stores split into store-address and store-data µops
  • Commit: oldest in ROB with address and data → clear S, drain to L1 later
  • Abort (trap/mispredict): clear V
load address V S Tag Data Spec. store buffer L1 data cache commit load data

Load bypass: search store buffer and L1 in parallel. Hit in both → use the store buffer. Two buffer matches → use the youngest store older than the load.

When Can a Load Execute Out of Order?

sd x1, (x2)
ld x3, (x4)     # x4 ready long before x2
StrategyRuleTrade-off
Conservative (MIPS R10K, 16-entry queue)Run the load only if all older store addresses are known and differ (partial check, e.g. low 12 bits)Never squashes; stalls whenever any older store address is slow
Address speculationGuess x4 ≠ x2, run now; when the store address arrives, check younger completed loads; match → squash load and everything afterBig win when aliasing is rare; big penalty when wrong
Memory dependence prediction (Alpha 21264)Speculate; on a squash mark the load PC store-wait so it waits next time; clear bits periodicallySpeculation without repeated squashes

Putting It Together

Check Your Understanding

1. A load matches two store-buffer entries and an L1 line. Which data does it use?
The store buffer, from the youngest store that is still older than the load.
2. How does the 21264's memory dependence prediction improve on pure address speculation?
After a load collides and is squashed, it's marked store-wait, so later executions wait for older stores instead of mis-speculating again (bits cleared periodically).