Cross-Modality Program Representation Learning for Electronic Design Automation with High-Level Synthesis

Zongyue Qin, Yunsheng Bai, Atefeh Sohrabizadeh, Zijian Ding, Ziniu Hu, Yizhou Sun, Jason Cong · DOI

Introduction

High-Level Synthesis (HLS) has emerged as a transformative technology in Electronic Design Automation (EDA), enabling software engineers to design hardware accelerators using high-level languages like C and C++. By abstracting the complexities of hardware description languages, HLS allows for faster development cycles on platforms like FPGAs and ASICs. However, achieving optimal performance remains a significant challenge. Designers must manually insert "pragmas"—directives that guide the compiler on loop unrolling, pipelining, and memory mapping. Selecting the ideal combination of pragmas is a complex optimization problem that typically requires extensive hardware expertise and time-consuming simulations.

To accelerate this process, Machine Learning (ML) models are increasingly used to predict hardware performance metrics such as latency and resource utilization. Yet, existing models often suffer from a "semantic gap." Large Language Models (LLMs) excel at understanding code semantics but struggle with the structural flow of hardware. Conversely, Graph Neural Networks (GNNs) capture the Control Data Flow Graph (CDFG) but often lose the high-level intent of the original source code. This paper introduces PROGSG, a novel framework that bridges this gap by fusing sequence-based and graph-based representations.

The PROGSG Framework

PROGSG (Program representation learning combining Sequence and Graph) is designed to capture both the "what" (semantics) and the "how" (hardware structure) of a design. The architecture is built upon three core innovations:

1. Graph-Summary-Augmented Sequences (PROGSG-SI)

To provide the model with a global view of the hardware structure, PROGSG utilizes a GNN to generate a condensed "summary" of the hardware graph. This summary is prepended to the source code tokens before they are processed by a Transformer. This allows the attention mechanism to weigh code segments against the overall structural context of the design.

2. Fine-Grained Node-to-Token Interaction

Directly mapping every code token to every graph node is computationally prohibitive. PROGSG solves this through a hierarchical interaction layer. The model identifies "auxiliary block nodes" in the graph and "summary tokens" within code chunks. By facilitating information exchange at this intermediate granularity, the model achieves deep cross-modality interaction without the memory overhead of a full cross-attention matrix.

3. Compiler-Aware Pre-training

Data scarcity is a common hurdle in HLS research. To address this, the authors pre-train the GNN component on four fundamental compiler analysis tasks: reachability, dominators, data dependencies, and liveness. By learning the underlying logic of program execution before seeing hardware-specific labels, the model develops a robust understanding of program flow that generalizes better to performance prediction.

Experimental Setup

The framework was evaluated using a comprehensive dataset based on AMD/Xilinx Vitis 2021. The dataset includes:

  • 10,868 designs derived from 40 distinct programs.
  • Kernels from the MachSuite and Polybench benchmarks, covering domains such as linear algebra, encryption, and data mining.
  • A pre-training corpus of 276,197 graphs for self-supervised learning.

Key Results and Insights

PROGSG demonstrates significant improvements over state-of-the-art baselines, including pure LLMs (like CodeT5) and specialized GNNs (like HARP).

  • Accuracy: The model achieved up to a 22% reduction in Root Mean Square Error (RMSE) for performance predictions. The authors attribute this to the model's ability to resolve ambiguities where code looks similar but results in vastly different hardware structures.
  • Design Space Exploration (DSE): When used to search for optimal hardware configurations, PROGSG identified designs that were 1.10x to 1.26x faster on average than those found by existing automation tools. In specific test cases, it discovered configurations yielding a 13.31x speedup.
  • Impact of Pre-training: The specialized compiler-task pre-training provided a 5.57% boost in accuracy, confirming that "teaching" the model the rules of a compiler significantly enhances its predictive capabilities.

Discussion and Future Work

While PROGSG sets a new standard for HLS performance prediction, it introduces higher inference latency compared to lightweight GNNs due to the Transformer architecture. The authors suggest a hybrid approach for large-scale applications: using a fast GNN to prune the initial search space and employing PROGSG to make the final, high-precision selection.

Future research directions include integrating more advanced long-context window techniques (such as FlashAttention) to handle larger codebases and testing the framework's scalability on complex, multi-file industrial projects. By successfully merging code semantics with hardware structure, PROGSG represents a major step toward fully automated, high-performance hardware design.

Summary updated

BibTeX
@inproceedings{qin2024cross,
  author = {Zongyue Qin and Yunsheng Bai and Atefeh Sohrabizadeh and Zijian Ding and Ziniu Hu and Yizhou Sun and Jason Cong},
  title = {{Cross-Modality Program Representation Learning for Electronic Design Automation with High-Level Synthesis}},
  booktitle = {MLCAD},
  year = {2024},
  doi = {10.1145/3670474.3685952},
}
Figure