PyGim: An Efficient Graph Neural Network Library for Real Processing-In-Memory Architectures

Christina Giannoula, Peiming Yang, Ivan Fernandez, Jiacheng Yang, Sankeerth Durvasula, Yu Xin Li, Mohammad Sadrosadati, Juan Gomez Luna, Onur Mutlu, Gennady Pekhimenko

TL;DR

PyGim is the first high-level, open-source library designed to accelerate Graph Neural Networks (GNNs) on real-world Processing-In-Memory (PIM) hardware. By intelligently splitting workloads between PIM cores and the host CPU, it achieves up to a 3.44× speedup over optimized PyTorch implementations while significantly improving energy efficiency.

What Problem Does This Paper Address?

Graph Neural Networks (GNNs) are powerful tools for analyzing structured data, from social networks to drug discovery. However, they face a massive performance hurdle known as the "memory wall." A typical GNN layer consists of two steps: aggregation (gathering information from neighbors) and combination (processing that info through a neural network).

Aggregation is essentially a sparse matrix operation that is extremely memory-intensive. In traditional "processor-centric" systems (CPUs and GPUs), the time spent moving data between the memory and the processor far outweighs the time spent on actual calculation. As shown in the roofline model below, even a high-end NVIDIA RTX 3090 is severely bottlenecked by memory bandwidth during the aggregation phase.

![Fig.

  1. Roofline model in the NVIDIA RTX 3090 GPU for aggregation and combination kernels.](/figures/art_1a587b2819f546989a2fe60ebb782d60)

While Processing-In-Memory (PIM) architectures—which place simple processors directly inside memory chips—offer a solution, they are notoriously difficult to program and lack the high-level software libraries that ML researchers rely on.

Methods

The authors introduce PyGim, which bridges the gap between high-level Python APIs (like PyTorch) and low-level PIM hardware. Its architecture rests on three pillars:

  1. Cooperative Acceleration (CoA): PyGim doesn't try to do everything on the PIM cores. Instead, it uses a hybrid approach: the memory-bound aggregation step is offloaded to PIM, while the compute-heavy combination step stays on the Host (CPU or GPU), where powerful vector units can handle dense matrix math efficiently.
  2. Parallelism Fusion (PaF): To handle the diverse structures of real-world graphs, PyGim employs a multi-level parallelization strategy. It manages parallelism across PIM clusters (to minimize data transfer), within clusters (to balance load across cores), and within individual cores (using multi-threading/tasklets).
  3. Lightweight Tuner: Because the "best" way to partition a graph depends on its specific characteristics (like vertex degree distribution), PyGim includes an automated tuner. It runs quick micro-benchmarks to build an analytical model and selects the optimal parallelization strategy without requiring manual intervention from the programmer.
Fig. 3. Overview of a real near-bank PIM system. Host has access to 𝑚standard and 𝑛PIM-enabled modules.

Datasets

The library was evaluated using:

  • Sparse Matrix Suite Collection: A variety of real-world sparse matrices (e.g., raefsky4, wing_nodal, mosfet2) used for single-core and single-cluster analysis.
  • Large-scale Graph Datasets: ogbn-proteins, Reddit, and AmazonProducts were used to test end-to-end GNN inference performance on a full system with nearly 2,000 PIM cores.

Key Insights and Ideas

  • Hardware-Software Co-design is Essential: The authors found that a "one-size-fits-all" parallelization strategy fails for sparse workloads. The optimal configuration changes based on whether a graph is regular or follows a power-law distribution.
  • PIM is for Bandwidth, Not Just Compute: The primary advantage of PIM in this context isn't raw FLOPS, but the massive aggregate internal bandwidth. PyGim's 11.6× higher resource utilization compared to GPUs highlights how much more effectively PIM uses its available hardware for sparse operations.
  • Real Systems Have Real Overheads: Unlike many theoretical PIM papers based on simulators, this work accounts for the "hidden" costs of real hardware, such as the time needed to merge partial results on the host and the overhead of zero-padding data for parallel transfers.

Key Results

PyGim was tested on a real UPMEM PIM system featuring 16 DIMMs and 1,992 PIM cores.

  • Performance: In GNN inference, PyGim outperformed a state-of-the-art PyTorch implementation on an Intel Xeon CPU by an average of 3.04× (up to 3.44×).
  • Comparison to Prior PIM Work: It outperformed previous PIM-based GNN research (like GraNDe) by an average of 4.38×, largely because those works were designed for simulated architectures rather than real-world constraints.
  • Energy Efficiency: PyGim improved energy efficiency by 2.86× over prior PIM schemes and 1.55× over host-only PyTorch execution.
  • Scalability: The system scales well; doubling the number of PIM devices improves total performance by roughly 1.38×.

Limitations and Future Work

  • Floating Point Limitations: Current commercial PIM hardware (like UPMEM) lacks native support for 32-bit floating-point operations, requiring software emulation which is slow. PyGim currently relies on quantization (e.g., using int32 or int8) to maintain performance, though future PIM generations are expected to include native float support.
  • Host-PIM Idleness: Currently, the host CPU sits idle while PIM cores are working, and vice versa. The authors suggest that future versions could overlap these computations to further reduce execution time.
  • Inter-core Communication: Real PIM systems currently lack direct communication between cores on different chips, forcing all data exchange to go through the host. Developing efficient PIM-to-PIM communication remains a significant hardware challenge.

PyGim is available as an open-source project on GitHub.

Summary updated

BibTeX
@inproceedings{giannoula2025pygim,
  author = {Christina Giannoula and Peiming Yang and Ivan Fernandez and Jiacheng Yang and Sankeerth Durvasula and Yu Xin Li and Mohammad Sadrosadati and Juan Gomez Luna and Onur Mutlu and Gennady Pekhimenko},
  title = {{PyGim: An Efficient Graph Neural Network Library for Real Processing-In-Memory Architectures}},
  booktitle = {SIGMETRICS (Abstracts)},
  year = {2025},
  doi = {10.1145/3726854.3727310},
}
Figure