---
title: Problem set 3
heading: "Problem set 3: front ends, ILP, threads and heterogeneous cores"
eyebrow: S4 · Problem set 3
type: problems
---

::: hook
These problems use lessons 6 to 16: pipeline depth, branch and target prediction, the front end, dynamic scheduling and speculation, the predictor lab, superscalar and VLIW issue, multithreading, heterogeneous multicores, and chiplets.
:::

::: pool
pick: 12

::: check
kind: parts
given: w = 4 | 6 | 8; t = 5 | 9 | 14; b = 1 | 2

## A {w}-wide fetch stops at taken branches, which come every {t} instructions, and loses {b} cycle(s) on each redirection.

::: part
answer: t/(ceil(t/w - 1e-9) + b)
tolerance: 0.5%

### What fetch rate does it reach?

::: misses
- [any] $t/(\lceil t/w\rceil + b)$.
:::
:::

::: part
answer: t/ceil(t/w - 1e-9)
tolerance: 0.5%

### And with zero-bubble redirection?

::: misses
- [any] Drop the bubbles.
:::
:::
:::

::: check
kind: parts
given: h = 0.7 | 0.85 | 0.95; u = 6 | 8; d = 3 | 4

## A µop cache hits {h} of the time, delivering {u} µops a cycle; the decoders deliver {d}.

::: part
answer: 1/(h/u + (1 - h)/d)
tolerance: 0.5%

### What average delivery rate results?

::: misses
- [h*u + (1 - h)*d] Average the time per µop, not the rates.
- [any] $1/(h/u + (1 - h)/d)$.
:::
:::

::: part
answer: h/u/(h/u + (1 - h)/d)*100
unit: %
tolerance: 0.5%

### What fraction of the time are the decoders idle?

::: misses
- [any] The share of time spent delivering from the µop cache.
:::
:::
:::

::: check
kind: parts
given: f = 0.15 | 0.2; a = 0.94 | 0.98; P = 12 | 20; t = 0.1 | 0.15; h = 0.9 | 0.98; c = 2 | 4; m = 2 | 10; p = 15 | 30

## Branches are {f} of instructions, predicted {a} right with a {P}-cycle penalty; taken branches are {t} of instructions and hit the BTB {h} of the time (misses cost {c} cycles); the instruction cache misses {m} times per thousand instructions at {p} cycles.

::: part
answer: f*(1 - a)*P + t*(1 - h)*c + m/1000*p
tolerance: 0.5%

### What CPI does the front end add?

::: misses
- [f*(1 - a)*P] Add the BTB and instruction-cache components.
- [any] Sum the three components.
:::
:::

::: part
answer: f*(1 - a)*P/(f*(1 - a)*P + t*(1 - h)*c + m/1000*p)*100
unit: %
tolerance: 0.5%

### What share of it is direction mispredictions?

::: misses
- [any] That component over the total.
:::
:::
:::

::: check
kind: parts
given: p = 0.6 | 0.8 | 0.9

## A branch is taken independently with probability {p}, and one 2-bit saturating counter predicts it.

::: part
answer: (p*(p^2*(1 - p) + p^3) + (1 - p)*((1 - p)^3 + (1 - p)^2*p))/((1 - p)^3 + (1 - p)^2*p + (1 - p)*p^2 + p^3)
tolerance: 0.5%

### What long-run accuracy does the counter reach?

::: misses
- [p] That's always-taken; the counter sometimes flips.
- [any] Weight each state by its stationary probability.
:::
:::
:::

::: check
kind: parts
given: B = 500 | 2000 | 8000; n = 10 | 12 | 14

## {B} active branches share a table of $2^n$ counters (n = {n}).

::: part
answer: 1 - (1 - 2^(-n))^(B - 1)
tolerance: 0.5%

### What is the chance a given branch shares its entry?

::: misses
- [any] $1 - (1 - 2^{-n})^{B-1}$.
:::
:::

::: part
answer: B/2^n
tolerance: 0.5%

### How many branches per entry is that on average?

::: misses
- [any] B ÷ entries.
:::
:::
:::

::: check
kind: parts
given: D = 12 | 24 | 40; d = 8 | 16 | 32

## A recursive function calls itself {D} deep and then returns all the way; the return-address stack holds {d} entries.

::: part
answer: (D - d)*step(D - d - 0.5)
tolerance: 0

### How many returns are mispredicted?

::: misses
- [any] The calls beyond the stack's depth.
:::
:::
:::

::: check
kind: parts
given: r = 4 | 16 | 64

## A core of {r} base units performs as Pollack's rule says and draws power in proportion to its area.

::: part
answer: sqrt(r)
tolerance: 0.5%

### How much faster than a base core is it?

::: misses
- [any] $\sqrt r$.
:::
:::

::: part
answer: r/sqrt(r)
tolerance: 0.5%

### How many times the energy does it use for the same task?

::: misses
- [any] Power over speed: $r/\sqrt r$.
:::
:::
:::

::: check
kind: parts
given: n = 64 | 256; r = 16 | 64; f = 0.95 | 0.99

## A chip of {n} base units runs code that's {f} parallel.

::: part
answer: 1/((1 - f)/sqrt(r) + f/(sqrt(r) + n - r))
tolerance: 0.5%

### What does an asymmetric design with one {r}-unit core reach?

::: misses
- [any] $1/((1 - f)/\sqrt r + f/(\sqrt r + n - r))$.
:::
:::

::: part
answer: 1/((1 - f)/sqrt(n) + f/n)
tolerance: 0.5%

### And the ideal dynamic design?

::: misses
- [any] $1/((1 - f)/\sqrt n + f/n)$.
:::
:::
:::

::: check
kind: parts
given: s = 1.2 | 1.5; c = 2.5 | 3; P = 6 | 10

## A big core draws {P} times a little core's power. A memory-bound thread runs {s} times faster on it, and a compute-bound thread {c} times faster.

::: part
answer: P/s
tolerance: 0.5%

### How much more energy does the memory-bound thread use on the big core?

::: misses
- [any] Power ratio over speedup.
:::
:::

::: part
answer: P/c
tolerance: 0.5%

### And the compute-bound thread?

::: misses
- [any] Power ratio over speedup.
:::
:::
:::

::: check
kind: parts
given: a = 1.2 | 1.6 | 2; g = 1.15 | 1.25 | 1.35

## Two threads each reach IPC {a} alone on an SMT core; together the core reaches {g} times that.

::: part
answer: g*a
tolerance: 0.5%

### What combined IPC does the core reach?

::: misses
- [any] g × the single-thread IPC.
:::
:::

::: part
answer: (1 - g/2)*100
unit: %
tolerance: 0.5%

### How much slower does each thread run than alone?

::: misses
- [any] Each gets half the combined IPC.
:::
:::
:::

::: check
kind: parts
given: R = 4 | 8 | 16; L = 200 | 500

## Each thread issues {R} cycles of work between memory accesses that take {L} cycles.

::: part
answer: (R + L)/R
unit: threads
tolerance: 0.5%

### How many fine-grained threads keep the core busy?

::: misses
- [L/R] Count the thread's own running time too.
- [any] $(R + L)/R$.
:::
:::
:::

::: check
kind: parts
given: N = 16 | 32 | 64; C = 4 | 8 | 16; w = 4 | 8

## A block of {N} instructions has a longest dependence chain of {C}; the core is {w} wide.

::: part
answer: N/C - (N/C - w)*step(N/C - w)
tolerance: 0.5%

### What is the best IPC on this core?

::: misses
- [any] The smaller of N/C and w.
:::
:::

::: part
answer: N/C
tolerance: 0.5%

### What is the dataflow limit on any machine?

::: misses
- [any] N/C.
:::
:::
:::

::: check
kind: parts
given: L = 3 | 4 | 6; r = 2 | 3; k = 3 | 4; R = 32

## A reduction runs on {r} pipelined unit(s) of latency {L}; each unrolled copy of the loop body needs {k} registers, from 32.

::: part
answer: L*r
tolerance: 0

### How many independent accumulators keep the units busy?

::: misses
- [L] Every unit needs its own L chains.
- [any] Latency × units.
:::
:::

::: part
answer: floor(32/k)
tolerance: 0

### What is the most the loop can be unrolled before running out of registers?

::: misses
- [any] $\lfloor 32/k\rfloor$.
:::
:::
:::

::: check
kind: parts
given: t = 100 | 140; o = 2 | 3 | 4; b = 0.05 | 0.1

## An instruction path of {t} FO4 is pipelined with {o} FO4 of overhead per stage and hazards costing {b} cycles per instruction per stage.

::: part
answer: sqrt(t/(o*b))
unit: stages
tolerance: 0.5%

### What depth is best?

::: misses
- [any] $\sqrt{t/(ob)}$.
:::
:::

::: part
answer: (sqrt(t*b) + sqrt(o))^2
unit: FO4
tolerance: 0.5%

### What time per instruction does it reach?

::: misses
- [any] $(\sqrt{tb} + \sqrt o)^2$.
:::
:::
:::

::: check
kind: parts
given: W = 128 | 256 | 512; k = 4 | 6; a = 0.95 | 0.98

## A {W}-instruction window sees a branch every {k} instructions, predicted {a} right.

::: part
answer: k*(1 - a^(W/k))/(1 - a)
tolerance: 0.5%

### How many of its instructions are on the correct path on average?

::: misses
- [any] $k(1 - a^{W/k})/(1 - a)$.
:::
:::

::: part
answer: k/(1 - a)
tolerance: 0.5%

### What is the most any window could have on the correct path?

::: misses
- [any] $k/(1 - a)$.
:::
:::
:::

::: check
kind: parts
given: A = 400 | 600 | 800; n = 2 | 4; D = 0.1 | 0.2

## A {A} mm² design at {D} defects/cm² is split into {n} chiplets (ignore interface overhead).

::: part
answer: exp(-A/100*D)*100
tolerance: 0.5%

### What is the monolithic die's yield, in percent?

::: misses
- [exp(-A*D)*100] Convert mm² to cm².
- [any] Not yet. $e^{-AD_0}$.
:::
:::

::: part
answer: exp(-A/n/100*D)*100
tolerance: 0.5%

### And each chiplet's?

::: misses
- [exp(-A/100*D)*100/n] Each chiplet has its own exponential yield.
- [any] Not yet. $e^{-(A/n)D_0}$.
:::
:::

::: right
Right. Smaller dies yield exponentially better, which pays for the packaging.
:::
:::
:::
