A Graph Deep Learning Framework for High-Level Synthesis Design Space Exploration

Lorenzo Ferretti, Andrea Cini, Georgios Zacharopoulos, Cesare Alippi, Laura PozziarXiv 2021

Introduction

The rapid evolution of specialized hardware, particularly for AI and signal processing, has made High-Level Synthesis (HLS) a cornerstone of modern digital design. HLS allows engineers to describe hardware behavior in high-level languages like C or C++, which the tool then translates into Register-Transfer Level (RTL) descriptions. To optimize these designs, engineers use compiler directives—known as pragmas—to control trade-offs between hardware area (cost) and execution latency (performance).

However, the resulting Design Space Exploration (DSE) is a significant bottleneck. The combinatorial explosion of possible pragma configurations creates a massive search space. Since a single HLS synthesis run can take minutes to hours, finding the Pareto-optimal frontier—the set of configurations offering the best performance-to-cost ratios—is computationally prohibitive. This paper presents gnn4hls, a Graph Neural Network (GNN) framework designed to serve as a fast, accurate surrogate model for HLS evaluation.

Methodology: Hybrid Control Data Flow Graphs

The primary challenge in applying machine learning to HLS is representing the source code and its associated directives. Traditional methods often use fixed-size vectors, which fail to capture the complex structural dependencies of hardware logic.

The authors introduce the Hybrid Control Data Flow Graph (HCDFG) to preserve these relationships. This representation merges three distinct types of information:

  1. Control Flow: Mapping the execution paths and branching logic.
  2. Data Flow: Tracking variable dependencies and data movement.
  3. Parameter Flow: Explicitly modeling the inputs and outputs of the hardware modules.
The Hybrid Control Data Flow Graph (HCDFG) integrates control, data, and parameter flow to represent HLS designs.

Nodes in the HCDFG are categorized by operation type (e.g., read/write blocks, loop headers) and annotated with hardware-specific attributes like loop trip counts and applied HLS pragmas. This rich graph is processed by a Message-Passing Neural Network (MPNN) with multi-head attention, which aggregates local structural information to predict global hardware metrics.

Experimental Setup

The framework was evaluated using db4hls, an open-source database containing over 103,000 unique synthesis configurations derived from the MachSuite benchmark. The dataset covers 23 diverse functions, including linear algebra and machine learning kernels. To handle unseen applications, the model uses a transfer learning approach: it is pre-trained on a broad set of designs and then fine-tuned on a small random sample of a new application's design space.

Key Results

The gnn4hls framework demonstrates exceptional predictive accuracy and speed. Inference for a single configuration takes approximately 20 milliseconds on a standard CPU, representing a speedup of several orders of magnitude over actual synthesis tools.

Comparison of Mean Absolute Percentage Error (MAPE) between gnn4hls and the baseline across hardware metrics.

As shown in the performance analysis, the model achieves a Mean Absolute Percentage Error (MAPE) of just 2.1% for latency and under 5% for resource utilization metrics, including Flip-Flops (FF), Look-Up Tables (LUT), and DSPs. This significantly outperforms baseline models like DeepSets, which averaged over 15% error. Furthermore, in DSE tasks, the fine-tuned model achieved an Average Distance from Reference Set (ADRS) of 0.20, outperforming the state-of-the-art prior-knowl baseline (0.45 ADRS), indicating a much closer approximation of the true Pareto-optimal frontier.

Conclusion

gnn4hls provides a scalable and accurate solution for the HLS DSE bottleneck. By leveraging graph-based representations that mirror the underlying hardware structure, the framework enables near-instantaneous performance estimation. Future work will focus on expanding the framework's compatibility with complex C++ features like dynamic memory allocation and integrating Reinforcement Learning to further automate the exploration of the design space.

Summary updated

BibTeX
@misc{ferretti2021graph,
  author = {Lorenzo Ferretti and Andrea Cini and Georgios Zacharopoulos and Cesare Alippi and Laura Pozzi},
  title = {{A Graph Deep Learning Framework for High-Level Synthesis Design Space Exploration}},
  year = {2021},
  eprint = {2111.14767},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.14767},
}
Figure