techlist.io

Tensor Parallelism

2 posts

Meta2026-02-243 min readCurated summary

RCCLX: Innovating GPU communications on AMD platforms

RCCLX is Meta’s open-source enhancement of RCCL for AMD GPUs, integrated with Torchcomms to support portable distributed AI workloads. It introduces Direct Data Access (DDA) and low-precision collectives, targeting communication bottlenecks in inference and training. On AMD MI300X systems, these optimizations deliver lower latency and higher throughput while maintaining acceptable accuracy. ## RCCLX and Torchcomms Integration - RCCLX is based on RCCL and tested on Meta’s internal workloads. - It integrates CTran transport technology for AMD platforms. - CTran enables features such as `AllToAllvDynamic`, a GPU-resident collective; additional CTran capabilities are planned for future releases. - Through Torchcomms, applications can use a common communication API across AMD, NVIDIA, and other backends without major code changes. - RCCLX is intended to achieve feature parity with Meta’s NCCLX backend for NVIDIA systems. ## Direct Data Access for Intra-Node Collectives - LLM inference has two distinct phases: - **Prefill** is compute-bound and generates the model’s key-value cache. - **Decoding** is memory-bound and generates tokens incrementally. - Tensor parallelism can make AllReduce responsible for up to 30% of end-to-end latency. - RCCLX introduces two DDA algorithms: - **DDA flat** lets each rank directly read other ranks’ memory and perform local reductions. It reduces latency from O(N) to O(1) for small messages by increasing data exchange from O(n) to O(n²). - **DDA tree** divides AllReduce into reduce-scatter and all-gather phases, retaining ring-like data movement while reducing latency for somewhat larger messages. - On AMD MI300X GPUs, DDA improves over RCCL by: - 10–50% for decode workloads. - 10–30% for prefill workloads. - Approximately 10% lower time-to-incremental-token. ## Low-Precision Collectives - RCCLX provides optimized low-precision versions of AllReduce, AllGather, AlltoAll, and ReduceScatter. - These target AMD Instinct MI300 and MI350 GPUs and support FP32 and BF16 inputs. - FP8 quantization provides up to 4:1 compression, reducing communication overhead for messages of at least 16 MB. - Parallel peer-to-peer mesh communication uses AMD Infinity Fabric for bandwidth and low latency. - Computation remains in FP32 to improve numerical stability. - Users can enable the feature with: ```bash RCCL_LOW_PRECISION_ENABLE=1 ``` - Internal evaluations showed: - About a 0.3% change on GSM8K accuracy evaluations. - 9–10% lower latency. - Approximately 7% higher throughput. - The current implementation is tuned for single-node deployments. ## Getting Started - Install Torchcomms with the RCCLX backend. - Create an RCCLX communicator through Torchcomms using the `"rcclx"` backend and a HIP device. - Existing Torchcomms operations such as `allreduce` can then run without backend-specific API changes. - Distributed initialization uses standard `torchrun` environment variables such as `MASTER_ADDR`, `MASTER_PORT`, `RANK`, and `WORLD_SIZE`. RCCLX is positioned as a practical way to improve AMD-based AI training and inference without requiring applications to adopt a new communication API. Teams can use DDA for lower inference latency and selectively enable low-precision collectives for higher throughput, while evaluating numerical accuracy for their own workloads.

OpenAI2022-06-084 min readCurated summary

Techniques for training large neural networks

# Techniques for Training Large Neural Networks Training large neural networks requires coordinating many GPUs to perform a single synchronized calculation, and practitioners have developed several ways to parallelize that work. Viewed with a few simplifying assumptions, these techniques reduce to moving opaque chunks of data between devices. The post surveys the main approaches, from data and pipeline parallelism to tensor parallelism and Mixture-of-Experts, along with memory-saving methods that make very large models feasible to train. ## The Basic Training Loop Each training iteration runs a forward pass to compute outputs for a batch, then a backward pass to compute a gradient for each parameter. An optimizer such as Adam uses the averaged gradients and its per-parameter state to produce the next set of parameters. Parallelism techniques divide this process along different dimensions. ## Data Parallelism - Each GPU (worker) holds a full copy of the parameters and processes a different subset of the batch. - The model must still fit in a single GPU's memory, and parameters are duplicated on every device. - Workers synchronize by averaging gradients each step, which requires transferring data proportional to the number of workers times the parameter size. - Asynchronous schemes reduce this communication overhead but hurt learning efficiency, so synchronous training is the common choice. ## Pipeline Parallelism - The model is split into consecutive groups of layers, with each GPU holding only a fraction of the parameters. - A naive implementation leaves workers idle while they wait for upstream outputs, creating "bubbles." - Splitting each batch into microbatches lets workers start on the next microbatch as soon as it is ready, which shrinks the bubbles. - Only activations (forward) and their gradients (backward) move between neighboring stages. - GPipe runs forward and backward passes consecutively and aggregates gradients synchronously at the end, while PipeDream alternates forward and backward passes. ## Tensor Parallelism - Individual operations within a layer, especially large matrix multiplications, are split across GPUs. - Weight matrices are sharded so each GPU computes part of the product, and the results are then combined through communication. - Megatron-LM applies this to the self-attention and MLP layers of Transformers. - PTD-P combines tensor, data, and pipeline parallelism, assigning multiple non-consecutive layers to each device to reduce bubble overhead at the cost of more communication. - Sequence parallelism splits an input sequence across time into sub-examples, lowering peak memory use. ## Mixture-of-Experts - Only a fraction of the network is activated for each input, with a gating mechanism choosing which expert weight sets to use. - This increases the total parameter count without a proportional increase in computation. - Different experts can be placed on different GPUs, giving a natural way to scale across hardware. - GShard scales an MoE Transformer to 600 billion parameters by splitting only the MoE layers across devices, while Switch Transformer routes each input to a single expert and reaches trillions of parameters. ## Memory-Saving Techniques - **Checkpointing (activation recomputation):** Stores only a subset of activations and recomputes the rest during the backward pass, costing at most one extra forward pass. Selective recomputation targets activations that are expensive to store but cheap to recompute. - **Mixed precision training:** Uses lower-precision formats such as FP16 to increase throughput and reduce memory, with little loss in accuracy when done carefully. - **Offloading:** Moves unused data to CPU memory or other devices and prefetches it back before it is needed. ZeRO partitions parameters, gradients, and optimizer states across all hardware. - **Memory-efficient optimizers:** Adafactor reduces the memory footprint of optimizer state. - **Compression:** Gist compresses activations saved for the backward pass, and DALL·E compresses gradients before synchronization. These strategies are typically combined in practice, since each addresses a different bottleneck in compute, communication, and memory.