ChiPFormer is an offline RL-based placement method that significantly improves design quality and efficiency.
Publication
Yao Lai, Jinxin Liu, Zhentao Tang, Bin Wang, Jianye Hao, Ping Luo. “ChiPFormer: Transferable Chip Placement via Offline Decision Transformer.” International Conference on Machine Learning (ICML 2023): 18346-18364.
paper | dataset | website | video(English) | video(Mandarin)
Environment Setup (Updated in 2026)
This repo was developed with older versions of PyTorch and Python, so we recommend using the following environment:
git clone https://github.com/laiyao1/ChiPFormer.git
conda create -n chipformer python=3.9 -y
conda activate chipformer
conda install pytorch=1.10.1 torchvision torchaudio cudatoolkit=11.3 -c pytorch -y
conda install dgl-cuda11.3=0.7.2 -c dglteam -y
pip install networkx==2.6.3 scipy==1.7.3
pip install tqdm
Usage
Download the offline placement dataset
Download the offline placement dataset from Google Drive.
We provide placement data for 12 benchmarks: adaptec1-4, bigblue1-4, ibm01-04. You may download only the benchmark you need. (Updated: 2024-03-02)
For a quick start, you can extract the adaptec1_small.pkl archive included in this repo:
tar -zxvf adaptec1_small.pkl.tar.gz
Download placement benchmark files
Our test set includes the ISPD05 and ICCAD04 benchmarks. We include adaptec1 for a quick start.
All benchmarks can also be downloaded from placement_bench.zip in Google Drive.
Quick start
ChiPFormer consists of two stages: pretraining and fine-tuning.
python run_dt_place.py
You can change the training dataset file/path in create_dataset.py.
Saved models will be in save_models/.
python odt.py --benchmark=adaptec1
The model checkpoint path for fine-tuning can be set in odt.py. Typically, you fine-tune using the best checkpoint from pretraining.
(Updated: 2024/05/25)
To use VGAE, you need to first train the model and then run evaluation on the target benchmarks.
python graph_train.py
The trained model will be saved to save_graph_models/.
python graph_eval.py
Circuit embeddings are saved to circuit_g_token*.pkl.
Then, in mingpt/place_db.py, change:
def __init__(self, benchmark = None, offset = 0, is_graph = False):
to:
def __init__(self, benchmark = None, offset = 0, is_graph = True):
We also provide example models and embedding files that you can use directly.
Parameters
For run_dt_place.py:
- seed Random seed.
- context_length Maximum sequence length for the Decision Transformer.
- epochs Maximum training epochs.
- batch_size Batch size.
- cuda GPU id.
- is_eval_only Whether to run evaluation only. (In evaluation, it will place all macros rather than only up to
context_length.)
- test_all_macro Whether to place all macros.
For odt.py:
- replay_size Replay buffer size for fine-tuning.
- traj_len Maximum sequence length for the Decision Transformer.
- batch_size Batch size.
- benchmark Circuit benchmark for fine-tuning.
- max_online_iters Maximum number of fine-tuning iterations.
- eval_interval Evaluate every N iterations.
- exploration_rtg Return-to-go value for exploration.
- is_fifo Whether to use a FIFO buffer or a priority buffer.
- cuda GPU id.
Dependencies
- Python >= 3.9
- PyTorch >= 1.10
- Other versions may also work, but have not been tested.
- tqdm
Reference code
This code is based on the following open-source repos:
Citation
If you find our paper/code useful in your research, please cite:
@inproceedings{lai2023chipformer,
author = {Lai, Yao and Liu, Jinxin and Tang, Zhentao and Wang, Bin and Hao, Jianye and Luo, Ping},
title = {ChiPFormer: Transferable Chip Placement via Offline Decision Transformer},
booktitle = {International Conference on Machine Learning, {ICML} 2023, 23-29 July
2023, Honolulu, Hawaii, {USA}},
series = {Proceedings of Machine Learning Research},
volume = {202},
pages = {18346--18364},
publisher = {{PMLR}},
year = {2023},
url = {https://proceedings.mlr.press/v202/lai23c.html},
}
评论