Course · TPU Systems: Generations, Memory, Precision & XProfPhase 21 · Study guide

How do you size TPU HBM capacity, bound BF16/INT8 precision error, and capture a clean XProf trace?

Cloud TPU Mini-Course · Step 3 of 3Cloud TPU VM + CPU verifierBite-sized · 2 lessons (~50m)

Revision v0.18.1 ·

Hardware specifications become useful only after you connect them to the workload. Training-state memory, inference KV-cache growth, arithmetic intensity and numerical precision place different demands on a device. Calculate those demands under explicit storage and placement assumptions before comparing theoretical ceilings. Then separate three observations: how many bytes are represented, how the numerical result changes and where execution time is spent. The memory ledger, precision chart and XProf trace each answer one of these questions. Read them together to form a target-specific hypothesis, and retain the actual target evidence when testing it.

Preparation: TPU Workflows: Launching Jobs & Checkpointed Experiments

Runtime: CPU numerical & profiler harness; Cloud TPU VM for target XProf traces

Check your starting point

A matrix multiplication has arithmetic intensity 170 FLOP/byte on TPU v5e (ridge point 240.5 FLOP/byte). Is it compute-bound or HBM bandwidth-bound?

Compare your reasoning

Under this ideal roofline model, 170 FLOP/byte is below the TPU v5e ridge of 240.5 FLOP/byte, so the HBM bandwidth ceiling is lower. Changing batch or sequence length can change data reuse and operational intensity; recompute the traffic assumptions and measure the actual workload before claiming a bottleneck or speedup.

If this is unfamiliar, work through TPU generations and HBM memory budgeting before attempting the project.

Build in stages

1. Compare TPU generations and budget HBM capacity

Compute the v5e/v5p/v6e ideal ridge points and separate training-state from inference KV-cache bytes. Compare replicated and explicitly sharded per-device ledgers under headroom and temporary/activation assumptions before deriving any conditional minimum chip count.

2. Audit BF16/INT8 precision and capture a warmed XProf trace

Compare BF16 operand/requested-result policies and an INT8 weight-dequantization reference against FP32, inspect returned dtypes and retained CPU compiler IR, and capture a warmed *.xplane.pb trace with its backend recorded.

Try a changed condition

Make a prediction before opening the reasoning. Keep your answer and the evidence you would collect.

At the stated ideal byte count, a BF16 1024-square matmul has about 341.3 FLOP/byte. Compare v5e’s 240.5 ridge with v6e’s 560.4 ridge.

Compare an approach

The operation is above v5e’s ideal intersection and below v6e’s. That selects the lower of theoretical ceilings, not measured bottlenecks or a device ranking. Record actual precision, output bytes and traffic assumptions; validate the hypothesis with target timing and a trace before claiming a speedup.

Diagnose a likely failure

Symptom: A BF16 result differs from a requested FP32 result even when both dots receive the same BF16-rounded operands.

Check next: Compare actual returned dtypes and an explicit FP32-result-to-BF16 cast, then inspect compiler evidence on the named backend. A result dtype or larger output error does not prove that every partial sum used that dtype.

Decide what is ready

Retain the TPU ridge-point and HBM budget tables from tpu-03, plus the BF16/INT8 error summary and *.xplane.pb trace receipt from tpu-06.

Where to put your project code

Write your code in: projects/tpu-systems-audit/starter/model.py (copy projects/tpu-systems-audit/starter/model.py first: cp projects/tpu-systems-audit/starter/model.py projects/tpu-systems-audit/starter/model.py).

Verify your implementation: python3 projects/tpu-systems-audit/tests/check.py --stage all --impl projects/tpu-systems-audit/starter/model.py

Run the staged project checks on your implementation in projects/tpu-systems-audit/starter/model.py and record your transfer experiment results in your portfolio.

Open Estimate optimizer-state bytes and calculate supplied-rate scaling efficiency

Open Operate and recover a local JAX workload

What still needs further work

Use the reviewed execution matrix before staging code on a TPU. CPU-only lesson companions stay on CPU; only source-reviewed targets with matching dependencies and topology should be launched. The retained v5e receipts qualify their named workloads, not every course script or a production model.