Chapter 1. Day 1, first block, 55 minutes

TPU lineage and roofline thinking

This chapter does two things. It walks the ten TPU generations as a sequence of answers to specific bottlenecks, and it sets up the one model the rest of the course reasons with: the roofline. The two are the same story. Every generation is Google moving a ridge point.

Ten generations in one table

ChipPublicRoleMatrix unitsDense peak per chipHBMHBM BWLargest ICI domainSource
TPUv12015 deployedInference1 × 256×256, int892 TOPS int88 GiB DDR334 GB/snone (PCIe card)[P-v1]
TPUv22017Training2 cores × 1 × 128×12846 TFLOP/s16 GiB700 GB/s256, 2D torus[P-v23]
TPUv32018Training2 × 2 × 128×128123 TFLOP/s32 GiB900 GB/s1,024, 2D torus[P-v23]
TPU v42020Training2 × 4 × 128×128275 TFLOP/s32 GiB1,200 GB/s4,096, 3D torus + OCS[P-v4]
TPU v5e2023Cost, serving1 × 4 × 128×128197 TFLOP/s16 GB819 GB/s256, 2D torus[D-v5e]
TPU v5p2023Scale training2 × 4 × 128×128459 TFLOP/s95 GiB2,765 GB/s8,960, 3D torus + OCS[D-v5p]
TPU v6e2024Cost, serving1 × 2 × 256×256918 TFLOP/s32 GB1,638 GB/s256, 2D torus[D-v6e]
TPU7x2025, GA 2026Inference and training2 chiplets × 2 × 256×2562,307 TFLOP/s; 4,614 fp8192 GiB7,380 GB/s9,216, 3D torus + OCS[D-7x]
TPU 8tannounced 2026-04Trainingnot published12.6 PFLOP/s fp4216 GB6,528 GB/s9,600, 3D torus[G-8dd]
TPU 8iannounced 2026-04Inferencenot published10.1 PFLOP/s fp4288 GB8,601 GB/s1,152, Boardfly[G-8dd]

Peaks are BF16 unless stated. "2 × 4 × 128×128" means two TensorCores, each with four 128×128 matrix units. Google publishes only FP4 peaks for TPU 8. The JAX hardware table lists BF16 at 996 TFLOP/s for 8t and 1,100 TFLOP/s for 8i provisional [J-hw]. Neither chip had reached general availability as of 2026-10-23.

Each generation answers a bottleneck

TPUv1 (2015): inference throughput per watt

Google projected in 2013 that speech recognition alone could double its datacenter compute [P-v1, §1]. The answer was a PCIe coprocessor with one 256×256 int8 systolic array, 24 MiB of on-chip buffer and 8 GiB of DDR3 at 34 GB/s. It ran 15–30× faster than the K80 GPU and Haswell CPU it was measured against, at 30–80× better TOPS/W. Its own roofline exposed its limit: the ridge sat at 1,350 operations per weight byte, so most production models were memory-bound, and the paper estimates GDDR5 would have tripled performance [P-v1, §4, §7].

TPUv2 (2017): training

Training needs floating point, more memory bandwidth and many chips. v2 replaced DDR3 with HBM (700 GB/s, about 20× v1), added a programmable vector unit with bf16 multiply and fp32 accumulate, and added the inter-chip interconnect, ICI. Chips connect directly in a 2D torus with routers on the chip and no external switch [P-Norrie] [P-v23]. The array shrank to 128×128, because a 256×256 array wastes more of its cells on the matrix shapes real models produce [HC-v23, Why 128x128].

TPUv3 (2018): more of the same, cooled by liquid

Two matrix units per core, 940 MHz instead of 700, twice the HBM, and pods of 1,024 chips. Liquid cooling allowed the extra power [P-v23].

TPU v4 (2020): scale, failures and embeddings

v4 has three new pieces [P-v4]:

  • A 3D torus of 4×4×4 cubes, joined by optical circuit switches (OCS). The switches let a 4,096-chip pod be re-cut into slices, route around failed racks, and use twisted torus shapes. They cost under 5% of the system.
  • SparseCores for embedding lookups. They take about 5% of die area and run embedding-heavy models 5–7× faster.
  • 128 MiB of shared CMEM on the chip.

TPU v5e and v5p (2023): one line for cost, one for scale

v5e is a single-core chip in 256-chip 2D pods, priced for serving and small training [D-v5e]. v5p is the training flagship: 95 GiB of HBM, 2,765 GB/s, and 8,960-chip pods [D-v5p].

TPU v6e Trillium (2024): a bigger matrix unit

v6e moved to 256×256 arrays, giving 4.7× v5e's peak per chip [G-v6e] [D-arch]. v1 had used a 256×256 int8 array; v2 through v5 used 128×128. By 2024 the matrix dimensions in production models were large enough to fill 256×256 arrays.

TPU7x Ironwood (2025): inference at training scale

Two compute chiplets per package, each seen by JAX as its own device. 192 GiB of HBM at 7,380 GB/s, native FP8 at 4,614 TFLOP/s, and 9,216-chip pods at about 10 MW [D-7x] [G-7x]. Google's launch post calls it "the first Google TPU for the age of inference". The HBM capacity is for KV caches and the bandwidth is for decode.

TPU 8t and 8i (announced April 2026): two chips

The first generation split by workload [G-8dd]:

  • 8t keeps the 3D torus, scales the pod to 9,600 chips and doubles ICI bandwidth relative to Ironwood.
  • 8i has 288 GB of HBM at 8,601 GB/s and 384 MB of on-chip SRAM, three times Ironwood's, sized to keep KV cache on chip. It replaces the torus with a lower-diameter "Boardfly" network of at most 7 hops, and replaces SparseCores with a collectives engine.

The rest of this chapter explains why decode traffic pushed Google there.

FLOPs outgrew bandwidth

From TPUv2 to Ironwood, per-chip BF16 FLOP/s grew 50× and HBM bandwidth grew 10.5×. Google's own retrospective gives the same shape: about 100× peak and 10× HBM over five generations, counting Ironwood's FP8 peak [P-Micro26]. The ratio of the two is the number this chapter is about.

1×2×5×10×20×50×TPUv2TPUv3TPU v4TPU v5pTPU7x20172018202020232025FLOP/s 50×HBM BW 10.5×
Dense BF16 FLOP/s per chipHBM bandwidth per chip
ChipBF16 TFLOP/sHBM GB/sRidge, FLOP/B
TPUv2 (2017)4670066
TPUv3 (2018)123900137
TPU v4 (2020)2751,200229
TPU v5p (2023)4592,765166
TPU7x (2025)2,3077,380313
Generation growth. Per-chip dense BF16 FLOP/s and HBM bandwidth for the flagship training chips, both indexed to TPUv2 = 1. Hover a generation for the absolute values. The last column of the table is the ridge point, defined below. Computed in scripts/ch01_roofline.py from P-v23, P-v4, D-v5p and D-7x.

Two times bound every kernel

A kernel spends time in two places: arithmetic and data movement. The Scaling Book models both as a count divided by a rate [SB1].

Tmath=FLOPsC,Tcomms=bytes movedW(1.1)T_\text{math} = \frac{\text{FLOPs}}{C}, \qquad T_\text{comms} = \frac{\text{bytes moved}}{W} \tag{1.1}

Time on arithmetic is work over peak FLOP/s, C. Time on data movement is bytes over the bandwidth W of whichever link carries them: HBM, ICI, PCIe or DCN.

With perfect overlap the kernel takes max⁡(Tmath,Tcomms)\max(T_\text{math}, T_\text{comms}). With none it takes the sum, at most 2× worse. The course reasons from the max.

Arithmetic intensity is the ratio of the two counts: FLOPs per byte moved. A chip has an intensity too, the ratio of its two rates. A kernel is compute-bound when its intensity exceeds the chip's:

FLOPsbytes>CWhbm(1.2)\frac{\text{FLOPs}}{\text{bytes}} > \frac{C}{W_\text{hbm}} \tag{1.2}

A kernel keeps the matrix units busy only if it does more arithmetic per byte than the chip can do per byte of bandwidth.

The right-hand side is the chip's ridge point. TPUv2's was 66 FLOP/B and Ironwood's is 313. For the chips used in this course, against HBM:

ChipBF16FP8INT8HBM BWBF16 intensity
TPU v5e197 TFLOP/s—394 TOP/s819 GB/s241
TPU v5p459 TFLOP/s459 TFLOP/s918 TOP/s2.77 TB/s166
TPU v6e918 TFLOP/s920 TFLOP/s1.84 POP/s1.64 TB/s560
TPU7x Ironwood2.31 PFLOP/s4.61 PFLOP/s—7.38 TB/s313
TPU 8t996 TFLOP/sp5.98 PFLOP/sp996 TOP/sp6.53 TB/s153p
TPU 8i1.1 PFLOP/sp8.81 PFLOP/sp—8.6 TB/s128p
H100 SXM989 TFLOP/s1.98 PFLOP/s—3.35 TB/s295
B200 (HGX)2.25 PFLOP/s4.5 PFLOP/s—8 TB/s281

p provisional: from the JAX Pallas hardware table, not in Google's published spec.

Values come from Cloud TPU docs, the JAX hardware table for TPU 8's BF16, FP8 and INT8 rows, and NVIDIA product pages with sparse figures halved [D-7x] [J-hw] [G-8dd] [N-h100]. The Scaling Book uses 240 for v5e; the docs-based figure here is 241. v5p's ridge, 166, is lower than v5e's because v5p carries 3.4× the bandwidth for 2.3× the FLOPs. v5p and v6e list FP8 at the same rate as BF16, so FP8 on those chips saves bytes but not time [D-v5p] [J-hw].

A matmul's intensity is its batch

Take X[B,D]⋅W[D,F]X[B, D] \cdot W[D, F] in bf16. It does 2BDF2BDF FLOPs and moves 2BD+2DF+2BF2BD + 2DF + 2BF bytes:

AI=2BDF2BD+2DF+2BF≈Bwhen B≪D,F(1.3)\text{AI} = \frac{2BDF}{2BD + 2DF + 2BF} \approx B \quad \text{when } B \ll D, F \tag{1.3}

When the token batch is small next to the weight dimensions, weight bytes dominate, and every weight byte is used once per token. Intensity equals the number of tokens.

So a bf16 matmul on Ironwood is compute-bound once the token batch per replica exceeds about 313. On v5e the figure is 241 and on an H100 it is 295 [SB1]. The batch counts tokens, not sequences. Model sharding does not change it, because sharding divides FLOPs and bandwidth by the same factor.

Worked example: LLaMA-3-70B MLP up-projection at batch 64 on one Ironwood chip

The up-projection has D=8,192D = 8{,}192 and F=28,672F = 28{,}672 [SB6]. At B=64B = 64 in bf16 on one Ironwood chip (2,307 TFLOP/s, 7,380 GB/s [D-7x]):

  • FLOPs: 2⋅64⋅8192⋅28672=3.01×10102 \cdot 64 \cdot 8192 \cdot 28672 = 3.01 \times 10^{10}, so Tmath=13.0 μsT_\text{math} = 13.0\ \mu\text{s}.
  • Bytes: 4.75×1084.75 \times 10^{8}, nearly all of it the 470 MB weight matrix, so Thbm=64.3 μsT_\text{hbm} = 64.3\ \mu\text{s}.
  • Intensity: 63.4 FLOP/B against a ridge of 313. HBM-bound by 4.9×.

Solving Eq. 1.3 exactly for this shape puts the compute-bound batch at 329 tokens, slightly above the ridge, because activation bytes are not zero. The same step takes 579 µs on v5e and 142 µs on an H100. Computed by scripts/ch01_roofline.py.

Precision moves the ridge

Store the weights in int8 or fp8 and keep the math in bf16. FLOPs stay at 2BDF2BDF, but weight bytes halve to DFDF, so intensity becomes about 2B2B:

Bcrit≈CmathWhbm⋅bytes per weight2(1.4)B_\text{crit} \approx \frac{C_\text{math}}{W_\text{hbm}} \cdot \frac{\text{bytes per weight}}{2} \tag{1.4}

Each weight byte read supports 2 / (bytes per weight) FLOPs per token, so intensity is about 2B divided by bytes per weight. C is the peak for the precision the math runs in. Halving bytes per weight halves the batch needed; doubling the math rate doubles it back.

The Scaling Book writes this as β⋅C/Whbm\beta \cdot C/W_\text{hbm}, with β\beta the ratio of weight bits to activation bits and CC the BF16 peak [SB7]. For bf16 math the two forms agree. Formula 1.4 also covers low-precision math directly.

On v5e, int8 weights with bf16 math bring the compute-bound batch from 240 to 120 [SB1, Q2]. On Ironwood the example shape goes from 329 to 164.

Moving the math to low precision as well doubles CC. On Ironwood, fp8 math runs at 4,614 TFLOP/s [D-7x], so the ridge doubles to 625 and the compute-bound batch returns to 329. The step still gets faster: at batch 64 it drops from 64 µs to 32 µs, because the bytes halved. The batch at which the matrix units saturate is what stays put.

The provisional TPU 8i figures push this further. Its fp8 ridge is about 1,024 FLOP/B provisional. With fp8 weights and fp8 math, the example shape needs more than 557 tokens per chip to be compute-bound. Decode batches that large are rare, especially with long contexts, as Chapter 7 shows. Google's design answer for 8i was bandwidth and on-chip SRAM, not FLOPs: 8,601 GB/s of HBM and 384 MB of SRAM [G-8dd].

1 T10 T100 T1 P10 P1101001,00010,000Arithmetic intensity, FLOPs per byte of HBM trafficAttainable FLOP/sridge 313B = 64
TPU7x Ironwood bf16 roofline
Arithmetic intensity63.4 FLOP/B
Ridge point (C / HBM BW)313 FLOP/B
T_math13 µs
T_HBM64.3 µs
Compute-bound above B ≈329

HBM-bound. Loading 474 MB takes 64.3 µs; the 30.1 GFLOP of math would take 13 µs.

Roofline plotter. One matmul X[B, D] · W[D, F] against a chip's HBM roofline. Change the chip, dtypes and batch to see where the operating point sits relative to the ridge. Hover the plot to read attainable FLOP/s at any intensity. Peaks come from scripts/specs.py; TPU 8 BF16 and FP8 peaks are provisional.

Replace HBM with an inter-chip link and the model is unchanged. The Scaling Book's example splits the contracting dimension DD of X[B,D]⋅W[D,F]X[B, D] \cdot W[D, F] across two chips [SB1]. Each chip multiplies its half, BDFBDF FLOPs, then the chips exchange 2BF2BF bytes of bf16 partial sums:

BDFC>2BFWlink  ⟺  D>2CWlink(1.5)\frac{BDF}{C} > \frac{2BF}{W_\text{link}} \iff D > \frac{2C}{W_\text{link}} \tag{1.5}

Splitting the contracting dimension is worthwhile only if each chip's half of the matmul takes longer than shipping the partial result to the other chip.

The threshold now depends on DD, not on the batch. On v5e, with 45 GB/s one way per link, it is D>8,755D > 8{,}755 [SB1]. On Ironwood, the Cloud docs give 200 GB/s per link counting both directions, so 100 GB/s one way [D-7x]. The threshold becomes D>46,140D > 46{,}140 derived: no current model has a hidden dimension that large. Ironwood's FLOPs grew 11.7× over v5e while its per-link bandwidth grew 2.2×. Chapters 5 and 6 work through what that does to tensor parallelism.

What the HBM roofline leaves out

Three things the model above does not capture, each of which shows up in Chapter 10's profiles.

Vector-unit work has its own roofline. Elementwise ops, reductions and softmax run on the VPU, not the matrix units. On v5p the VPU peaks at about 7 TFLOP/s per core, a critical intensity of about 3 [SB1]. A dot product, at 0.5 FLOP/B, is memory-bound on any chip. These ops are cheap only when XLA fuses them into the matmul that produces or consumes their input.

Small transfers are latency-bound. Each ICI hop costs about 1 µs regardless of size. On v5e, any per-hop chunk under about 45 kB spends more time on latency than bandwidth [SB3]. That is the normal regime for decode-time collectives (Chapter 7).

Peak is not achievable peak. The Scaling Book states that H100s and B200s usually reach 80–85% of claimed peak FLOP/s, while TPUs get closer to 95% [SB1]. The book does not publish the measurements behind those figures, so treat them as practitioner estimates.

Sources