Abstract
High-Level Synthesis (HLS) plays a crucial role in modern hardware design by transforming high-level code into optimized hardware implementations. However, progress in applying machine learning (ML) to HLS optimization has been hindered by a shortage of sufficiently large and diverse datasets. To bridge this gap, we introduce ForgeHLS, a large-scale, open-source dataset explicitly designed for ML-driven HLS research. ForgeHLS comprises over 400k diverse designs generated from 846 kernels covering a broad range of application domains, consuming over 200k CPU hours during dataset construction. Each kernel includes systematically automated pragma insertions (loop unrolling, pipelining, array partitioning), combined with extensive design space exploration using Bayesian optimization. Compared to existing datasets, ForgeHLS significantly enhances scale, diversity, and design coverage. We further define and evaluate representative downstream tasks in Quality of Result (QoR) prediction and automated pragma exploration, clearly demonstrating ForgeHLS utility for developing and improving ML-based HLS optimization methodologies.
Introduction
High-Level Synthesis (HLS) serves as a vital bridge between software and hardware, allowing engineers to transform C/C++ code into hardware descriptions like Verilog. To achieve efficiency, designers utilize "pragmas"—directives that guide the compiler on optimizations such as loop unrolling or memory partitioning. However, identifying the optimal combination of pragmas is a complex "needle in a haystack" problem known as Design Space Exploration (DSE).
While Machine Learning (ML) could theoretically automate this process, the field has been limited by existing datasets that are too small, lack diversity, or omit critical post-synthesis data. ForgeHLS addresses this by providing over 450,000 hardware designs—a tenfold increase over previous collections—offering the scale and diversity required to train robust models for hardware performance prediction and automated optimization.
Methods
The ForgeHLS dataset was constructed using a comprehensive multi-stage pipeline designed for both scale and functional accuracy:
- Kernel Generation: The dataset combines 405 real-world kernels from benchmarks like MachSuite and Rosetta with 441 synthetic kernels generated by GPT-4o. Synthetic code is validated through cross-verification against Python reference models.
- Automated Pragma Insertion: A Clang-based analyzer identifies loops and arrays to apply optimization strategies. For small kernels, Full DSE is used; for complex kernels, Bayesian DSE samples the most promising configurations.
- Massive Synthesis: Over 200,000 CPU hours were dedicated to running the Vitis HLS toolchain, generating ground-truth labels for latency, power, and resource usage (LUTs, DSPs, FFs).
- Graph Representation: ForgeHLS includes Control Data Flow Graphs (CDFGs), enabling the training of modern Graph Neural Networks (GNNs).
Dataset Characteristics
ForgeHLS represents a significant leap in HLS data availability. It is composed of two primary subsets: R-ForgeHLS (Real-world kernels, ~100k designs) and S-ForgeHLS (Synthetic kernels, ~360k designs). In total, the dataset spans 846 kernels and 459,850 designs, occupying 2.1 terabytes of storage.
Unlike previous clumpy datasets that lacked data for intermediate designs, ForgeHLS provides a dense, continuous distribution across all hardware metrics. This continuous coverage is essential for training accurate regression models that can generalize across the entire design space.
Key Results and Insights
- Synthetic Data as a Force Multiplier: LLM-generated synthetic code, when properly validated, effectively fills gaps in the design space that traditional real-world benchmarks miss.
- Superior Generalization: GNNs trained on ForgeHLS demonstrate significantly better performance on unseen kernels compared to those trained on smaller datasets, which frequently suffer from overfitting.
- LLM Fine-tuning for Hardware: General-purpose Large Language Models (LLMs) like LLaMA3 can be fine-tuned into competent hardware optimizers. For instance, a fine-tuned LLaMA3-7B model increased its HLS pass rate from 19% to 69% and achieved a much lower Adjusted Distance to Reference Set (ADRS) in pragma exploration tasks.
Conclusion and Future Work
ForgeHLS provides the "Big Data" foundation necessary for the next generation of ML-driven HLS optimization. While synthetic data has proven powerful, real-world kernels remain a challenge due to the varied coding styles of human engineers. Future research should focus on integrating these predictive models into iterative, multi-step DSE frameworks and developing hardware-specific model architectures that can fully leverage the scale of ForgeHLS.
Summary updated