GNNHLS: Evaluating Graph Neural Network Inference via High-Level Synthesis

Chenfeng Zhao, Zehao Dong, Yixin Chen, Xuan Zhang, Roger D. Chamberlain

Abstract

Graph Neural Networks (GNNs) have emerged as a powerful tool for processing data with complex relational structures, yet their deployment is often hindered by the "hybrid" nature of their workloads. GNNs combine irregular communication patterns with regular, dense computation, creating significant bottlenecks for traditional CPU and GPU architectures. This paper introduces GNNHLS, an open-source framework designed to accelerate GNN inference on FPGAs using High-Level Synthesis (HLS). By bridging the gap between high-level model development and custom hardware execution, GNNHLS achieves up to 50.8× speedup and 423× energy reduction compared to CPU baselines, while offering superior scalability for complex anisotropic models compared to GPUs.

Introduction

As Graph Neural Networks (GNNs) become standard for tasks ranging from social network analysis to molecular property prediction, the hardware community faces a unique challenge. GNNs are characterized by two distinct phases: an aggregation phase involving irregular memory access (traversing graph edges) and a transformation phase involving regular matrix operations.

Traditional processors often struggle with this mix. CPUs lack the necessary parallelism, while GPUs frequently suffer from "ineffectual computation," where hardware resources remain idle while waiting for data from memory. Field-Programmable Gate Arrays (FPGAs) offer a potential solution through custom architectural pipelines, but their adoption has been limited by the steep learning curve of Hardware Description Languages (HDL). GNNHLS addresses this by utilizing High-Level Synthesis (HLS), allowing developers to program FPGAs using C/C++ while maintaining high performance through rigorous optimization.

The GNNHLS Framework

GNNHLS provides a comprehensive software-to-hardware stack. The software layer, built on PyTorch and the Deep Graph Library (DGL), handles data generation and preprocessing. The hardware layer consists of six highly optimized FPGA kernels designed to handle both isotropic GNNs (e.g., GCN, where neighbors are weighted equally) and anisotropic GNNs (e.g., GAT, which utilizes attention mechanisms).

To maximize performance, the framework employs several advanced HLS optimization strategies:

  • Dataflow Pipelining: Utilizing FIFOs to connect functions, enabling concurrent execution of different tasks.
  • Memory Port Widening: Maximizing bandwidth by accessing large data chunks in a single cycle.
  • Loop Unrolling and Merging: Increasing throughput by executing multiple iterations in parallel.
  • Multiple Compute Units (CUs): Scaling performance by running multiple kernel instances to process graph partitions simultaneously.

Workload Characterization and Insights

The researchers evaluated GNNHLS using four datasets from the Open Graph Benchmark (OGB): MT (MOLTOX21), MH (MOLHIV), AX (ARXIV), and PT (PROTEINS). These represent a spectrum of graph topologies, from many small, dense molecular graphs to massive, sparse citation networks.

Several key insights emerged from this characterization:

  1. The Optimization Gap: There is a massive performance delta between naive HLS and optimized HLS. For the GraphSage model, the researchers' optimizations resulted in a 132× performance boost over a baseline C++ implementation.
  2. Instruction Mix: GNNs are computation-heavy (40–50% of instructions), but memory access remains a critical bottleneck, accounting for approximately 30% of the instruction mix.
  3. Locality Paradox: While spatial locality is low due to the random nature of graph edges, temporal locality is surprisingly high (0.5–0.7). This indicates that smart on-chip caching is highly effective for GNN workloads.
  4. Anisotropic Scalability: Anisotropic models like GAT often crash on GPUs when processing large graphs due to the massive memory footprint required for intermediate results. The FPGA's custom pipeline avoids storing these intermediates, making it significantly more scalable for complex models.

Performance Evaluation

GNNHLS was compared against a 10-core Intel Xeon CPU and an NVIDIA RTX 2080 Ti GPU.

  • Versus CPU: GNNHLS demonstrated overwhelming superiority, achieving up to a 50.8× speedup and a 423× reduction in energy consumption.
  • Versus GPU: The framework achieved up to a 5.16× speedup and a 74.5× energy reduction. While the GPU's raw throughput can be higher for simple isotropic models, the FPGA was consistently more energy-efficient.
  • Model-Specific Gains: The MoNet model saw the most significant improvements, as the researchers were able to collapse its complex mathematical operations into a single, highly efficient hardware pipeline.

Limitations and Future Work

While GNNHLS represents a significant step forward, the study identified areas for improvement. The achieved clock frequencies (190–270 MHz) fell short of the 300 MHz target due to routing complexities inherent in HLS designs. Additionally, while the framework handles large graphs better than previous HLS attempts, it still faces challenges when graph sizes exceed off-chip memory bandwidth.

Conclusion

GNNHLS demonstrates that HLS is a viable and powerful path for GNN acceleration. By providing an open-source benchmark suite and optimized kernels, the authors have established a baseline for future research into FPGA-based GNN inference, proving that custom hardware can provide the efficiency and scalability required for next-generation graph analytics.

Summary updated

BibTeX
@inproceedings{zhao2023gnnhls,
  author = {Chenfeng Zhao and Zehao Dong and Yixin Chen and Xuan Zhang and Roger D. Chamberlain},
  title = {{GNNHLS: Evaluating Graph Neural Network Inference via High-Level Synthesis}},
  booktitle = {ICCD},
  year = {2023},
  doi = {10.1109/iccd58817.2023.00092},
}
Figure