Optimizing for Low-Latency Communication in Inference Workloads with JAX and XLA

AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.

Why it matters

NVIDIA shows a custom single-shot all-reduce JAX kernel cutting decode latency 27% on 8-way tensor-parallel Gemma2, a directly reusable technique for teams running multi-GPU LLM inference today.

Read this as

NVIDIA engineers found that in multi-GPU AI inference, the step where small messages get combined across GPUs (called all-reduce) was a major slowdown. They replaced the usual 'ring' method, which passes data in many stages, with a one-step version where all GPUs exchange data at once over their direct connections. They also merged this with nearby math operations into one kernel, the basic unit of GPU work. The result was roughly 3x faster for that operation and 27% faster token generation on an 8-GPU Gemma2 model.

For teams running tensor-parallel LLM inference on NVIDIA hardware, this cuts end-to-end decode latency by about 27% and kernel time by 3x on an 8x H100 Gemma2 setup, using a custom kernel that works with JAX and CUDA Graphs. It's free performance for existing JAX/XLA users but requires writing custom CUDA code. NCCL 2.27's upcoming symmetric memory support may deliver up to 4x faster small-payload communication without custom kernels.

NVIDIA's XLA team replaced ring-based all-reduce (2N-2 stages, ~2x latency penalty at ~30 KB message sizes) with a single-shot all-reduce using bidirectional NVLink exchanges and cudaDeviceEnablePeerAccess to skip memory copies. The kernel fuses all-reduce with RMSNorm and pointwise add, registered via JAX FFI with the kCmdBufferCompatible trait for CUDA Graph compatibility. Results: ~3x kernel speedup, ~27% end-to-end decode latency improvement on 8-way tensor-parallel Gemma2, plus 5% from CUDA Graphs. All-reduce was ~23% of decode latency; NCCL 2.27 symmetric memory promises up to 4x faster small payloads.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

NVIDIA JAX XLA NCCL Gemma2 H100 CUDA Graph

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading