LIVE MEASURED · 4× NVIDIA GB200 (NV18) MAGI-2 Preview 114B · cp=4, ep=4 540p · 10s I2V · CFG=2 Packed · N=121,008

MAGI-2 Preview Visualized Trace & TPU v6e Porting Analysis

Captured on vlm-jd-magi2-dev (PyTorch 2.8 / CUDA 13.0) · ⬇ Download Perfetto Trace (.json.gz, 1.6 MB) · ↗ Raw JSON Summary · Open ui.perfetto.dev ↗

Single Preview Denoising Step Breakdown (4,181.3 ms total · 40 Layers · 4×GB200)

Measured with synchronized CUDA events on call #2 (post-warmup, zero profiler overhead). Hover any segment for exact ms and share.

Communication is only 3.0% of step time (127.3 ms):
CP Ulysses All-to-All = 91.8 ms (2.2%) across 40 layers (2.3 ms/layer).
EP Head-Parallel All-to-All = 35.5 ms (0.85%) across 36 MoE layers (0.98 ms/layer).
This empirically validates the static-shape Head Parallel thesis for TPU v6e 2D Torus ICI.
Attention is the #1 bottleneck — 46.1% of time & ~74% of FLOPs:
Packed CFG=2 sequence is 121,008 tokens (60,504 per branch). FlashAttention+Sink takes 1,926 ms (48.2 ms/layer) vs Triton MoE 1,008 ms (28.0 ms/layer).
Total Preview compute ≈ 4.86 PFLOPs/step (486 PFLOPs for 100 base steps).

All 40 Transformer Layers — Per-Layer Time Breakdown

Layers 0, 1, 38, 39 are MM-Dense (~67.8 ms/layer); Layers 2–37 are Multi-Head LatentMoE (~108.5 ms/layer). Notice how uniform every layer is.

Top 20 Raw CUDA Kernels (from torch.profiler Rank 0)

Actual GPU device kernels executing during one full 40-layer Preview forward pass.

Interactive GPU Kernel Timeline — Single Layer Zoom (Real Chrome Trace Spans)

Real microsecond GPU kernel spans extracted directly from trace_preview_call_rank0.json.gz. Switch between Layer 0 (MM-Dense, ~68 ms) and Layer 2 (MoE, ~109 ms) and zoom in/out.

Zoom:

Multi-Head LatentMoE Routing & Expert Load Skew (All 36 MoE Layers)

Captured live on Rank 0 (3 local heads × 256 experts = 768 experts/layer, S_total = 121,008 tokens, top_k = 6). Mean = 2,836 tokens/expert.

MXU Saturation Proven at B=1 (CFG=2):
Average 74.9% of experts receive ≥256 tokens (p50 = 994, p90 = 6,633, mean = 2,836). Single-request 10s video already saturates TPU v6e's 256×256 MXU without large batching.
⚠️ Newly Discovered Porting Trap — Extreme Heavy-Tail Skew (CV = 2.08, Max = 102,982):
Hot experts receive up to 36× the mean load (up to 102,982 tokens!).
• If 1 head stays on 1 TPU chip (local Pallas gmm): zero cross-chip imbalance.
• If a head's 256 experts are sharded across 2–4 chips: do NOT shard naively by expert ID (severe straggler!); shard each expert's d_expert=1280 via TP or use dynamic load-balanced placement.

Op-by-Op Mapping: GB200 Production → Google Cloud TPU v6e (JAX / Pallas)

Directly grounded in our measured 4×GB200 profile (4,181 ms/step, 121,008 tokens) and session-070b2470 v6e architecture.

MAGI-2 ComponentGB200 MeasuredShareTPU v6e Replacement (JAX / Pallas)Risk & Key Insight
FlashAttention + Sink
N=60,504 × 2 CFG, H=24, D=128
1,926.0 ms46.1% Pallas Splash / Ring Attention + 4-line exact LSE sink rescale (logaddexp(lse, sink)) #1 Priority. 74% of total FLOPs! At v6e-16/32/64, Ring Attention over 8-chip X-axis cuts per-chip N to 7,563.
Triton Multi-Head MoE
12 heads × 256 exp, 256→1280→256, SwiGLU7
1,008.0 ms24.1% Pallas Megablox gmm (ragged grouped matmul) + fused SwiGLU7 epilogue #2 Priority. 256 & 1280=5×256 align 100% with v6e 256×256 MXU. Mind CV=2.08 hot-expert skew if sharding inside a head!
Attn QKV / Gate / Out + 3D RoPE 369.1 ms8.8% Standard XLA jnp.einsum / dot_general + fused RoPE Trivial for XLA; fuses cleanly into BF16 MXU ops.
mHC (4-stream Sinkhorn-Knopp) + RMSNorm 310.1 ms7.4% Pure JAX fused XLA kernel (4×4 Sinkhorn unrolled in VPU registers) Currently 310 ms in eager+Triton; XLA fusion on TPU VPU will shrink this significantly.
Shared + Modality Experts + 4 Dense MM 279.0 ms6.7% Standard XLA dense BF16 GEMMs Low risk; zero dynamic shapes.
MoE Router + Top-6 + Global Sort 161.8 ms3.9% XLA jax.lax.top_k + radix/ragged bucket sort for gmm aten::topk alone was 135.5 ms on GPU — watch TPU VPU top-k + argsort cost on 121k×256!
CP Ulysses All-to-All 91.8 ms2.2% XLA static lax.all_to_all on ICI X-axis (or Ring Attention overlap) Tiny overhead (2.2%). Ring Attention on 2D Torus overlaps ICI comm with compute.
EP Head-Parallel All-to-All 35.5 ms0.85% XLA static lax.all_to_all ([S, H, 256] → [S·EP, H/EP, 256]) Validated! 100% static shape, <1% runtime, zero capacity-factor padding waste.
Refiner 3D Block-Window Attention
1080p: 120×68×64 latents, 5 steps
N/A (needs flex-attn)— Pallas Block-Sparse Splash Attention (static 3D grid window mask) Do NOT fall back to Python loop! On TPU, Splash Attention natively takes a static block mask (block_t/h/w_radius=2).