TACCL: Guiding Collective Algorithm Synthesis using Communication Sketches

Aashaka Shah, Vijay Chidambaram, Meghan Cowan, Saeed Maleki, Madan Musuvathi, Todd Mytkowicz, Jacob Nelson, Olli Saarikivi, Rachee Singh · DOI

Abstract

Machine learning models are increasingly being trained across multiple GPUs and servers. In this setting, data is transferred between GPUs using communication collectives such as AlltoAll and AllReduce, which can become a significant bottleneck in training large models. Thus, it is important to use efficient algorithms for collective communication. We develop TACCL, a tool that enables algorithm designers to guide a synthesizer into automatically generating algorithms for a given hardware configuration and communication collective. TACCL uses a novel communication sketch abstraction to get crucial information from the designer to significantly reduce the search space and guide the synthesizer towards better algorithms. TACCL also uses a novel encoding of the problem that allows it to scale beyond single-node topologies. We use TACCL to synthesize algorithms for three collectives and two hardware topologies: DGX-2 and NDv2. We demonstrate that the algorithms synthesized by TACCL outperform the Nvidia Collective Communication Library (NCCL) by up to 6.7x. We also show that TACCL can speed up end-to-end training of Transformer-XL and BERT models by 11%--2.3x for different batch sizes.

Introduction

As machine learning models grow to hundreds of billions of parameters, they no longer fit on a single GPU. Training requires distributing models across dozens or hundreds of GPUs, which necessitates "collective communication"—operations like AllReduce (summing gradients) or AllToAll (shuffling data).

Visualizations of common collective communication patterns: AllGather, AllToAll, and AllReduce.

Currently, libraries like the Nvidia Collective Communication Library (NCCL) rely on hand-optimized, generic templates such as "Ring" or "Tree" algorithms. However, these templates often fail to account for the specific, heterogeneous interconnects of modern hardware, such as fast NVLinks versus slower InfiniBand. While automated synthesis of better algorithms is a promising direction, the problem is NP-hard. Previous synthesis tools struggled to scale beyond a single node (8 GPUs) because the search space for routing and scheduling data chunks is mathematically astronomical.

The TACCL Framework

The core innovation of TACCL is the Communication Sketch. Instead of requiring the system to find an algorithm from scratch, a human designer provides a "sketch"—a set of high-level constraints and intuitions that prune the search space.

The TACCL synthesis pipeline, showing the transition from sketches and topology to a final algorithm implementation.

The TACCL pipeline consists of three main steps to manage complexity:

  1. Routing: A relaxed Mixed Integer Linear Program (MILP) finds the best paths for data chunks based on a logical topology and switch-hyperedge abstractions.
  2. Heuristic Ordering: A greedy algorithm determines the sequence in which chunks should move across links.
  3. Contiguity & Scheduling: A final MILP groups chunks together to minimize latency overhead, utilizing an $\alpha-\beta$ cost model that profiles hardware for latency and bandwidth.

By allowing human-in-the-loop guidance, TACCL can collapse the search space from "impossible" to "solvable in minutes." For instance, a designer can specify a logical topology that restricts communication to specific high-performance links, avoiding contention.

Evaluation and Results

TACCL was evaluated on two major hardware configurations: the Nvidia DGX-2 (16 V100 GPUs via NVSwitch) and Azure NDv2 (8-GPU nodes via InfiniBand). The synthesized algorithms were benchmarked against NCCL (v2.8.4).

Performance Benchmarks

On the DGX-2, TACCL's AllGather implementation was up to 6.7x faster than NCCL for small-to-moderate data sizes. On Azure NDv2, AllToAll performance improved by up to 66%. Furthermore, TACCL demonstrated remarkable scalability, synthesizing an AllGather algorithm for an 80-GPU cluster in under 8 minutes—a task previously impossible for synthesis tools.

End-to-End Model Training

The raw communication speedups translated into significant gains in end-to-end training throughput:

  • BERT: Achieved a 2.36x speedup depending on batch size.
  • Transformer-XL: Showed speedups ranging from 11% to 1.94x on 2 nodes.
  • Mixture-of-Experts (MoE): Demonstrated a 17% improvement in overall throughput.

Conclusion and Future Work

TACCL demonstrates that guiding automated synthesis with human intuition can produce communication algorithms that significantly outperform industry standards. While synthesis for massive clusters (128+ GPUs) still requires significant time, the approach offers a path forward for optimizing large-scale distributed training. Future work includes supporting low-level hardware tricks like instruction fusion and developing hierarchical composition methods to scale to thousands of GPUs.

Summary updated

BibTeX
@misc{shah2021taccl,
  author = {Aashaka Shah and Vijay Chidambaram and Meghan Cowan and Saeed Maleki and Madan Musuvathi and Todd Mytkowicz and Jacob Nelson and Olli Saarikivi and Rachee Singh},
  title = {{TACCL: Guiding Collective Algorithm Synthesis using Communication Sketches}},
  year = {2021},
  eprint = {2111.04867},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.04867},
}
Figure