Deinsum: Practically I/O Optimal Multi-Linear Algebra

Alexandros Nikolaos Ziogas, Grzegorz Kwasniewski, Tal Ben-Nun, Timo Schneider, Torsten Hoefler

TL;DR

Deinsum is a new framework that automatically generates highly efficient distributed code for complex multilinear algebra operations expressed in Einstein notation. It achieves this by rigorously deriving communication-optimal schedules, leading to significant performance improvements (up to 19x) over existing state-of-the-art libraries.

What Problem Does This Paper Address?

Modern scientific computing, from physics to machine learning, relies heavily on linear and multilinear algebra kernels. As datasets and models grow, the performance of these kernels on massively parallel systems is increasingly limited by data movement (I/O) rather than raw computational power. Deriving optimal schedules for these operations, especially those involving high-dimensional tensors (multilinear algebra), is incredibly challenging. Existing libraries often resort to heuristics or suboptimal approaches, leaving significant performance on the table. This paper tackles the problem of automatically generating communication-optimal distributed schedules for multilinear algebra computations expressed in Einstein notation, bridging the gap between theoretical bounds and practical performance.

Methods

Deinsum employs a multi-stage pipeline:

  1. Decomposition: It first breaks down complex Einstein notation expressions into a sequence of associative binary operations. This step aims to expose opportunities for reducing arithmetic complexity.
  2. Intermediate Representation & I/O Lower Bound: The framework then uses a data-centric intermediate representation to extract iteration spaces and data access patterns. Crucially, it applies a rigorous mathematical model (based on Kwasniewski et al.'s SOAP framework) to derive tight I/O lower bounds for these operations. This model accounts for data reuse and communication minimization.
  3. Communication-Optimal Scheduling: Based on the derived I/O lower bounds, Deinsum generates communication-optimal parallel schedules. This involves determining optimal tiling strategies and data distribution across processes.
  4. Automated Code Generation: Finally, the framework automatically generates high-performance distributed code (using MPI) and data distribution routines, ready for execution on distributed memory machines.

A key innovation is the application of a combinatorial data access model to derive provably communication-optimal schedules, particularly for complex kernels like Matricized Tensor Times Khatri-Rao Products (MTTKRP).

Datasets

The paper does not introduce new datasets. Instead, it uses a set of well-defined tensor operations as benchmarks, including:

  • Matrix-Matrix Products (1MM, 2MM, 3MM)
  • Matricized Tensor Times Khatri-Rao Products (MTTKRP) for various orders and configurations.
  • Tensor Times Matrix Chains (TTMc).

These benchmarks are executed on the Piz Daint supercomputer.

Key Insights and Ideas

  • I/O is the Bottleneck: The paper strongly reinforces the idea that for large-scale multilinear algebra, data movement, not computation, dictates performance.
  • Rigorous Mathematical Foundation: Deinsum's strength lies in its grounding in a formal mathematical model for data movement analysis, allowing it to derive provably optimal schedules, not just heuristically good ones.
  • MTTKRP Optimization: The paper presents a new, tight parallel I/O lower bound for MTTKRP, showing that common GEMM-like parallel decompositions are suboptimal. Their new tiling scheme offers significant communication reduction.
  • Automated Complexity: The framework automates a highly complex process that would otherwise require expert knowledge, making advanced optimizations accessible.
  • Bridging Theory and Practice: Deinsum successfully translates theoretical I/O lower bounds into tangible performance gains, demonstrating the practical impact of rigorous analysis.

Key Results

  • Up to 19x Speedup: Deinsum achieved speedups of up to 19x over the state-of-the-art Cyclops Tensor Framework (CTF) on 512 nodes of the Piz Daint supercomputer.
  • Improved MTTKRP Lower Bound: The framework provides an MTTKRP I/O lower bound that is over 6x better than previously known results.
  • Consistent Performance: Across various benchmarks, including matrix multiplications and higher-order tensor operations, Deinsum consistently outperformed CTF, with a geometric mean speedup of 4.18x.
  • Scalability: The framework demonstrates strong scaling capabilities on large distributed systems.

Limitations and Future Work

  • Dense Tensors: The current data movement model assumes dense tensors. The authors mention that the model can be extended to sparse data structures using probabilistic methods, but this is not implemented in the current work.
  • Generalizability: While the framework handles arbitrary einsum strings, the performance gains are most pronounced for complex multilinear algebra kernels.
  • Future Work: The authors suggest extending the framework to handle sparse tensors and exploring more complex tensor decompositions and operations. They also highlight the potential for further optimization through techniques like loop fusion and more advanced redistribution strategies.

Summary updated

BibTeX
@inproceedings{ziogas2022deinsum,
  author = {Alexandros Nikolaos Ziogas and Grzegorz Kwasniewski and Tal Ben-Nun and Timo Schneider and Torsten Hoefler},
  title = {{Deinsum: Practically I/O Optimal Multi-Linear Algebra}},
  booktitle = {SC},
  year = {2022},
  doi = {10.1109/sc41404.2022.00030},
}
Figure