[Paper Review] Minimum Cost Loop Nests for Contraction of a Sparse Tensor with a Tensor Network
This paper presents a framework, SpTTN-Cyclops, that automatically identifies and executes the most efficient loop nest for sparse tensor contraction with a tensor network (SpTTN), leveraging dynamic programming to minimize cost metrics like buffer size and cache misses. It outperforms general-purpose libraries and matches specialized codes by exploiting data-independent sparsity patterns in tensor decomposition and completion workloads.
Sparse tensor decomposition and completion are common in numerous applications, ranging from machine learning to computational quantum chemistry. Typically, the main bottleneck in optimization of these models are contractions of a single large sparse tensor with a network of several dense matrices or tensors (SpTTN). Prior works on high-performance tensor decomposition and completion have focused on performance and scalability optimizations for specific SpTTN kernels. We present algorithms and a runtime system for identifying and executing the most efficient loop nest for any SpTTN kernel. We consider both enumeration of such loop nests for autotuning and efficient algorithms for finding the lowest cost loop-nest for simpler metrics, such as buffer size or cache miss models. Our runtime system identifies the best choice of loop nest without user guidance, and also provides a distributed-memory parallelization of SpTTN kernels. We evaluate our framework using both real-world and synthetic tensors. Our results demonstrate that our approach outperforms available generalized state-of-the-art libraries and matches the performance of specialized codes.
Motivation & Objective
- To address the performance bottleneck in tensor decomposition and completion, where sparse tensor contractions with dense tensor networks (SpTTN) are the dominant computational kernel.
- To automate the selection of the most efficient loop nest for SpTTN kernels without user guidance, overcoming the combinatorial explosion of possible loop orders.
- To enable high-performance, scalable, and portable SpTTN execution through a generalized, autotuned framework that integrates with existing high-performance tensor libraries.
- To match or exceed the performance of hand-optimized, specialized codes by exploiting data-independent sparsity and enabling efficient use of BLAS kernels.
Proposed method
- Represents loop nests as trees, where each node is a loop and its children are nested loops, enabling structured cost modeling.
- Applies dynamic programming to search the exponential space of loop orders efficiently, reducing complexity from O((m!)^N) to O(N^3 2^m m).
- Develops cost models for key performance bottlenecks—buffer size and cache misses—based on the loop nest tree structure.
- Integrates with the CTF runtime system to enable distributed-memory parallelization of SpTTN kernels.
- Automatically selects loop orders that minimize cost functions while enabling high-level use of BLAS-1 and BLAS-2 kernels for performance.
- Extends the Cyclops Tensor Framework to support simultaneous contraction of a single sparse tensor with multiple dense tensors in a tensor network.
Experimental results
Research questions
- RQ1What is the optimal loop nest structure for a given SpTTN kernel that minimizes memory footprint and cache misses?
- RQ2Can dynamic programming be used to efficiently explore the vast space of loop order permutations for SpTTN kernels without exhaustive enumeration?
- RQ3How does the performance of automatically generated loop nests compare to hand-optimized, specialized implementations in tensor decomposition and completion workloads?
- RQ4What is the impact of intermediate tensor dimension bounds on loop nest efficiency and BLAS kernel utilization?
- RQ5Can a generalized framework achieve performance comparable to specialized codes while remaining portable across diverse SpTTN kernels?
Key findings
- SpTTN-Cyclops achieves a 534x speedup over TACO on a small, highly sparse tensor (N=40, sparsity 0.1%), demonstrating significant performance gains in low-dimensional regimes.
- The framework outperforms general-purpose libraries like TACO and SparseLNR across a range of real-world and synthetic SpTTN kernels.
- A loop nest with intermediate tensors bounded to size T and S×T outperforms one with scalar intermediates, despite higher memory usage, due to better utilization of BLAS-1 and BLAS-2 kernels.
- The loop order selected by SpTTN-Cyclops achieves the highest performance among 25% of randomly sampled loop orders, indicating effective autotuning.
- The framework matches the performance of specialized codes for MTTKRP, TTMc, and TTTP kernels, validating its generality and efficiency.
- The use of dynamic programming reduces the search space complexity from factorial to polynomial, enabling practical autotuning of SpTTN loop nests.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.