Abstract
Distributed tensor algebra is a cornerstone of modern high-performance computing (HPC), yet implementing these operations efficiently across large-scale clusters remains a significant challenge. Developers are often forced to choose between rigid, hand-tuned libraries and flexible but sub-optimal general frameworks. This paper presents DISTAL, a compiler for distributed tensor algebra that decouples the mathematical specification of a tensor operation from its data distribution and execution schedule. By providing a high-level language to describe data movement and computation mapping, DISTAL enables the generation of kernels that match or exceed the performance of state-of-the-art specialized libraries while maintaining the flexibility to support a wide array of tensor operations.
Introduction
As computational demands in fields like machine learning and physical simulations grow, the need for efficient tensor algebra on distributed systems has become critical. However, the complexity of managing data partitioning, inter-node communication, and hardware heterogeneity (CPUs vs. GPUs) creates a "design space explosion." Programmers must navigate an overwhelming number of ways to distribute work across a cluster, where the optimal strategy often depends on the specific hardware architecture and the dimensions of the tensors involved.
Existing solutions typically fall into two categories: specialized libraries like COSMA or ScaLAPACK, which are highly optimized for specific operations (like matrix multiplication) but cannot be easily extended to new tensor kernels; and general frameworks like the Cyclops Tensor Framework (CTF), which offer flexibility but often rely on generic distribution strategies that fail to achieve peak hardware performance. DISTAL bridges this gap by extending the TACO (Tensor Algebra COmpiler) framework to support distributed execution through a decoupled, programmable approach.
The DISTAL Framework
DISTAL’s core innovation is the separation of concerns through three distinct sub-languages, allowing developers to optimize kernels without rewriting the underlying mathematical logic.
1. Tensor Index Notation
This layer describes the mathematical operation itself using a simple, declarative syntax. For example, a standard matrix multiplication is represented as $A(i,j) = B(i,k) \cdot C(k,j)$. This notation is agnostic to how the data is stored or where the computation occurs.
2. Tensor Distribution Notation
This language allows developers to describe how data is partitioned across a hierarchical grid of processors. It supports complex layouts, such as partitioning a matrix into rows, columns, or 2D/3D tiles, ensuring that the data layout can be tailored to the specific communication constraints of the network.
3. Scheduling Language
DISTAL introduces three novel scheduling primitives that give developers fine-grained control over execution:
distribute: Maps specific loop iterations to processors within the cluster.communicate: Controls the granularity of data movement, enabling the aggregation of messages to reduce network overhead.rotate: Enables "systolic" communication patterns, where data is shifted between neighboring nodes. This allows DISTAL to express classic algorithms, such as Cannon’s algorithm, without requiring manual message-passing code.
These high-level descriptions are lowered into the Legion runtime system, which manages the low-level task scheduling and data movement across the cluster.
Experimental Evaluation
The authors evaluated DISTAL on the Lassen supercomputer, utilizing up to 256 nodes, each equipped with 40 IBM Power9 CPU cores and 4 NVIDIA V100 GPUs. The benchmarks focused on both standard matrix multiplication (GEMM) and higher-order kernels, including Tensor-Times-Vector (TTV), Tensor-Times-Matrix (TTM), and Matricized Tensor Times Khatri-Rao Product (MTTKRP).
Key Results
- Performance Parity with Hand-Tuned Code: For matrix multiplication, DISTAL achieved performance within 5% of COSMA, the current state-of-the-art specialized library. It outperformed other established libraries like ScaLAPACK and CTF by at least 1.25x.
- Superior Generality: On higher-order tensor operations, DISTAL demonstrated its strength by outperforming CTF by 1.8x to 3.7x. In one notable case, DISTAL was 45.7x faster than CTF because its flexible scheduling allowed it to avoid expensive, unnecessary data reshuffling that the more rigid framework required.
- Scalability: The system showed excellent weak scaling, maintaining high efficiency as both the problem size and the number of GPUs (up to 1024) increased.
Discussion and Limitations
DISTAL demonstrates that a compiler-based approach can achieve the performance of hand-optimized code while offering the flexibility of a general framework. By treating the machine as a hierarchy (e.g., nodes containing grids of GPUs), DISTAL can optimize for fast intra-node interconnects like NVLink differently than slower inter-node networks.
However, some limitations remain. Currently, DISTAL focuses exclusively on dense tensor algebra. While the underlying TACO framework is designed for sparse tensors, extending DISTAL’s distributed logic to sparse data is a subject for future research. Additionally, the use of the Legion runtime introduces a small performance overhead (5-10%) compared to pure MPI implementations. Finally, while DISTAL simplifies the implementation of distributed algorithms, it still requires a performance engineer to manually specify the schedule. Future work into auto-scheduling could further lower the barrier to entry for high-performance distributed computing.
Conclusion
DISTAL provides a powerful new tool for the HPC community, proving that decoupling data distribution from mathematical expression is a viable path toward high-performance, general-purpose tensor algebra. It matches the performance of the world's fastest specialized libraries while providing the expressivity needed for the next generation of complex computational kernels.
Summary updated