IRONMAN: GNN-assisted Design Space Exploration in High-Level Synthesis via Reinforcement Learning

Nan Wu, Yuan Xie, Cong Hao

TL;DR

This paper introduces IRONMAN, an end-to-end framework that uses Graph Neural Networks (GNNs) and Reinforcement Learning (RL) to automate and optimize the Design Space Exploration (DSE) process in High-Level Synthesis (HLS). IRONMAN significantly improves the accuracy of performance prediction and finds better trade-offs between design objectives like resource usage and latency, all while being orders of magnitude faster than existing HLS tools.

What Problem Does This Paper Address?

High-Level Synthesis (HLS) tools are powerful for translating high-level code (like C/C++) into hardware designs (RTL). However, they face several challenges:

  1. Hidden Optimization Opportunities: The abstraction of HLS code can obscure opportunities for fine-grained optimization. Manual code transformations are often needed, which is tedious and error-prone.
  2. Limited Trade-off Flexibility: Existing HLS tools struggle to provide flexible trade-offs between different design objectives (e.g., minimizing DSPs vs. minimizing latency) or to find Pareto-optimal solutions. They often force a choice between one objective at the expense of another.
  3. Unpredictable Design Quality: The actual performance (resource usage, timing) of the generated RTL designs is hard to predict accurately, especially for complex or irregular data paths.

These limitations hinder the ability of designers to efficiently explore the vast design space and achieve optimal hardware implementations that meet specific constraints.

Methods

IRONMAN is a three-component framework:

  • Code Transformer (CT): This component takes original HLS C/C++ code and extracts Data Flow Graphs (DFGs). Crucially, it can also re-generate synthesizable code with HLS directives that enable finer-grained control over resource allocation, uncovering optimization opportunities missed by standard HLS tools.
  • GNN-based Performance Predictor (GPP): GPP leverages Graph Neural Networks (GNNs) to predict the actual performance (resource usage like DSPs/LUTs, and critical path timing) of an RTL design after physical synthesis. It uses the DFG structure as input, making it suitable for both regular and irregular data paths, and is significantly faster than running full HLS flows.
  • Reinforcement Learning-based DSE Engine (RLMD): RLMD is a deep reinforcement learning agent that explores the design space for optimal resource allocation. It uses GPP's predictions to quickly evaluate potential solutions. RLMD is trained to make decisions on assigning directives (e.g., using LUTs instead of DSPs for multiplications) to achieve user-specified constraints or to find Pareto-optimal solutions. It's formulated as a Markov Decision Process (MDP) where states represent partially assigned DFGs, actions are directive assignments, and rewards are based on meeting constraints and optimizing objectives.

Datasets

The authors created a dataset for training and evaluation by combining synthetic and real-world benchmarks:

  • Synthetic DFGs: 47 different topologies were generated, each with 100-200 operations. For each topology, 100 sets of directives were created, specifying subsets of multiplications to be implemented by LUTs instead of DSPs, resulting in 4700 synthetic DFGs.
  • Real-case DFGs: 8 benchmarks from established sources (MachSuite, CHStone, PolyBench/C) were used. For each benchmark, 100 sets of directives were generated, totaling 800 real-case DFGs.

The ground truth for these DFGs (actual resource usage and timing) was obtained by synthesizing them with Vivado HLS and implementing them on a Xilinx Ultra96 FPGA.

Key Insights and Ideas

  • DFGs are Key: The paper highlights that the inherent graph structure of Data Flow Graphs (DFGs) is a rich source of information for both performance prediction and design space exploration, a fact that can be effectively leveraged by GNNs.
  • GNNs for Accurate Prediction: GNNs, when applied to DFGs, can achieve remarkably high prediction accuracy for hardware performance, significantly outperforming traditional HLS tools and even other machine learning-based predictors that rely on more extensive input features.
  • RL for Intelligent DSE: Reinforcement learning provides a powerful paradigm for navigating the exponentially growing design space in HLS. An RL agent can learn sophisticated strategies for resource allocation that go beyond simple heuristics.
  • Code Transformation Unlocks Granularity: The Code Transformer (CT) is crucial for enabling finer-grained DSE. By allowing precise directive placement, it unlocks optimization opportunities that are not accessible through standard HLS pragmas alone.
  • Pareto Front Exploration: The framework can effectively find Pareto-optimal solutions, offering designers a set of non-dominated trade-offs between objectives, which is a significant improvement over current HLS capabilities.

Key Results

  • GPP Performance Prediction: GPP reduces prediction errors of HLS tools by 10.9x for resource usage and 5.7x for timing. Its prediction accuracy on synthetic and real-case DFGs is significantly higher than Vivado HLS.
  • RLMD DSE Performance: RLMD outperforms Genetic Algorithm (GA) and Simulated Annealing (SA) by 12.7% and 12.9% respectively in finding optimized or Pareto solutions.
  • Constraint Satisfaction: IRONMAN meets user-specified DSP constraints for 97.5% of cases on real-world benchmarks, and 100% after fine-tuning. In contrast, SA, GA, and Vivado HLS meet constraints for only 5%, 15%, and 0% of cases, respectively.
  • Resource and Latency Improvements: IRONMAN finds solutions with 2.54x fewer DSPs and up to 6x shorter latency compared to HLS tools, while often maintaining or slightly increasing LUT usage.
  • Speedup: IRONMAN is up to 400x faster than meta-heuristic techniques and HLS tools for finding solutions.

Limitations and Future Work

  • Generalization of RLMD: While RLMD shows good generalization, the authors suggest further work to improve its ability to transfer knowledge across vastly different DFGs and applications.
  • Exploration of More Objectives: The current RLMD formulation focuses on DSP/LUT trade-offs. Future work could explore a wider range of objectives and constraints, including power consumption, clock frequency, and more complex architectural features.
  • CT Enhancements: The CT component could be extended to handle more complex code structures and generate a broader set of HLS directives for even finer-grained control.
  • Integration with Synthesis Flow: While GPP predicts post-synthesis performance, deeper integration with the actual synthesis and implementation flow could further refine predictions and optimizations.

Summary updated

Abstract

Despite the great success of High-Level Synthesis (HLS) tools, we observe several unresolved challenges: 1) the high-level abstraction of programming styles in HLS conceals optimization opportunities; 2) existing HLS tools do not provide flexible trade-offs among different objectives and constraints; 3) the actual quality of the resulting RTL designs is hard to predict. To this end, we propose an end-to-end framework, IRONMAN. The primary goal is to enable a flexible and automated design space exploration (DSE), which can provide either optimized solutions under user-specified constraints, or Pareto trade-offs among different objectives (e.g., resource types, area, and latency). IronMan consists of three components: GPP (a highly accurate graph-neural-network-based performance predictor), RLMD (a reinforcement-learning-based DSE engine that explores the optimized resource allocation strategy), and CT (a code transformer that assists RLMD and GPP by extracting data flow graphs from original HLS C/C++). Experimental results show that, 1) GPP achieves high prediction accuracy, reducing prediction errors of HLS tools by 10.9X in resource usage and 5.7X in timing; 2) RLMD obtains optimized or Pareto solutions outperforming genetic algorithm and simulated annealing by 12.7% and 12.9%, respectively; 3) IronMan can find optimized solutions perfectly matching various DSP constraints, with 2.54X fewer DSPs and up to 6X shorter latency than those of HLS tools. IronMan is also up to 400X faster than meta-heuristic techniques and HLS tools.
BibTeX
@inproceedings{wu2021ironman,
  author = {Nan Wu and Yuan Xie and Cong Hao},
  title = {{IRONMAN: GNN-assisted Design Space Exploration in High-Level Synthesis via Reinforcement Learning}},
  booktitle = {ACM Great Lakes Symposium on VLSI},
  year = {2021},
  url = {https://openreview.net/forum?id=RqYv8PxcMO},
}
Figure