File size: 8,680 Bytes
6eda9fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a37c66e
6eda9fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
---
license: gpl-3.0
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: validation
    path: data/validation-*
dataset_info:
  features:
  - name: net_name
    dtype: string
  - name: driver
    dtype: string
  - name: loads
    list: string
  - name: tree_seq
    list: string
  - name: connected_info
    list:
    - name: driver
      dtype: string
    - name: loads
      list: string
    - name: net_name
      dtype: string
    - name: overlap_volume
      dtype: int64
  - name: overlap_info
    list:
    - name: driver
      dtype: string
    - name: loads
      list: string
    - name: net_name
      dtype: string
    - name: overlap_volume
      dtype: int64
  - name: source_design
    dtype: string
  splits:
  - name: train
    num_bytes: 14242624501
    num_examples: 6347092
  - name: validation
    num_bytes: 24439501
    num_examples: 10163
  download_size: 3468684189
  dataset_size: 14267064002
---


# This is dataset for project [iPCL-R](https://github.com/OSCC-Project/iPCL-R).

<p align="center">
 <img src="./figs/iPCL.png" width="35%" alt="iPCL-R" />
 A Pre-training foundation model for Chip Layout Routing 
</p>

## Demo of iPCL-R

<p align="center">
  <img src="./figs/iPCL-R1.gif" width="100%" alt="iPCL-R Demo" />
  A chip layout generation demo by iPCL-R 
</p>

## Project Overview

<p align="center">
  <img src="./figs/framework.jpg" width="100%" alt="iPCL-R Framework" />
  The framework of iPCL-R. (a) Dataset. (b) Symbolic system. (c) Pre-training. (d) Inference.
</p>

iPCL-R addresses the challenge of automated routing pattern generation in chip design by treating routing patterns as sequences that can be learned and generated by large language models. The project implements a complete pipeline from EDA data extraction to model training and routing generation.

### Table of Contents
- [Demo of iPCL-R](#demo-of-ipcl-r)
- [Project Overview](#project-overview)
  - [Table of Contents](#table-of-contents)
  - [Key Innovation](#key-innovation)
- [Architecture](#architecture)
- [Core Modules](#core-modules)
  - [Flow Module](#flow-module)
    - [Stage 1: Tokenization](#stage-1-tokenization)
    - [Stage 2: Training](#stage-2-training)
    - [Stage 3: Evaluation](#stage-3-evaluation)
  - [Data Synthesis Module](#data-synthesis-module)
  - [Experiments Module](#experiments-module)
  - [AiEDA Third-Party Module](#aieda-third-party-module)
- [Quick Start](#quick-start)
  - [Prerequisites](#prerequisites)
  - [Basic Usage](#basic-usage)
    - [Pipeline Execution](#pipeline-execution)
    - [Dataset Construction](#dataset-construction)
    - [Experimental Analysis](#experimental-analysis)
- [Research Applications](#research-applications)
- [Evaluation Metrics](#evaluation-metrics)
- [Contributing](#contributing)
- [Citation](#citation)

### Key Innovation
- **Domain-specific tokenization** optimized for spatial reasoning tasks in chip routing
- **Transformer-based sequence-to-sequence models** for routing pattern generation
- **Comprehensive evaluation metrics** combining NLP and routing-specific measures

## Architecture

The project is organized into four main modules:

```
iPCL-R/
├── flow/              # [Main] 3-stage ML pipeline (tokenization → training → evaluation)
├── data_synthesis/    # [Optional] EDA data processing and ML-ready dataset generation
├── experiments/       # [Optional] Experimental analysis and validation studies
└── third_party/       # EDA tool integration and chip design automation
```

## Core Modules

### Flow Module  
**Purpose**: Complete 3-stage pipeline for routing pattern generation

**Pipeline Stages**:

#### Stage 1: Tokenization
- **UnifiedTokenizer**: Supports 5 algorithms (DecimalWordLevel, Seg-BPE, Concat-BPE, Seg-BBPE, Concat-BBPE)
- **Direction Encoding**: Converts 3D coordinates to directional tokens (R/L/U/D/T/B)
- **Tree Structure**: Handles routing trees with PUSH/POP and BRANCH/END tokens
- **Special Tokens**: BOS/EOS, PAD, DRIVER/LOAD for routing semantics

#### Stage 2: Training
- **Custom Architecture**: T5-Gemma encoder-decoder transformer
- **Multi-optimizer Support**: AdamW, Adafactor, Lion optimizers
- **Distributed Training**: HuggingFace Accelerate integration
- **Monitoring**: TensorBoard and comprehensive logging

#### Stage 3: Evaluation  
- **Multi-metric Assessment**: NLP metrics (ROUGE, BLEU) + routing-specific (RED)
- **Validation Pipeline**: Coordinate parsing, tree structure analysis
- **EDA Integration**: DEF format output for industry tool verification

### Data Synthesis Module
**Purpose**: Convert EDA design data into large model learning-ready formats

**Key Components**:
- **MetadataTracker & DataGenerator**: Base infrastructure for data generation with Parquet output
- **NetPatternProcessor**: Processes wire routing patterns and calculates directions  
- **NetGraphProcessor**: Converts routing networks into NetworkX graphs
- **DesignGraphProcessor**: Creates design-level graphs with spatial overlap detection
- **DatasetAggregator**: Consolidates data into HuggingFace Dataset format

**Data Types Generated**:
- `net_seqs`: Network sequence representations with driver/load information
- `pin2pin_pattern_seqs`: Pin-to-pin routing pattern sequences  
- `pin2pin_loc_seqs`: Spatial location sequences for routing paths
- `design_graph`: Design-level connectivity and overlap graphs

**Ready-made online datasets**:
- [iPCL-R Dataset](https://huggingface.co/datasets/AiEDA/iPCL-R) on HuggingFace

### Experiments Module
**Purpose**: Validation and optimization studies for the pipeline

**Research Areas**:
- **Tokenization Comparison**: Statistical analysis of 5 tokenization algorithms across multiple vocabulary sizes
- **Model Architecture Studies**: Parameter count vs. performance analysis (small/medium/large variants)
- **LLM Fine-tuning**: Supervised fine-tuning with LoRA, multi-GPU support, comprehensive evaluation
- **Symbol Analysis**: Domain-specific vs. human language tokenization comparison
- **Feature Ablation**: Input feature importance analysis (planned)

**Key Methodologies**:
- Multi-stage filtering for coordinate validation
- Tree structure integrity checking  
- Statistical significance testing
- Comprehensive visualization and reporting

### AiEDA Third-Party Module
**Purpose**: Extract features (metadata) from physical design files and write the generated results back to the physical design file (DEF)

**Integration**: Provides EDA backend infrastructure and large model data generation for the iPCL-R project.

## Quick Start

### Prerequisites
```bash
# Install dependencies
pip install -r requirements.txt

# Key dependencies include:
# torch, transformers, datasets, accelerate, networkx, pandas, tqdm
```

### Basic Usage

#### Pipeline Execution
```bash
# Generate pipeline configuration
python -m flow.pipeline_init --create-flow-config config.json

# Read the config guide in 'flow/README.md'
vim config.json

# Execute 3-stage pipeline
python -m flow.launch_tokenization --flow-config config.json
# Configure your accelerate settings as needed (e.g., run 'accelerate config' for initial setup)
accelerate launch -m flow.launch_training --flow-config config.json  
accelerate launch -m flow.launch_evaluation --flow-config config.json
```

#### Dataset Construction
If you wish to build your own dataset, please organize your data following the AiEDA framework (I sincerely do not recommend this, as it involves extensive engineering dependencies), and utilize the 'data_synthesis' module of this project to assist in the construction of the dataset.
```bash
python -m data_synthesis.main_aggregation
```

#### Experimental Analysis
The experiments and the code for generating the figures in this work are located in the 'experiments' directory. Due to issues such as log extraction and path dependencies, it is not convenient for users to run them with a single click. Therefore, this module is for reference only.

## Research Applications

iPCL-R enables research in:
- **Spatial AI**: Neural networks for 2D/3D coordinate reasoning
- **Domain-specific Tokenization**: Optimization for spatial/geometric data
- **EDA Automation**: AI-driven chip design optimization
- **Graph Neural Networks**: Routing network topology analysis
- **Transfer Learning**: Pre-trained models for chip design tasks

## Evaluation Metrics

- **NLP Metrics**: ROUGE, BLEU, exact match for sequence similarity
- **Routing Metrics**: RED (Routing Edit Distance), coordinate accuracy
- **Structural Metrics**: Tree validation, connectivity analysis  
- **Quality Metrics**: Manufacturability, design rule compliance