TCIM: Triangle Counting Acceleration With Processing-In-MRAM Architecture

Xueyan Wang, Jianlei Yang, Yinglin Zhao, Yingjie Qi, Meichen Liu, Xingzhou Cheng, Xiaotao Jia, Xiaoming Chen, Gang Qu, Weisheng Zhao

Introduction

Triangle counting (TC) is a fundamental operation in graph analysis, essential for calculating clustering coefficients, community detection, and spam filtering. However, as graph sizes scale to millions of nodes and edges, traditional Von-Neumann architectures like CPUs and GPUs encounter a significant "memory wall." The low computation-to-memory ratio and random data access patterns of TC lead to excessive energy consumption and latency due to constant data movement between the processor and memory.

Methodology

To address these bottlenecks, this paper proposes TCIM, a Processing-In-Memory (PIM) accelerator based on Spin-Transfer Torque Magnetic RAM (STT-MRAM). The architecture is built upon three core innovations:

1. Bitwise Triangle Counting Algorithm

The authors demonstrate that for any edge between vertices $i$ and $j$, the number of shared triangles is the bitwise AND of row $i$ and column $j$ of the adjacency matrix, followed by a population count (BitCount). This transformation replaces complex matrix multiplications with simple, bulk logic operations.

Bitwise Triangle Counting Algorithm using in-memory logic.

2. In-Memory Logic Execution

TCIM leverages the physical properties of STT-MRAM to perform these bitwise operations in-situ. By simultaneously activating two word-lines and sensing the resulting current against a reference, the memory array functions as a massive parallel logic gate, eliminating the need to move data to an external CPU.

3. Sparsity-Aware Mapping and Data Slicing

Real-world graphs are inherently sparse. TCIM employs a Data Slicing strategy, partitioning rows and columns into 64-bit chunks. The system identifies and processes only "valid" slices—those containing non-zero data—skipping the vast majority of empty space.

Sparsity-aware data slicing and mapping to the STT-MRAM array.

Furthermore, a Least Recently Used (LRU) strategy is implemented within the data buffer to maximize data reuse and minimize high-latency memory writes.

Experimental Evaluation

The TCIM architecture was evaluated using nine real-world datasets from the SNAP collection, ranging from social networks (e.g., ego-facebook) to large-scale road networks (e.g., roadNet-CA). Performance was benchmarked against high-end CPU, GPU, and FPGA implementations using a device-to-architecture co-simulation framework.

Key Results

  • Computational Efficiency: The sparsity-aware slicing strategy reduced the total number of operations by 99.99%.
  • Memory Optimization: Data reuse strategies successfully avoided 72% of potential memory write operations.
  • Performance Gains: TCIM achieved a 9x speedup over GPU accelerators and a 23.4x speedup over FPGA baselines.
  • Energy Savings: The architecture demonstrated a 20.6x improvement in energy efficiency compared to FPGAs, attributed to reduced data movement and the non-volatile nature of MRAM.

Discussion and Limitations

The success of TCIM stems from the realization that binary adjacency matrices allow for the replacement of mathematical multiplication with bitwise logic, perfectly aligning with PIM capabilities. While the simulation results are promising, the current study is limited by its reliance on high-fidelity models rather than physical hardware. Additionally, scaling to "web-scale" graphs beyond the assumed 16MB MRAM array will require further research into multi-chip communication. Future work will also explore the generalizability of these slicing and mapping techniques to other graph algorithms such as PageRank.

Summary updated

BibTeX
@inproceedings{wang2020tcim,
  author = {Xueyan Wang and Jianlei Yang and Yinglin Zhao and Yingjie Qi and Meichen Liu and Xingzhou Cheng and Xiaotao Jia and Xiaoming Chen and Gang Qu and Weisheng Zhao},
  title = {{TCIM: Triangle Counting Acceleration With Processing-In-MRAM Architecture}},
  booktitle = {DAC},
  year = {2020},
  doi = {10.1109/dac18072.2020.9218660},
}
Figure