Skip to content

Commit 10e58c0

Browse files
committed
formatted files and made imports relative to a2perf
1 parent 21862e6 commit 10e58c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+616
-502
lines changed

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

PRINCIPLES.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,18 @@ In addition to the above objectives, we will not design or deploy AI in the
125125
following application areas:
126126

127127
* Technologies that cause or are likely to cause overall harm. Where there is a
128-
material risk of harm, we will proceed only where we believe that the benefits
129-
substantially outweigh the risks, and will incorporate appropriate safety
130-
constraints.
128+
material risk of harm, we will proceed only where we believe that the benefits
129+
substantially outweigh the risks, and will incorporate appropriate safety
130+
constraints.
131131

132132
* Weapons or other technologies whose principal purpose or implementation is to
133-
cause or directly facilitate injury to people.
133+
cause or directly facilitate injury to people.
134134

135135
* Technologies that gather or use information for surveillance violating
136-
internationally accepted norms.
136+
internationally accepted norms.
137137

138138
* Technologies whose purpose contravenes widely accepted principles of
139-
international law and human rights.
140-
139+
international law and human rights.
141140

142141
## AI for the long term
143142

README.md

Lines changed: 57 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,25 @@ scaling to 100s of actors.
5353

5454
## Features
5555

56-
* Places netlists with hundreds of macros and millions of stdcells (in
57-
clustered format).
58-
* Computes both macro location and orientation (flipping).
59-
* Optimizes multiple objectives including wirelength, congestion, and density.
60-
* Supports alignment of blocks to the grid, to model clock strap or macro
61-
blockage.
62-
* Supports macro-to-macro, macro-to-boundary spacing constraints.
63-
* Supports fixed macros.
64-
* Supports [DREAMPlace](https://github.com/limbo018/DREAMPlace) as the stdcell placer.
65-
* Allows users to specify their own technology parameters, e.g. and routing
66-
resources (in routes per micron) and macro routing allocation.
67-
* Generates
68-
[clustered netlists](https://github.com/google-research/circuit_training/tree/main/circuit_training/grouping).
69-
* [TILOS-AI-Institute](https://www.tilos.ai/) has created a
70-
[script](https://github.com/TILOS-AI-Institute/MacroPlacement/tree/main/CodeElements/FormatTranslators)
71-
to convert LEF/DEF and Bookshelf to the
72-
[Netlist Protocol Buffer](https://github.com/google-research/circuit_training/blob/main/docs/NETLIST_FORMAT.md)
73-
used as the input for circuit training.
56+
* Places netlists with hundreds of macros and millions of stdcells (in
57+
clustered format).
58+
* Computes both macro location and orientation (flipping).
59+
* Optimizes multiple objectives including wirelength, congestion, and density.
60+
* Supports alignment of blocks to the grid, to model clock strap or macro
61+
blockage.
62+
* Supports macro-to-macro, macro-to-boundary spacing constraints.
63+
* Supports fixed macros.
64+
* Supports [DREAMPlace](https://github.com/limbo018/DREAMPlace) as the stdcell
65+
placer.
66+
* Allows users to specify their own technology parameters, e.g. and routing
67+
resources (in routes per micron) and macro routing allocation.
68+
* Generates
69+
[clustered netlists](https://github.com/google-research/circuit_training/tree/main/circuit_training/grouping).
70+
* [TILOS-AI-Institute](https://www.tilos.ai/) has created a
71+
[script](https://github.com/TILOS-AI-Institute/MacroPlacement/tree/main/CodeElements/FormatTranslators)
72+
to convert LEF/DEF and Bookshelf to the
73+
[Netlist Protocol Buffer](https://github.com/google-research/circuit_training/blob/main/docs/NETLIST_FORMAT.md)
74+
used as the input for circuit training.
7475

7576
<a id='Installation'></a>
7677

@@ -91,9 +92,8 @@ The steps below install the most recent branch and the archive is in the
9192
[releases section](#releases). There are two methods for installing; but before
9293
doing either one you need to run the preliminary setup](#preliminary-setup).
9394

94-
* [Use the docker](#using-the-docker) (**Highly Recommended**)
95-
* [Install locally](#install-locally)
96-
95+
* [Use the docker](#using-the-docker) (**Highly Recommended**)
96+
* [Install locally](#install-locally)
9797

9898
### Preliminary Setup
9999

@@ -143,17 +143,15 @@ Do not forget to do the [prelimary setup](#preliminary-setup).
143143

144144
Circuit Training installation steps:
145145

146-
* Install our DREAMPlace binary.
147-
* Install TF-Agents and The Placement Cost Binary
148-
* Run a test
149-
146+
* Install our DREAMPlace binary.
147+
* Install TF-Agents and The Placement Cost Binary
148+
* Run a test
150149

151150
#### Install DREAMPlace
152151

153152
Follow the [instructions](#install-dreamplace) for DREAMPlace but do not change
154153
the ENV VARS that you already exported previously.
155154

156-
157155
#### Install TF-Agents and the Placement Cost binary
158156

159157
These commands install TF-Agents and the placement cost binary.
@@ -177,7 +175,6 @@ to `tf-agents[reverb]~=<version you want>`
177175
tox -e py39-stable -- circuit_training/grouping/grouping_test.py
178176
```
179177

180-
181178
## HEAD
182179

183180
We recommand using [stable](#stable) branches; but our team does work from the
@@ -188,9 +185,8 @@ The steps below install the most recent branch and the archive is in the
188185
[releases section](#releases). There are two methods for installing; but before
189186
doing either one you need to run the [preliminary setup](#preliminary-setup-2).
190187

191-
* [Use the docker](#using-the-docker-2) (**Highly Recommended**)
192-
* [Install locally](#install-locally-2)
193-
188+
* [Use the docker](#using-the-docker-2) (**Highly Recommended**)
189+
* [Install locally](#install-locally-2)
194190

195191
### Preliminary Setup
196192

@@ -231,16 +227,15 @@ $ docker run --rm -v ${REPO_ROOT}:/workspace --workdir /workspace circuit_traini
231227

232228
Circuit Training installation steps:
233229

234-
* Install our DREAMPlace binary.
235-
* Install TF-Agents Nightly and the placement cost binary
236-
* Run a test
230+
* Install our DREAMPlace binary.
231+
* Install TF-Agents Nightly and the placement cost binary
232+
* Run a test
237233

238234
#### Install DREAMPlace
239235

240236
Follow the [instructions](#install-dreamplace) for DREAMPlace but do not change
241237
the ENV VARS that you already exported previously.
242238

243-
244239
#### Install TF-Agents and the Placement Cost binary
245240

246241
These commands install TF-Agents and the placement cost binary.
@@ -264,7 +259,7 @@ tox -e py39-nightly -- circuit_training/grouping/grouping_test.py
264259

265260
## Install DREAMPlace
266261

267-
DREAMPlace is **not** provided as a PyPi package and needs to be compilede. We
262+
DREAMPlace is **not** provided as a PyPi package and needs to be compilede. We
268263
provide compiled versions of DREAMPlace taken from our
269264
[branch](https://github.com/esonghori/DREAMPlace/tree/circuit_training) for a
270265
range of Python versions built for our docker image (Ubuntu 20.4). We also use
@@ -355,12 +350,11 @@ the filename pattern can be used to install DREAMPle for the versions of Python
355350
supported. For the Placement Cost binary, the ULR is to the version of the PLC
356351
used at the time the branch was cut.
357352

358-
Release | Branch / Tag | TF-Agents | DREAMPlace | PL
359-
------- | ------------------------------------------------------------------------- | ------------------------- | -------------------------------- | -------------- |
360-
HEAD | [main](https://github.com/google-research/circuit-training) | tf-agents-nightly[reverb] |
361-
0.0.3 | [v0.0.3](https://github.com/google-research/circuit_training/tree/v0.0.3) | tf-agents[reverb]~=0.16.0 | dreamplace_20230414_b31e8af_python3.9.tar.gz | [placement cost binary](https://storage.googleapis.com/rl-infra-public/circuit-training/placement_cost/plc_wrapper_main_0.0.3)
362-
0.0.2 | [v0.0.2](https://github.com/google-research/circuit_training/tree/v0.0.2) | tf-agents[reverb]~=0.16.0 |
363-
353+
Release | Branch / Tag | TF-Agents | DREAMPlace | PL
354+
---------|---------------------------------------------------------------------------|---------------------------|----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
355+
HEAD | [main](https://github.com/google-research/circuit-training) | tf-agents-nightly[reverb] |
356+
0.0.3 | [v0.0.3](https://github.com/google-research/circuit_training/tree/v0.0.3) | tf-agents[reverb]~=0.16.0 | dreamplace_20230414_b31e8af_python3.9.tar.gz | [placement cost binary](https://storage.googleapis.com/rl-infra-public/circuit-training/placement_cost/plc_wrapper_main_0.0.3)
357+
0.0.2 | [v0.0.2](https://github.com/google-research/circuit_training/tree/v0.0.2) | tf-agents[reverb]~=0.16.0 |
364358

365359
<a id='Results'></a>
366360

@@ -382,20 +376,20 @@ for 3 different seeds run 3 times each. This is slightly different than what was
382376
used in the paper (8 runs each with a different seed), but better captures the
383377
different sources of variability.
384378

385-
Metric | Proxy Wirelength | Proxy Congestion | Proxy Density
386-
-------- | ---------------- | ---------------- | -------------
387-
**mean** | 0.1013 | 0.9174 | 0.5502
388-
**std** | 0.0036 | 0.0647 | 0.0568
379+
Metric | Proxy Wirelength | Proxy Congestion | Proxy Density
380+
----------|------------------|------------------|---------------
381+
**mean** | 0.1013 | 0.9174 | 0.5502
382+
**std** | 0.0036 | 0.0647 | 0.0568
389383

390384
The table below summarizes the
391385
[paper](https://www.nature.com/articles/s41586-021-03544-w.epdf?sharing_token=tYaxh2mR5EozfsSL0WHZLdRgN0jAjWel9jnR3ZoTv0PW0K0NmVrRsFPaMa9Y5We9O4Hqf_liatg-lvhiVcYpHL_YQpqkurA31sxqtmA-E1yNUWVMMVSBxWSp7ZFFIWawYQYnEXoBE4esRDSWqubhDFWUPyI5wK_5B_YIO-D_kS8%3D)
392386
result for fine-tuning from a pre-trained model over 8 runs with each one using
393387
a different seed.
394388

395-
Metric | Proxy Wirelength | Proxy Congestion | Proxy Density
396-
-------- | ---------------- | ---------------- | -------------
397-
**mean** | 0.1198 | 0.9718 | 0.5729
398-
**std** | 0.0019 | 0.0346 | 0.0086
389+
Metric | Proxy Wirelength | Proxy Congestion | Proxy Density
390+
----------|------------------|------------------|---------------
391+
**mean** | 0.1198 | 0.9718 | 0.5729
392+
**std** | 0.0019 | 0.0346 | 0.0086
399393

400394
<a id='FAQ'></a>
401395

@@ -547,20 +541,20 @@ We would like to recognize the following individuals for their code
547541
contributions, discussions, and other work to make the release of the Circuit
548542
Training library possible.
549543

550-
* Sergio Guadarrama
551-
* Summer Yue
552-
* Ebrahim Songhori
553-
* Joe Jiang
554-
* Toby Boyd
555-
* Azalia Mirhoseini
556-
* Anna Goldie
557-
* Mustafa Yazgan
558-
* Shen Wang
559-
* Terence Tam
560-
* Young-Joon Lee
561-
* Roger Carpenter
562-
* Quoc Le
563-
* Ed Chi
544+
* Sergio Guadarrama
545+
* Summer Yue
546+
* Ebrahim Songhori
547+
* Joe Jiang
548+
* Toby Boyd
549+
* Azalia Mirhoseini
550+
* Anna Goldie
551+
* Mustafa Yazgan
552+
* Shen Wang
553+
* Terence Tam
554+
* Young-Joon Lee
555+
* Roger Carpenter
556+
* Quoc Le
557+
* Ed Chi
564558

565559
<a id='Citation'></a>
566560

__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import gym as legacy_gym
2+
import gymnasium as gym
3+
4+
# Register the environments with the relative path
5+
gym.envs.register(
6+
id='QuadrupedLocomotion-v0',
7+
apply_api_compatibility=True,
8+
entry_point='a2perf.domains.quadruped_locomotion.motion_imitation.envs.env_builder:build_imitation_env',
9+
kwargs={
10+
}
11+
)
12+
13+
legacy_gym.envs.register(
14+
id='QuadrupedLocomotion-v0',
15+
entry_point='a2perf.domains.quadruped_locomotion.motion_imitation.envs.env_builder:build_imitation_env',
16+
kwargs={
17+
}
18+
)

circuit_training/dreamplace/dreamplace_core.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
"""A soft macro placer using Dreamplace."""
1616
import time
1717

18-
from absl import logging
19-
from circuit_training.dreamplace import dreamplace_util
20-
from circuit_training.dreamplace import placedb_plc
21-
from dreamplace import NonLinearPlace
2218
import gin
2319
import timeout_decorator
20+
from absl import logging
21+
from dreamplace import NonLinearPlace
22+
23+
from a2perf.domains.circuit_training.circuit_training.dreamplace import \
24+
dreamplace_util
25+
from a2perf.domains.circuit_training.circuit_training.dreamplace import \
26+
placedb_plc
2427

2528

2629
@gin.configurable(allowlist=['enable_timeout'])

circuit_training/dreamplace/dreamplace_main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616

1717
import random
1818

19-
from absl import app
20-
from absl import flags
21-
from circuit_training.dreamplace import dreamplace_core
22-
from circuit_training.dreamplace import dreamplace_util
2319
import numpy as np
2420
import torch
21+
from absl import app
22+
from absl import flags
23+
24+
from a2perf.domains.circuit_training.circuit_training.dreamplace import \
25+
dreamplace_core
26+
from a2perf.domains.circuit_training.circuit_training.dreamplace import \
27+
dreamplace_util
2528

2629
_SEED = flags.DEFINE_integer(
2730
'seed', 0, 'RNG seed for all algorithms.If None, RNG is not seeded.'

circuit_training/dreamplace/dreamplace_util.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
import time
2020
from typing import Optional
2121

22+
import gin
2223
from absl import logging
23-
import circuit_training.environment.placement_util as util
2424
from dreamplace import Params
25-
import gin
25+
26+
import \
27+
a2perf.domains.circuit_training.circuit_training.environment.placement_util as util
2628

2729

2830
def print_and_save_result(

circuit_training/dreamplace/dreamplace_util_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
# limitations under the License.
1515
"""Test for dreamplace_util."""
1616

17-
from circuit_training.dreamplace import dreamplace_util
18-
from circuit_training.utils import test_utils
17+
from a2perf.domains.circuit_training.circuit_training.dreamplace import \
18+
dreamplace_util
19+
from a2perf.domains.circuit_training.circuit_training.utils import test_utils
1920

2021

2122
class DreamplaceUtilTest(test_utils.TestCase):

circuit_training/dreamplace/placedb_plc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
Realistic placement is done in dreamplace_core.
1919
"""
2020
from absl import logging
21-
from circuit_training.dreamplace import plc_converter
21+
22+
from a2perf.domains.circuit_training.circuit_training.dreamplace import \
23+
plc_converter
2224

2325

2426
class PlacedbPlc(object):

circuit_training/dreamplace/plc_converter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
"""
2121
import pickle
2222

23-
from absl import logging
24-
from dreamplace import PlaceDB
2523
import numpy as np
26-
2724
import tensorflow.io.gfile as gfile
25+
from absl import logging
26+
from dreamplace import PlaceDB
2827

2928

3029
def blockage_area(plc):

0 commit comments

Comments
 (0)