---
title: "Problem set 12: architecture across the course"
heading: "Problem set 12: problems that combine the whole course"
eyebrow: S4 · Problem set 12
type: problems
---

::: hook
These problems each combine several parts of the course: a core's CPI built from its pipeline, predictor and caches; a multicore sized by Amdahl and bus bandwidth; an accelerator judged by its roofline; a service sized by queueing and availability. Carry numbers from one part to the next, as an architect would.
:::

::: pool
pick: 12

::: check
kind: parts
given: c = 0.4 | 0.6; f = 0.18 | 0.22; a = 0.94 | 0.97; P = 14 | 20; m = 0.004 | 0.01; M = 200 | 300; g = 3 | 4

## A {g} GHz core with base CPI {c}: {f} branches at {a} accuracy and a {P}-cycle penalty, and {m} last-level misses per instruction costing {M} cycles each.

::: part
answer: c + f*(1 - a)*P + m*M
tolerance: 0.5%

### Total CPI?

::: misses
- [any] Base plus branch and memory stalls.
:::
:::

::: part
answer: g/(c + f*(1 - a)*P + m*M)
unit: GIPS
tolerance: 0.5%

### Billions of instructions per second?

::: misses
- [any] Clock over CPI.
:::
:::

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

### Fraction of time in memory stalls?

::: misses
- [any] Memory part over total.
:::
:::
:::

::: check
kind: parts
given: F = 0.95 | 0.99; N = 16 | 64; f = 3; m = 0.003 | 0.006; B = 64; W = 100 | 200

## A program {F} parallel runs on {N} cores at {f} GHz (IPC 1), each sending {m} bus misses per instruction with {B}-byte lines, on a {W} GB/s bus.

::: part
answer: 1/((1 - F) + F/N)
tolerance: 0.5%

### Amdahl speedup?

::: misses
- [any] $1/((1 - F) + F/N)$.
:::
:::

::: part
answer: W/(f*m*B)
tolerance: 0.5%

### Cores the bus can feed?

::: misses
- [any] $W/(fmB)$.
:::
:::
:::

::: check
kind: parts
given: w = 4 | 6; L = 30 | 50; W = 160 | 256; A = 32; r = 0.75; a = 0.95 | 0.98; b = 0.2

## A {w}-wide core averaging {L} cycles per instruction in flight, with a {W}-entry ROB, {A} architectural registers ({r} of instructions write one), and branches every 5 instructions at accuracy {a}.

::: part
answer: (w + W/L - abs(w - W/L))/2
tolerance: 0.5%

### Sustainable IPC?

::: misses
- [any] min(w, W/L).
:::
:::

::: part
answer: A + W*r
tolerance: 0.5%

### Physical registers?

::: misses
- [any] $A + Wr$.
:::
:::

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

### Useful instructions in a full ROB?

::: misses
- [any] $\frac{1}{f}\frac{1 - a^{fW}}{1 - a}$.
:::
:::
:::

::: check
kind: parts
given: h = 1 | 2; m = 0.03 | 0.06; k = 12 | 16; n = 0.25 | 0.4; M = 200 | 280; E = 64 | 1536; P = 4 | 2048

## L1 {h} cycles / {m} miss; L2 {k} cycles / {n} local miss; memory {M} cycles. A TLB of {E} entries with {P} KB pages.

::: part
answer: h + m*(k + n*M)
tolerance: 0.5%

### AMAT?

::: misses
- [any] Nest the levels.
:::
:::

::: part
answer: E*P
unit: KB
tolerance: 0.5%

### TLB reach?

::: misses
- [any] Entries × page.
:::
:::
:::

::: check
kind: parts
given: M = 4800 | 6400; c = 4 | 8; F = 1000 | 3000; o = 2 | 8; e = 8; r = 2

## A chip with {c} channels of {M} MT/s DRAM and a {F} GFLOPS peak runs a loop doing {o} operations per element, reading {r} arrays and writing 1, of {e}-byte numbers.

::: part
answer: M*8*c/1000
unit: GB/s
tolerance: 0.5%

### Peak bandwidth?

::: misses
- [any] MT/s × 8 × channels.
:::
:::

::: part
answer: o/((r + 1)*e)
tolerance: 0.5%

### Intensity?

::: misses
- [any] Ops over bytes.
:::
:::

::: part
answer: (F + M*8*c/1000*o/((r + 1)*e) - abs(F - M*8*c/1000*o/((r + 1)*e)))/2
unit: GFLOPS
tolerance: 0.5%

### Attainable?

::: misses
- [any] min(peak, bandwidth × intensity).
:::
:::
:::

::: check
kind: parts
given: N = 108 | 132; l = 64 | 128; f = 1.4 | 1.8; R = 65536; r = 48 | 96; L = 400 | 600; c = 15 | 30

## A GPU of {N} SMs × {l} lanes at {f} GHz; a kernel at {r} registers per thread on SMs with {R} registers and room for 64 warps; {L}-cycle memory latency, {c} cycles of work per warp between loads.

::: part
answer: N*l*2*f/1000
unit: TFLOPS
tolerance: 0.5%

### Peak?

::: misses
- [any] SMs × lanes × 2 × clock.
:::
:::

::: part
answer: (64 + floor(R/(r*32) + 0.0001) - abs(64 - floor(R/(r*32) + 0.0001)))/2
tolerance: 0

### Warps that fit?

::: misses
- [any] min(64, ⌊R/32r⌋).
:::
:::

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

### Warps needed to hide the latency?

::: misses
- [any] L/c.
:::
:::
:::

::: check
kind: parts
given: N = 16 | 32; k = 8 | 16; m = 3; h = 3 | 4; t = 2 | 3; o = 10 | 20; B = 64

## A {N}-core directory machine with {B}-byte lines on a {k} × {k} mesh; a miss has {m} critical-path messages at average distance, {t} ns per hop and {o} ns overhead each.

::: part
answer: 100*N/(8*B)
unit: %
tolerance: 0.5%

### Bit-vector directory overhead?

::: misses
- [any] $N/8B$.
:::
:::

::: part
answer: m*(2*k/3*t + o)
unit: ns
tolerance: 0.5%

### Network latency of a miss?

::: misses
- [any] $m(\tfrac{2k}{3}t + o)$.
:::
:::
:::

::: check
kind: parts
given: N = 8 | 32; c = 0.02 | 0.05; T = 64 | 1024; k = 4 | 8; t = 40

## {N} cores contend for a test-and-test-and-set lock that every thread holds {c} of the time; {T} threads meet at a tree barrier of fan-in {k}, {t} ns per level.

::: part
answer: N*(N - 1)
tolerance: 0

### Transactions until all {N} have held the lock once?

::: misses
- [any] $N(N - 1)$.
:::
:::

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

### Throughput limit from the lock, in threads?

::: misses
- [any] 1/c.
:::
:::

::: part
answer: ceil(log(T - 0.5)/log(k))*t
unit: ns
tolerance: 0

### Barrier arrival time?

::: misses
- [any] Levels × time per level.
:::
:::
:::

::: check
kind: parts
given: N = 40000 | 100000; p = 300 | 450; i = 0.4 | 0.55; u = 0.25 | 0.4; E = 1.15 | 1.3; k = 40 | 200; s = 0.005 | 0.01

## {N} servers at {p} W peak, idling at {i} of peak, running at {u}, with PUE {E}; requests fan out to {k} servers, each slow with probability {s}.

::: part
answer: N*(p*i + (p - p*i)*u)*E/1e6
unit: MW
tolerance: 0.5%

### Facility power?

::: misses
- [any] Servers × average power × PUE.
:::
:::

::: part
answer: 100*(1 - (1 - s)^k)
unit: %
tolerance: 0.5%

### Fraction of slow requests?

::: misses
- [any] $1 - (1 - p)^k$.
:::
:::
:::

::: check
kind: parts
given: S = 4 | 8; l = 40 | 90; M = 50000 | 300000; R = 12 | 48; a = 0.995 | 0.999

## A storage server with an {S} ms service time gets {l} random requests per second; it has an MTTF of {M} hours and an MTTR of {R} hours; the service runs two independent replicas each available {a}.

::: part
answer: S/(1 - l*S/1000)
unit: ms
tolerance: 0.5%

### Mean response time?

::: misses
- [any] $S/(1 - \rho)$.
:::
:::

::: part
answer: 1e6*R/(M + R)
unit: ppm
tolerance: 0.5%

### Server unavailability?

::: misses
- [any] MTTR/(MTTF + MTTR).
:::
:::

::: part
answer: -log(1 - a)*2
tolerance: 0.5%

### The replicated service's nines?

::: misses
- [any] $-\log_{10}(1 - a)^2$.
:::
:::
:::

::: check
kind: parts
given: n = 128 | 256; f = 0.94 | 1; B = 256 | 2048; W = 100 | 900; P = 4 | 8; b = 32 | 16

## An {n} × {n} systolic array at {f} GHz runs passes of {B} vectors from {W} GB/s of weight memory; weights shrink from {b} to {P} bits.

::: part
answer: n*n*2*f/1000
unit: TOPS
tolerance: 0.5%

### Peak?

::: misses
- [any] $2n^2f$.
:::
:::

::: part
answer: 100*B/(B + 2*(n - 1))
unit: %
tolerance: 0.5%

### Pass utilization?

::: misses
- [any] $B/(B + 2(n - 1))$.
:::
:::

::: part
answer: b/P
tolerance: 0

### Weight traffic reduction from quantizing?

::: misses
- [any] Ratio of widths.
:::
:::
:::

::: check
kind: parts
given: t = 100 | 140; o = 3 | 4; b = 0.04 | 0.07; v = 0.85 | 1; n = 3 | 5

## {t} FO4 of logic per instruction, {o} FO4 of overhead per stage and {b} stalls per instruction per stage; across process generations at √2, voltage scales by {v} with a fixed clock.

::: part
answer: sqrt(t/(o*b))
tolerance: 1%

### Optimal depth?

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

::: part
answer: (sqrt(2)*v^2)^(-n)
tolerance: 0.5%

### Fraction of the chip usable after {n} generations?

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

::: check
kind: parts
given: c = 0.5 | 1; z = 1.96 | 3; e = 0.02 | 0.03; b = 0.6 | 0.8; r = 0.1 | 0.2; l = 0.15 | 0.25; m = 0.5 | 1.2; f = 0.4 | 0.6

## A study samples CPI (coefficient of variation {c}, confidence z = {z}); the core's CPI stack is base {b}, branches {r}, L2 {l}, memory {m}.

::: part
answer: (z*c/e)^2
tolerance: 1%

### Samples for ±{e}?

::: misses
- [any] $(z\,\text{CoV}/\varepsilon)^2$.
:::
:::

::: part
answer: (b + r + l + m)/(b + r + l + m*f)
tolerance: 0.5%

### Speedup if memory stalls shrink to {f}?

::: misses
- [any] Ratio of total CPI.
:::
:::
:::

::: check
kind: parts
given: n = 256; r = 16 | 64; f = 0.95 | 0.99; b = 1 | 2; i = 1 | 2; g = 3

## An asymmetric chip of 256 units has one {r}-unit core; on code that's {f} parallel each small core moves {b} bytes per instruction at IPC {i} and 3 GHz.

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

### What speedup does the chip reach?

::: misses
- [any] Hill and Marty's asymmetric formula.
:::
:::

::: part
answer: (256 - r)*b*i*3
unit: GB/s
tolerance: 0.5%

### What memory bandwidth do the small cores need together in the parallel part?

::: misses
- [any] Cores × bytes per instruction × IPC × clock.
:::
:::
:::

::: check
kind: parts
given: k = 0.5 | 2; a = 20 | 40; f = 2.5 | 3.5

## A VM's program misses the TLB {k} times per thousand instructions; walk accesses take {a} ns at {f} GHz, with 4-level tables in guest and host.

::: part
answer: k/1000*24*a*f
tolerance: 0.5%

### What CPI do nested walks add?

::: misses
- [any] Misses per instruction × 24 accesses × time in cycles.
:::
:::

::: part
answer: k/1000*15*a*f
tolerance: 0.5%

### And with huge pages in both dimensions?

::: misses
- [any] 15 accesses per walk.
:::
:::
:::

::: check
kind: parts
given: n = 128 | 256; u = 0.7 | 0.9

## A weight-stationary {n} × {n} array should keep single-tile passes {u} busy.

::: part
answer: u*(3*n - 2)/(1 - u)
unit: rows
tolerance: 0.5%

### What batch does that need?

::: misses
- [any] Solve $M/(M + 3n - 2) = u$.
:::
:::
:::
:::
