CS 152 Computer Architecture and Engineering
CS252A Graduate Computer Architecture Lecture 17 - VLIW

Chris Fletcher
UC Berkeley, Spring 2026

Superscalar Control Logic Scaling

$\text{Control complexity} \propto W \times (W \times L) = W^2 L$

Sequential ISA Bottleneck

  1. Programmer writes sequential code
  2. Superscalar compiler finds independent operations and schedules them, then flattens them back into sequential machine code
  3. Superscalar processor spends ~$W^3$ hardware rediscovering the schedule the compiler already knew

VLIW: Very Long Instruction Word

Int Op 1 Int Op 2 Mem Op 1 Mem Op 2 FP Op 1 FP Op 2

Early VLIW Machines

MachineNotes
FPS AP120B (1976)First commercial wide-instruction array processor; hand-coded software pipelining and unrolling
Multiflow Trace (1987)Up to 28 ops in a 1,024-bit word; trace scheduling
Cydrome Cydra-5 (1987)7 ops in a 256-bit word; rotating register file

Check Your Understanding

1. Why does OoO control grow faster than $W^2$?
Each of W instructions checks W × L in-flight ones (∝ W²L), and wider machines need deeper windows, so L grows with W.
2. Which two guarantees must a VLIW compiler make so hardware needs no dependence checks or interlocks?
Ops in one instruction are mutually independent, and no op reads a value before its producer's fixed latency has elapsed.

Loop Execution on a 6-Slot VLIW

for (i = 0; i < N; i++)
    B[i] = A[i] + C;
loop: fld  f1, 0(x1)
      add  x1, 8
      fadd f2, f0, f1
      fsd  f2, 0(x2)
      add  x2, 8
      bne  x1, x3, loop

Int 1 cycle, Mem 3, FP 4. Naive schedule:

cInt1Int2M1FP+
1add x1fld
2–3all NOPs
4fadd
5–7all NOPs
8add x2bnefsd

1 fadd / 8 cycles = 0.125 FLOP/cycle; 6 of 48 slots used

Loop Unrolling (4×)

cInt1Int2M1FP+
1fld f1
2fld f2
3fld f3
4add x1fld f4fadd f5
5fadd f6
6fadd f7
7fadd f8
8fsd f5
9fsd f6
10fsd f7
11add x2bnefsd f8

Software Pipelining

Overlap ops from different iterations. Steady-state loop (4 cycles):

cInt1Int2M1 (batch k+2)M2 (batch k)FP+ (batch k+1)
1fld f1fsd f5fadd f5
2fld f2fsd f6fadd f6
3add x2fld f3fsd f7fadd f7
4add x1bnefld f4fsd f8fadd f8

Software-Pipelined Loop, One Op per Iteration

        fld  f0, 0(x1)        # startup: iter 0 load
        fadd f4, f0, f2       #          iter 0 add
        fld  f0, -8(x1)       #          iter 1 load
        addi x1, x1, -16
Loop':  fsd  f4, 16(x1)       # store iter i
        fadd f4, f0, f2       # add   iter i+1
        fld  f0, 0(x1)        # load  iter i+2
        addi x1, x1, -8
        bne  x1, x0, Loop'
        ...                   # winddown: finish tail

What If There Are No Loops? Trace Scheduling

Check Your Understanding

1. In Loop', why does fsd come before fadd, and fadd before fld?
fsd must store the previous sum in f4 before fadd overwrites it, and fadd must read the previous load in f0 before fld overwrites it; each belongs to a different iteration.
2. Why does trace scheduling need fixup code on trace exits?
Ops were moved across branches; if execution leaves the trace, fixup code runs skipped ops or undoes speculative effects.

Problems with "Classic" VLIW

  1. Object-code compatibility: latencies and unit counts in the encoding → recompile for every machine
  2. Code size: NOP slots, unrolling, software pipelining
    • Compressed in memory, expanded on I-cache refill (Multiflow; complicates branch targets)
    • Explicit parallel groups (TI C6x, IA-64); single-op instruction (Cydra-5 UniOp)
  3. Variable memory latency: caches, bank conflicts
  4. Branch probabilities: profiling adds a build step
  5. Unpredictable branches: best schedule depends on the path

Intel Itanium, EPIC IA-64

Instruction 2 (41b) Instruction 1 (41b) Instruction 0 (41b) Template

Rotating Register Files

ld f1, ()  |  fadd f5, f4, ...  |  sd f9, ()  |  bloop

Latencies are encoded in specifier gaps: f4 − f1 = 3 (load), f9 − f5 = 4 (fadd)

RRBld writesfadd readsfadd writessd reads
8P9P12P13P17
5P6P9P10P14
1P2P5P6P10

Predicated Execution

  • Almost every IA-64 instruction has a 1-bit predicate: false → NOP
  • An if-then-else diamond (4 basic blocks) becomes one block
  • Removes >50% of branches on average (Mahlke et al.)
  • Complicates bypassing
  • Inst 3 and Inst 5 writing the same register under opposite predicates: check predicates before bypassing
Inst 1
Inst 2
p1, p2 <- cmp(a == b)
(p1) Inst 3 || (p2) Inst 5
(p1) Inst 4 || (p2) Inst 6
Inst 7
Inst 8

Control and Data Speculation

Limits of Static Scheduling

Check Your Understanding

1. mul (5-cycle) writes f2, add later reads f7; RRB drops by 1 per cycle. At RRB = 10, which register does mul write, and at what RRB does add read it?
mul writes P(2+10) = P12. Five cycles later RRB = 5 and add reads P(7+5) = P12.
2. Why does Load.s set a poison bit instead of faulting?
It was hoisted above a branch; if that path isn't taken the fault would be spurious. Chk.s in the home block raises it only when needed.