Invited Paper: Verilog-to-PyG - A Framework for Graph Learning and Augmentation on RTL Designs

Yingjie Li, Mingju Liu, Alan Mishchenko, Cunxi Yu

TL;DR

Verilog-to-PyG (V2PYG) is an open-source framework that bridges the gap between hardware description languages (Verilog) and modern graph machine learning (PyTorch Geometric). It provides a robust pipeline for converting RTL designs into graph datasets and introduces a novel "functionally equivalent" data augmentation technique to generate the massive, diverse datasets required to train effective Graph Neural Networks (GNNs) for chip design.

What Problem Does This Paper Address?

As chip designs become exponentially complex, traditional Electronic Design Automation (EDA) tools struggle with massive search spaces and long runtimes. Researchers are increasingly turning to Machine Learning (ML), specifically GNNs, to predict circuit performance (area, power, delay) early in the design cycle.

However, two major bottlenecks exist:

  1. Infrastructure Gap: There is no standard, easy-to-use tool to convert Verilog code into the graph formats used by popular ML libraries like PyTorch Geometric.
  2. Data Scarcity: Unlike computer vision, where you can flip or rotate an image to create new data, you cannot "randomly" change a circuit without breaking its logic. This leads to small, homogenous datasets that cause ML models to overfit.

Methods

The authors introduce the V2PYG framework, which integrates with established EDA tools like Yosys (for front-end parsing), ABC (for logic manipulation), and OpenROAD (for physical design labeling).

Key Technical Components:

  • Graph Extraction: It translates Verilog into two main types of graphs:
  • And-Inverter Graphs (AIGs): A technology-independent representation using only AND gates and inverters.
  • Mapped Netlists: Technology-dependent graphs that reflect actual hardware gates (e.g., from a 7nm library).
  • Combinational Augmentation: This is the paper's most novel contribution. The framework randomly applies logic synthesis transformations—Rewriting (rw), Refactoring (rf), and Resubstitution (rs)—at individual nodes. Because these operations are mathematically proven to preserve logic, the framework can generate thousands of structurally different versions of the same circuit.
  • Sequential Augmentation: It uses retiming, which moves registers (flip-flops) across logic boundaries to change the graph's timing characteristics without altering its functional behavior.
  • Automated Labeling: By piping designs through OpenROAD, the framework automatically extracts "ground truth" labels (like area, delay, and power) from various stages of the design flow.

Datasets

Rather than relying on a single static dataset, V2PYG is a dataset generator. The authors demonstrated its utility on several standard benchmarks:

  • ITC'99 and ISCAS'85 benchmarks: Including designs like b11, b12, c2670, and c5315.
  • Large-scale AIGs: Specifically i10.aig, which contains over 2,600 gates.
  • Custom Multipliers: A 2-bit multiplier example used to demonstrate the step-by-step extraction process.

The authors used the framework to generate 6,000 unique samples for each benchmark to demonstrate the diversity of the resulting data.

Key Insights and Ideas

  • Synthesis as Augmentation: The "aha moment" is realizing that logic synthesis tools, originally built to optimize chips, are actually perfect data augmenters. They are designed to explore the "equivalence class" of a design—finding different ways to say the same thing.
  • Gaussian Distribution of Features: By randomly sampling these synthesis transformations, the authors found that the resulting graph sizes follow a Gaussian-like distribution. This is ideal for training ML models, as it provides a smooth spectrum of design variations.
  • Multi-Fidelity Representation: V2PYG allows researchers to look at a design at different "resolutions"—from abstract logic flows to detailed, technology-mapped gates—enabling models to learn features at multiple levels of abstraction.

Key Results

  • Functionality Preservation: Using Combinatorial Equivalence Checking (CEC), the authors proved that 100% of their augmented designs remained functionally identical to the original Verilog source.
  • Structural Diversity: For the i10.aig benchmark, augmentation produced variations ranging from ~1,900 to ~2,600 AND gates, providing a rich variety of structural features for a GNN to learn from.
  • Open Source Tooling: The framework is implemented as a command (aigaug) within the widely used ABC tool, making it immediately accessible to the hardware community.

Limitations and Future Work

  • Sequential Complexity: While the paper mentions sequential augmentation via retiming, the primary focus and detailed results center on combinational logic. Handling complex state machines and clock domains remains a challenge.
  • Integration with MLIR: The authors plan to integrate with MLIR CIRCT to support even higher-level hardware representations (like Data Flow Graphs).
  • GNN Performance: The paper focuses on the framework and data generation rather than benchmarking specific GNN architectures. The next logical step for researchers using this tool will be to prove that these augmented datasets actually lead to higher prediction accuracy in real-world EDA tasks.

Framework Link: https://yu-maryland.github.io/Verilog-to-PyG/

Summary updated

Abstract

The complexity of modern hardware designs necessitates advanced methodologies for optimizing and analyzing modern digital systems. In recent times, machine learning (ML) methodologies have emerged as potent instruments for assessing design quality-of-results at the Register-Transfer Level (RTL) or Boolean level, aiming to expedite design exploration of advanced RTL configurations. In this presentation, we introduce an innovative open-source framework that translates RTL designs into graph representation foundations, which can be seamlessly integrated with the PyTorch Geometric graph learning platform. Furthermore, the Verilog-to-PyG (V2PYG) framework is compatible with the open-source Electronic Design Automation (EDA) toolchain OpenROAD, facilitating the collection of labeled datasets in an utterly open-source manner. Additionally, we will present novel RTL data augmentation methods (incorporated in our framework) that enable functional equivalent design augmentation for the construction of an extensive graph-based RTL design database. Lastly, we will showcase several using cases of V2PYG with detailed scripting examples. V2PYG can be found at https://yu-maryland.github.io/Verilog-to-PyG/.
BibTeX
@inproceedings{li2023invited,
  author = {Yingjie Li and Mingju Liu and Alan Mishchenko and Cunxi Yu},
  title = {{Invited Paper: Verilog-to-PyG - A Framework for Graph Learning and Augmentation on RTL Designs}},
  booktitle = {ICCAD},
  year = {2023},
  url = {https://openreview.net/forum?id=UvqJubzw_0},
}

Loading related content...

Figure