Abstract
Sparse Matricized Tensor Times Khatri-Rao Product (spMTTKRP) is the bottleneck kernel of sparse tensor decomposition. In tensor decomposition, spMTTKRP is performed iteratively along all the modes of an input tensor. In this work, we propose a mode-specific tensor layout on GPU that uses multiple tensor copies, where each copy is optimized for a specific mode. The proposed tensor layout increases the data locality of external memory accesses and eliminates the intermediate values communicated between the GPU thread blocks and the GPU global memory. We also propose a tensor partitioning scheme to optimally distribute the total computations among GPU streaming multiprocessors based on the sparsity and the dimensions of the input tensor. Our approach achieves a geometric mean speedup of 2.4x, 7.9x, and 8.9x in total execution time compared with the state-of-the-art GPU baselines.
Introduction
Tensor decomposition, specifically Canonical Polyadic Decomposition (CPD), is a critical technique for identifying latent structures in multi-dimensional data, with applications spanning signal processing, cyber security, and medicine. The primary computational bottleneck in CPD is the Sparse Matricized Tensor Times Khatri-Rao Product (spMTTKRP). Accelerating this kernel on GPUs is challenging due to the irregular memory access patterns of sparse data, load imbalances across Streaming Multiprocessors (SMs), and the high communication overhead required to move intermediate values between fast on-chip memory and slower global memory. This work addresses these challenges for "small" tensors—those whose matricized copies can fit within the GPU's global memory (typically up to 24GB).
Proposed Methods
We introduce two primary architectural and algorithmic innovations to optimize spMTTKRP performance.
1. Mode-Specific Tensor Layout
In CPD, tensors are processed iteratively along different dimensions, or "modes." Traditional approaches often rely on a single compressed format for all modes, leading to inefficient access patterns. We propose storing multiple copies of the tensor, each formatted specifically for a single mode. This redundancy ensures high data locality and, crucially, allows the elimination of intermediate value communication to global memory. By keeping calculations within the fast L1 cache and registers of the thread block, we significantly reduce memory latency.
2. Adaptive Load Balancing Scheme
The optimal distribution of work across GPU cores depends heavily on the tensor's specific dimensions and sparsity. We developed an adaptive scheme that selects between two strategies:
- Scheme 1 (Equal Distribution of Indices): Employed when the number of output indices exceeds the number of SMs, minimizing expensive global atomic operations.
- Scheme 2 (Equal Distribution of Elements): Employed for small dimensions to ensure maximum SM utilization, even if global atomics are required for synchronization.
Experimental Results
We evaluated our approach using the FROSTT dataset, including tensors such as Chicago (crime data), Enron (emails), and Nell-1 (knowledge base). The proposed method was compared against three state-of-the-art baselines: BLCO, MM-CSF, and ParTI-GPU.
Our approach achieved geometric mean speedups of 2.4×, 7.9×, and 8.9× respectively in total execution time. As shown in Figure 4, the adaptive load balancing scheme alone provided a 1.3× to 2.2× speedup compared to using static balancing schemes. Furthermore, our implementation demonstrated superior scalability, handling 5-mode tensors like Vast without the performance degradation or compatibility issues observed in some baselines.
Conclusion
By leveraging the increased memory capacity of modern GPUs to store redundant, mode-optimized tensor copies, we can effectively transform global memory bottlenecks into high-speed on-chip operations. This approach provides substantial speedups for small-to-medium tensors commonly found in real-world applications. Future research will explore extending these parallelization strategies to CPUs and FPGAs to determine if the benefits of mode-specific layouts are consistent across different memory hierarchies.
Summary updated