Roofline
AI Infra Field Notes by Forrest Xi
Everything AI infrastructure: chips, interconnects, compilers, frameworks, training and inference — hands-on notes from hardware to software
-
· 18 min read · reads
Porting and Tuning FastH3 on TPU v6e: a 148 GB Video Model at 1.55x the Performance per Dollar of 4x B200
FastH3 is FastVideo's few-step audio-video model distilled from MiniMax H3. Its weights total about 148 GB, while a TPU v6e chip has 32 GB of HBM. We first got it running on 4 v6e chips (72.4 s per 5-second clip), then moved to 8 chips and brought it down to 18.9 s. At GCP DWS Calendar prices that is 1.55x the performance per dollar of FastVideo's fastest official 4x B200 setup. This is our first post on optimizing the MiniMax H3 family on TPU; the second half covers how the same approach carried over to 15-second clips and a resident service, and where we go next.
-
· 14 min read · reads
Cold Compile Optimization, Part 3: Cross-Rank Reuse for Sequence-Parallel Buckets, 48 Minutes to 17.7
After Hy4 turned on mixed-step sequence parallelism and raised the per-step token budget (max_num_batched_tokens, mnbt) to 8192 to cut time to first token, its cold compile climbed from about 14 minutes back to 48. The root cause: the sequence-parallel slice wrote the rank index into the traced graph. Each of the 16 ranks traced a different program, every rank rejected the others' compiled artifacts, and each rank compiled all five sequence-parallel buckets one after another. Reading the rank at run time from one in-group all_to_all brought cold compile to 18.7 minutes; staggering the sampler-side precompile across ranks and moving artifact saving to a background thread brought it to 17.7, on par with the same recipe without sequence parallelism.
-
· 12 min read · reads
Cold Compile Optimization, Part 2: Cross-DP Compile Reuse for Data-Parallel Deployments on TPU
The cross-rank replay described in the previous post only looks for reusable compiled artifacts within the same DP index. In a pure data-parallel deployment each inference engine has a DP index of its own, so replay never happens. We widened replay to search across DP indices, and for layouts that mix tensor and data parallelism we normalized the process group names in the graph fingerprint. On our self-maintained branch with the same image, the time from weights loaded to service ready dropped from 741 s to 270 s for Qwen3.5 DP8, and from 703 s to 251 s for TP2×DP4.
-
· 10 min read · reads
Hy4 Weight Loading on TPU v7: From 857 Seconds to 68
The official Hy4-preview weights are 757.88 GiB. Deployed across two TPU v7 hosts, loading straight from the original checkpoint took 857 seconds. We analyzed why it was slow: every rank reads the full checkpoint, vLLM skips prefetch for large models, and with multiple hosts prefetch covers only half the files. After switching to a per-rank pre-sharded weight cache and closing two gaps in the upstream loader, load time dropped to 68.5 seconds. This post covers the analysis, the approach and the gains, as well as where this kind of cache fits and what it costs.
-
· 20 min read · reads
From 2 tok/s to Beating B200: Optimizing Hy4 Inference on TPU v7
Hy4-preview is a 770B-parameter MoE model with DSA sparse attention and MTP speculative decoding. When first ported to TPU v7, single-stream decoding ran at only 2 tok/s. In the end, across a ten-level benchmark with 8K input / 1K output at concurrency 1–64, 8 TPU v7 chips delivered 3%–19% higher output throughput than 8 B200 GPUs. This post follows the four classes of bottlenecks in the order we hit them: porting the model and getting it correct, getting the model compiled, speeding up sparse-attention prefill with masked-dense, and optimizing mixed steps under high concurrency.
-
· 12 min read · reads
Beating B200 from Scratch: Porting and Optimizing Hy4 Inference on TPU v7
Hy4-preview is a 770B-parameter MoE model with sparse attention and MTP speculative decoding. We ported it from GPU to TPU v7. In benchmarks with 8K input / 1K output at concurrency 1–64, 8 TPU v7 chips delivered 3%–19% higher output throughput than 8 B200 GPUs. Weight loading dropped from 857 seconds to 68, and cold compile from 95 minutes to about 14. This post summarizes the work on all three fronts, and the tuning engine behind it, Curvature Drive.
-
· 22 min read · reads
Natural Cantonese Voiceover with Gemini 3.8 Flash TTS: Step by Step, and the Pitfalls
We voiced a 30-second tech promo in Cantonese and fixed it one problem at a time: the model read the directions aloud, slipped into Mandarin, spoke its English with an American accent, and said "14 seconds" instead of "14 minutes". This post gives runnable requests for each step, why each step is there, and before/after audio for every pitfall.
-
· 15 min read · reads
95 Minutes to 14: Cold Compile Optimization for Hy4 on TPU v7
TPU programs are compiled per input shape, and with an empty cache Hy4 took 95 minutes to start on TPU v7. Our analysis found that most of the cost was not in the compiler but in the computation graphs fed to it: one grew linearly with the bucket, the other with the number of ranks. After removing both multipliers and letting ranks replay each other's compiled artifacts, cold compile dropped to about 14 minutes. This post covers the analysis, the changes, the gains, the validation before production, and where these methods apply.