Greedy-Structured Offline-to-Online Reinforcement Learning for HPWL-driven logic optimization sequencing.
Repository: https://github.com/HAHHHD/GS-O2O
This repository contains the code for GS-O2O, an offline-to-online reinforcement learning framework for sequential logic optimization under an expensive HPWL reward oracle.
At each step, the agent selects one ABC optimization operator. The true reward is computed from a deterministic backend flow that includes mapping and physically-aware replacement, while test-time action selection is restricted to cheap AIG-level features only.
The main method:
- collects a greedy-structured offline dataset by evaluating all actions at each state and rolling forward only the best immediate-HPWL branch,
- learns decomposed reward, value, and Q-ensemble models from cheap AIG features,
- performs budgeted online adaptation using only one HPWL query per executed action,
- deploys without querying mapping, placement, or HPWL during action selection.
The main experiment setting in this release is:
comb45benchmark suite32training circuits,13test circuits- horizon
H = 20 9logic optimization operators- fair round-aligned online budgets
0 / 32 / 64 / 96
This release contains only source code, configs, included benchmarks, scripts, and the vendored Modal ABC source snapshot.
GS-O2O-release/
benchmarks/ benchmark BLIFs and split metadata
configs/ stable experiment configs
scripts/ runnable entrypoints
src/ main implementation
vendor/ vendored ABC source snapshot for Modal builds
modal_train.py
modal_evaluate.py
pyproject.toml
uv.lock
README.md
The following directories are created only when you run experiments and are not tracked in Git:
data*/models/checkpoints*/results*/work*/
src/collect_d2.py: offline D2 dataset collectionsrc/train_gso2o.py: offline GS-O2O trainingsrc/online_gso2o.py: online GS-O2O trainingsrc/evaluate.py: evaluation on train/test splitssrc/baselines_awac.py: AWAC baselinesrc/baselines_iql.py: IQL baselinesrc/baselines_cql.py: CQL baselinesrc/expanded_experiments.py: serial experiment driver for the main comparisonscripts/run_comb45_main.sh: one-command reproduction of the main paper experiment
- Python
>= 3.10 uv- a working ABC binary
- the ASAP7 liberty file used by the HPWL backend flow
From the repository root:
uv syncThe release is set up to use the vendored local runtime assets inside this repository:
vendor/modal_abc_src/abcvendor/modal_abc_src/abc.rcvendor/modal_abc_src/asap7_clean.lib
The ABC runner automatically sources abc.rc when it is located next to the configured abc binary.
Important caveat: the checked-in vendor/modal_abc_src/abc binary is platform-specific. It should work if it matches your local OS and architecture, but users on other systems may need to rebuild or replace it while keeping the same path.
The main config is:
configs/comb45_hpwl_h20_op9.json
Before running locally, update abc_binary and mapping_lib in the config to:
vendor/modal_abc_src/abcvendor/modal_abc_src/asap7_clean.lib
YAML mirrors are also included for convenience.
The cleanest way to reproduce the main comb45 comparison is:
./scripts/run_comb45_main.shThis runs:
- D2 collection if processed tensors are missing
- offline training for
gso2o,awac,iql, andcql - offline evaluation at budget
0 - online training
- evaluation at budgets
32,64, and96 - aggregation tables
Equivalent manual command:
uv run python -m src.expanded_experiments \
--config configs/comb45_hpwl_h20_op9.json \
--methods gso2o,awac,iql,cql \
--seeds 0 \
--budgets 0,32,64,96The online comparison uses shuffled rounds over the 32 training circuits:
32episodes = 1 full pass over the train pool64episodes = 2 full passes96episodes = 3 full passes
This is the fair comparison used in the final benchmark table.
uv run python -m src.collect_d2 --config configs/comb45_hpwl_h20_op9.jsonGenerated outputs:
data_comb45_h20_op9/offline_d2/data_comb45_h20_op9/processed/
uv run python -m src.train_gso2o --config configs/comb45_hpwl_h20_op9.jsonuv run python -m src.online_gso2o --config configs/comb45_hpwl_h20_op9.jsonOffline-only:
uv run python -m src.evaluate \
--config configs/comb45_hpwl_h20_op9.json \
--method gso2o \
--split test \
--budget 0 \
--method-label gso2o_budget000Evaluate a saved online checkpoint:
uv run python -m src.evaluate \
--config configs/comb45_hpwl_h20_op9.json \
--method gso2o \
--split test \
--budget 96 \
--method-label gso2o_budget096 \
--checkpoint-dir models/checkpoints_comb45_h20_op9/seed_000/budget_0096Offline:
uv run python -m src.baselines_awac --config configs/comb45_hpwl_h20_op9.json --stage offline
uv run python -m src.baselines_iql --config configs/comb45_hpwl_h20_op9.json --stage offline
uv run python -m src.baselines_cql --config configs/comb45_hpwl_h20_op9.json --stage offlineOnline:
uv run python -m src.baselines_awac --config configs/comb45_hpwl_h20_op9.json --stage online
uv run python -m src.baselines_iql --config configs/comb45_hpwl_h20_op9.json --stage online
uv run python -m src.baselines_cql --config configs/comb45_hpwl_h20_op9.json --stage onlineAfter running experiments, the main generated outputs are:
results_comb45_h20_op9/seed_000/logs/results_comb45_h20_op9/seed_000/sequences/results_comb45_h20_op9/seed_000/tables/
Important aggregate tables include:
results_comb45_h20_op9/tables/all_checkpoint_results.csvresults_comb45_h20_op9/tables/refine_variant_checkpoint_results.csvresults_comb45_h20_op9/tables/final_two_settings_32_64_96.csv
- The project uses corrected geomeans for ratio metrics.
paritycan produce zero HPWL under the deterministic backend flow, so ratio geomeans exclude it.- The greedy reference is a privileged oracle policy that evaluates all actions using true HPWL at every step. It is an upper bound, not a deployment-feasible baseline under the cheap-test-time constraint.
Modal entrypoints are included but optional:
modal_train.pymodal_evaluate.py
The main benchmark results discussed during development were run locally on CPU, but the Modal infrastructure is included for remote execution.
If this directory is already your clean standalone repo, push it with:
git add .
git commit -m "Initial commit: GS-O2O project release"
git push -u origin main