Nested loops to one fused program

Step 1 of 4: Start
THE NAIVE WAY iterations: T × N (1024) TIME: t = 0 … T state carried across T steps AGENT: i = 0 … N one Python op, N lanes ALL AGENTS AT ONCE (VMAP) CARRY STATE THE JAX WAY XLA programs: 1 FUSED JAX EXECUTION VMAP (AGENTS) N LANES SCAN (TIME) T STEPS JIT (COMPILE) XLA 1 COMPILED XLA PROGRAM All loops fused into single GPU kernel ⚡XLA 1. ENV STEP State transitions 2. POLICY FORWARD Action evaluation 3. PPO UPDATE Gradient backprop LOOP BODY OPERATORS * Iteration counts are illustrative. The point is the shape of the computation, not the exact arithmetic.