Abstract
Sparse tensor decomposition is a fundamental tool for extracting patterns from high-dimensional data, yet its performance is often bottlenecked by the Sparse Matricized Tensor Times Khatri-Rao Product (spMTTKRP). Traditional optimization strategies face a trade-off between massive memory replication and poor cache locality. This paper introduces Dynasor, a novel algorithm and memory layout that utilizes dynamic tensor remapping to achieve high-performance spMTTKRP on multi-core CPUs. By rearranging tensor data on-the-fly and utilizing cache-aware partitioning, Dynasor achieves significant speedups (up to 9.01×) over state-of-the-art methods while maintaining a minimal memory footprint.
Introduction
Tensor decomposition serves as a multi-dimensional generalization of Principal Component Analysis (PCA), enabling the discovery of latent structures in complex datasets ranging from social networks to signal processing. As real-world tensors grow in size and sparsity, the computational efficiency of the Sparse Matricized Tensor Times Khatri-Rao Product (spMTTKRP) becomes the primary bottleneck.
Existing CPU-based implementations typically adopt one of two suboptimal strategies. The first involves replicating the tensor for every mode (dimension), which leads to a "memory explosion" that limits the scale of problems that can be solved. The second involves using a single storage format, which inevitably results in irregular memory access patterns for most modes, forcing the CPU to stall while waiting for data from DRAM. Dynasor addresses these challenges by introducing a dynamic remapping technique that provides the performance of replication with the memory efficiency of a single format.
The Dynasor Architecture
Dynasor adapts the FLYCOO format—originally designed for FPGAs—for modern multi-core CPU architectures. The system is built upon three technical pillars:
1. Dynamic Tensor Remapping
Rather than storing $N$ static copies of a tensor for $N$ modes, Dynasor stores only the current mode and prepares the subsequent mode dynamically. While the CPU computes the results for mode $n$, it simultaneously rearranges tensor elements in memory to ensure they are perfectly ordered for mode $n+1$. This approach is based on the insight that the computational cost of reordering data in-cache is significantly lower than the latency penalties incurred by irregular DRAM access.
2. Super-shard Partitioning
To maximize cache efficiency, Dynasor divides the tensor into "super-shards." These partitions are sized to fit within the CPU’s L3 cache. By ensuring that both the tensor elements and the associated factor matrices remain in the cache during computation, Dynasor drastically reduces the frequency of slow trips to external memory.
3. Lock-free Parallelism
Parallel efficiency is often hampered by synchronization overhead. Dynasor employs a static scheduling scheme that assigns specific super-shards to individual CPU threads. Because each thread operates on a unique set of output indices, the implementation eliminates the need for expensive atomic operations or locks, allowing for near-linear scaling on many-core systems.
Experimental Evaluation
The authors evaluated Dynasor using five diverse sparse tensors from the FROSTT repository, including Nell-1, Nell-2, Flickr, Delicious, and Vast. These datasets represent a wide spectrum of sparsity and dimensionality, providing a rigorous benchmark for the algorithm's versatility.
Performance and Scalability
Dynasor demonstrated an average speedup of 6.37× across all tested ranks and datasets. On Intel platforms, it outperformed state-of-the-art baselines by up to 9.01×, with even higher performance gains observed on AMD architectures. On a 56-core machine, the algorithm achieved scaling factors between 8.5× and 21× compared to single-threaded execution.
Memory Resilience
One of Dynasor's most significant advantages is its stability. While competing formats like ALTO or HiCOO often encounter Out-of-Memory (OOM) errors as the decomposition rank ($R$) increases, Dynasor maintains a consistent and small memory footprint. The overhead associated with dynamic remapping was found to be consistently below 15% of total data traffic, a negligible cost relative to the performance gains in data locality.
Conclusion
Dynasor proves that integrated data movement and computation can overcome the traditional memory-performance trade-off in sparse tensor operations. By keeping data "hot" in the cache through on-the-fly remapping, it provides a scalable and robust solution for large-scale tensor decomposition. Future research will focus on optimizing the initial tensor ordering (currently based on Z-Morton curves) and extending the Dynasor logic to GPU and heterogeneous computing environments.
Summary updated