Skip to main content
QUICK REVIEW

[Paper Review] A High-Performance Sparse Tensor Algebra Compiler in Multi-Level IR

Ruiqin Tian, Luanzheng Guo|arXiv (Cornell University)|Feb 9, 2021
Parallel Computing and Optimization TechniquesComputer Science65 references10 citations
TL;DR

COMET is a high-performance sparse tensor algebra compiler built on MLIR that uses a domain-specific language with Einstein notation-like abstractions to automatically generate optimized kernels for mixed sparse-dense tensor operations. It supports multiple storage formats via four dimension attributes and employs data reordering to improve locality, achieving up to 20.92x speedup over TACO in SpMV, 6.39x in SpMM, and 13.9x in TTM.

ABSTRACT

Tensor algebra is widely used in many applications, such as scientific computing, machine learning, and data analytics. The tensors represented real-world data are usually large and sparse. There are tens of storage formats designed for sparse matrices and/or tensors and the performance of sparse tensor operations depends on a particular architecture and/or selected sparse format, which makes it challenging to implement and optimize every tensor operation of interest and transfer the code from one architecture to another. We propose a tensor algebra domain-specific language (DSL) and compiler infrastructure to automatically generate kernels for mixed sparse-dense tensor algebra operations, named COMET. The proposed DSL provides high-level programming abstractions that resemble the familiar Einstein notation to represent tensor algebra operations. The compiler performs code optimizations and transformations for efficient code generation while covering a wide range of tensor storage formats. COMET compiler also leverages data reordering to improve spatial or temporal locality for better performance. Our results show that the performance of automatically generated kernels outperforms the state-of-the-art sparse tensor algebra compiler, with up to 20.92x, 6.39x, and 13.9x performance improvement, for parallel SpMV, SpMM, and TTM over TACO, respectively.

Motivation & Objective

  • Address the challenge of manually optimizing sparse tensor kernels across diverse storage formats and architectures.
  • Enable high-productivity programming for tensor algebra operations using a DSL that resembles Einstein notation.
  • Provide performance portability and extensibility through integration with the MLIR framework.
  • Support efficient code generation for mixed sparse-dense tensor operations across a wide range of storage formats.
  • Improve data locality and performance through automated data reordering techniques in the compilation pipeline.

Proposed method

  • Design a domain-specific language (DSL) that supports high-level tensor algebra expressions using Einstein notation-like syntax.
  • Build the compiler on MLIR’s multi-level intermediate representation (IR) to decouple domain-specific optimizations from architecture-specific ones.
  • Represent tensor storage formats using four dimension attributes: dense, compressed unique, compressed non-unique, and singleton.
  • Implement a code generation algorithm that analyzes dimension attributes to produce efficient, format-aware kernels for nonzero element iteration.
  • Integrate a data reordering algorithm to enhance spatial and temporal locality during kernel generation.
  • Apply architecture-agnostic optimizations at higher IR levels and low-level register/memory optimizations at lower levels within MLIR’s hierarchy.

Experimental results

Research questions

  • RQ1How can a tensor algebra compiler be designed to support a broad range of sparse tensor storage formats while maintaining high performance?
  • RQ2To what extent can a DSL based on Einstein notation improve programmer productivity in sparse tensor computation?
  • RQ3Can MLIR-based compilation enable performance portability and extensibility across diverse architectures and formats?
  • RQ4How effective is automated data reordering in improving data locality and kernel performance for sparse tensor operations?
  • RQ5What performance gains can be achieved over existing compilers like TACO for key sparse tensor kernels such as SpMV, SpMM, and TTM?

Key findings

  • COMET achieves up to 20.92x performance improvement over TACO in sparse matrix-vector multiplication (SpMV) on CPU.
  • COMET demonstrates a 6.39x performance gain over TACO in sparse tensor-matrix multiplication (SpMM) on CPU.
  • COMET outperforms TACO by 13.9x in tensor transmutation (TTM) operations on CPU.
  • The use of data reordering significantly improves data locality, contributing to the observed performance gains.
  • The compiler’s format-agnostic design via four dimension attributes enables support for common formats like COO, CSR, DCSR, ELLPACK, CSF, and mode-generic without hardcoding each combination.
  • The MLIR-based architecture enables modular, extensible, and portable compilation, facilitating future support for heterogeneous architectures like GPUs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.