Skip to content

Commit 8e4066d

Browse files
committed
Merge branch 'master' into sky130hd-uW-tighten
Signed-off-by: Matt Liberty <[email protected]>
2 parents 35de064 + 205796f commit 8e4066d

Some content is hidden

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

67 files changed

+1632
-755
lines changed

bazel/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# OpenROAD-flow-scripts and Bazel integration
2+
3+
`bazel-orfs` is a Bazel package containing the definitions and logic governing the build process of ORFS designs.
4+
The module uses the `openroad/orfs` docker image to extract the flow scripts with dependencies, builds the Bazel environment around them and defines the methods of calling the ORFS Makefiles with selected designs.
5+
6+
## Run examples
7+
8+
`flow/BUILD.bazel` contains definitions for various flows to serve as examples.
9+
10+
It is recommended to run the utility [Bazelisk](https://github.com/bazelbuild/bazelisk) to manage the version of `bazel` installed on the system.
11+
Details on installation can be found in the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#requirements)
12+
13+
The flow can be ran with the following call structure:
14+
15+
```bash
16+
bazel build <target_name>_<stage_name>
17+
```
18+
19+
For example, to run the stage `final`, along with all the dependent stages, call:
20+
```bash
21+
bazel build gcd_final
22+
```
23+
24+
Details on usage and defining of the flows are presented in the Usage section of the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage)
25+
26+
## Dependency version management
27+
28+
In the flow scipts, the `bazel-orfs` version is defined as
29+
30+
```starlark
31+
bazel_dep(name = "bazel-orfs")
32+
git_override(
33+
module_name = "bazel-orfs",
34+
commit = "<Hash of the default bazel-orfs commit>",
35+
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
36+
)
37+
```
38+
However, as the referenced documentation shows, the git-based dependency can be overridden with a local repository.
39+
First, remove the `git_override` call entirely and replace it with a `local_path_override` call following this convention:
40+
41+
```starlark
42+
local_path_override(
43+
module_name = "bazel-orfs",
44+
path = "/replace/with/path/to/local/orfs/repository"
45+
)
46+
```
47+
48+
`bazel-orfs` sets a default version of the docker image used to create the Bazel environment.
49+
This selection can be overridden by a following snippet inserted below the `bazel-orfs` declaration and override.
50+
51+
```starlark
52+
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
53+
orfs.default(
54+
image = "tag-name",
55+
sha256 = "the-hash",
56+
)
57+
```
58+
59+
Substitute `tag-name` with the tag of the version needed and `the-hash` with the digest corresponding to the selected tag (without the `sha256:` prefix).
60+

build_openroad.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
set -eu
66

77
# Make sure we are on the correct folder before beginning
8-
cd "$(dirname $(readlink -f $0))"
8+
DIR="$(dirname $(readlink -f $0))"
9+
cd "$DIR"
910

1011
# Set up paths to dependencies, such as cmake and boost. Safe no-op
1112
# if tools were set up elsewhere in the path.
@@ -62,13 +63,13 @@ Options:
6263
--yosys-args-overwrite Do not use default flags set by this scrip during
6364
Yosys compilation.
6465
65-
--yosys-args STRING Aditional compilation flags for Yosys compilation.
66+
--yosys-args STRING Additional compilation flags for Yosys compilation.
6667
6768
--openroad-args-overwrite
6869
Do not use default flags set by this scrip during
6970
OpenROAD app compilation.
7071
71-
--openroad-args STRING Aditional compilation flags for OpenROAD app
72+
--openroad-args STRING Additional compilation flags for OpenROAD app
7273
compilation.
7374
7475
--install-path PATH Path to install tools. Default is ${INSTALL_PATH}.
@@ -84,7 +85,7 @@ Options:
8485
Options valid only for Docker builds:
8586
-c, --copy-platforms Copy platforms to inside docker image.
8687
87-
--os=DOCKER_OS_NAME Choose beween ubuntu22.04 (default), ubuntu20.04.
88+
--os=DOCKER_OS_NAME Choose between ubuntu22.04 (default), ubuntu20.04.
8889
8990
This script builds the OpenROAD tools: openroad, yosys and yosys plugins.
9091
By default, the tools will be built from the linked submodule hashes.
@@ -128,14 +129,14 @@ while (( "$#" )); do
128129
DOCKER_COPY_PLATFORMS=1
129130
;;
130131
--yosys-args-overwrite)
131-
YOSYS_OVERWIRTE_ARGS=1
132+
YOSYS_OVERWRITE_ARGS=1
132133
;;
133134
--yosys-args)
134135
YOSYS_USER_ARGS="$2"
135136
shift
136137
;;
137138
--openroad-args-overwrite)
138-
OPENROAD_APP_OVERWIRTE_ARGS=1
139+
OPENROAD_APP_OVERWRITE_ARGS=1
139140
;;
140141
--openroad-args)
141142
OPENROAD_APP_USER_ARGS="$2"
@@ -189,14 +190,14 @@ if [ -n "$CMAKE_INSTALL_RPATH" ]; then
189190
fi
190191

191192
__args_setup() {
192-
if [ ! -z "${YOSYS_OVERWIRTE_ARGS+x}" ]; then
193+
if [ ! -z "${YOSYS_OVERWRITE_ARGS+x}" ]; then
193194
echo "[INFO FLW-0014] Overwriting Yosys compilation flags."
194195
YOSYS_ARGS="${YOSYS_USER_ARGS}"
195196
else
196197
YOSYS_ARGS+=" ${YOSYS_USER_ARGS}"
197198
fi
198199

199-
if [ ! -z "${OPENROAD_APP_OVERWIRTE_ARGS+x}" ]; then
200+
if [ ! -z "${OPENROAD_APP_OVERWRITE_ARGS+x}" ]; then
200201
echo "[INFO FLW-0015] Overwriting OpenROAD app compilation flags."
201202
OPENROAD_APP_ARGS="${OPENROAD_APP_USER_ARGS}"
202203
else
@@ -246,7 +247,7 @@ __local_build()
246247
${NICE} make install -C tools/yosys -j "${PROC}" ${YOSYS_ARGS}
247248

248249
echo "[INFO FLW-0018] Compiling OpenROAD."
249-
eval ${NICE} cmake tools/OpenROAD -B tools/OpenROAD/build ${OPENROAD_APP_ARGS}
250+
eval ${NICE} ./tools/OpenROAD/etc/Build.sh -dir="$DIR/tools/OpenROAD/build" -threads=${PROC} -cmake=\'${OPENROAD_APP_ARGS}\'
250251
${NICE} cmake --build tools/OpenROAD/build --target install -j "${PROC}"
251252
}
252253

docker/Dockerfile.builder

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ COPY --link tools tools
1919
ARG numThreads=$(nproc)
2020
2121
RUN echo "" > tools/yosys/abc/.gitcommit && \
22+
env CFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
23+
CXXFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
2224
./build_openroad.sh --no_init --local --threads ${numThreads}
2325

2426
FROM orfs-base
@@ -33,6 +35,7 @@ COPY --link flow/platforms flow/platforms
3335
COPY --link flow/util flow/util
3436
COPY --link flow/scripts flow/scripts
3537
COPY --link flow/designs flow/designs
38+
COPY --link tools/AutoTuner tools/AutoTuner
3639

3740
COPY --link --from=orfs-builder-base /OpenROAD-flow-scripts/tools/install tools/install
3841
COPY --link \

docker/Dockerfile.dev

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ COPY InstallerOpenROAD.sh \
1313
/tmp/installer/tools/OpenROAD/etc/DependencyInstaller.sh
1414

1515
ARG options=""
16+
ARG constantBuildDir="-constant-build-dir"
1617

17-
RUN ./DependencyInstaller.sh $options \
18+
RUN env CFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
19+
CXXFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
20+
./DependencyInstaller.sh $options $constantBuildDir \
1821
&& rm -rf /tmp/installer /tmp/* /var/tmp/* /var/lib/apt/lists/*
1922

2023
ARG fromImage

docs/user/FlowVariables.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Note:
7272
| `PDN_TCL` | ?= | ?= | ?= | ?= | ?= |
7373
| `IO_PLACER_H` | = | = | = | = | ?= |
7474
| `IO_PLACER_V` | = | = | = | = | ?= |
75+
| `FILL_CELLS` | = | = | = | = | = |
7576
| Placement | | | | | |
7677
| `CELL_PAD_IN_SITES_GLOBAL_PLACEMENT` | ?= | ?= | ?= | ?= | ?= |
7778
| `CELL_PAD_IN_SITES_DETAIL_PLACEMENT` | ?= | ?= | ?= | ?= | ?= |
@@ -85,7 +86,6 @@ Note:
8586
| `EQUIVALENCE_CHECK` | ?= | ?= | ?= | ?= | ?= |
8687
| `REMOVE_CELLS_FOR_EQY` | ?= | ?= | ?= | ?= | ?= |
8788
| Routing | | | | | |
88-
| `FILL_CELLS` | = | = | = | = | = |
8989
| `KLAYOUT_TECH_FILE` | = | = | = | = | = |
9090
| `MAX_ROUTING_LAYER` | = | = | = | = | ?= |
9191
| `MIN_ROUTING_LAYER` | = | = | = | = | ?= |
@@ -147,6 +147,8 @@ Note:
147147
| `GUI_NO_TIMING` | Skip loading timing for a faster GUI load. |
148148
| `GUI_SOURCE` | Source the script. |
149149
| `GUI_ARGS` | OpenROAD command line options for gui_ and open_ targets, typically set tup `-exit` in combination with GUI_SOURCE to run a script and exit. |
150+
| `FILL_CELLS` | Fill cells are used to fill empty sites. If not set or empty, fill cell insertion is skipped. |
151+
| `TAP_CELL_NAME` | Name of the cell to use in tap cell insertion. |
150152

151153

152154
### Placement
@@ -189,7 +191,6 @@ Note:
189191

190192
| Variable | Description |
191193
|-----------------------|---------------------------------------------------------------------------------------------------|
192-
| `FILL_CELLS` | Fill cells are used to fill empty sites. |
193194
| `MIN_ROUTING_LAYER` | The lowest metal layer name to be used in routing. |
194195
| `MAX_ROUTING_LAYER` | The highest metal layer name to be used in routing. |
195196
| `DETAILED_ROUTE_ARGS` | Add additional arguments for debugging purpose during detail route. |
@@ -264,16 +265,18 @@ configuration file.
264265

265266
| Variable | Description |
266267
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
267-
| `CORE_UTILIZATION` | The core utilization percentage (0-100). Overrides `DIE_AREA` and `CORE_AREA`. |
268-
| `CORE_ASPECT_RATIO` | The core aspect ratio (height / width). This values is ignored if `CORE_UTILIZATION` undefined. |
269-
| `CORE_MARGIN` | The margin between the core area and die area, in multiples of SITE heights. The margin is applied to each side. This variable is ignored if `CORE_UTILIZATION` is undefined. |
270-
| `DIE_AREA` | The die area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). This variable is ignored if `CORE_UTILIZATION` and `CORE_ASPECT_RATIO` are defined. |
271-
| `CORE_AREA` | The core area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). This variable is ignored if `CORE_UTILIZATION` and `CORE_ASPECT_RATIO` are defined. |
268+
| `CORE_UTILIZATION` | The core utilization percentage (0-100). |
269+
| `CORE_ASPECT_RATIO` | The core aspect ratio (height / width). This values is ignored if `CORE_UTILIZATION` undefined. |
270+
| `CORE_MARGIN` | The margin between the core area and die area, in multiples of SITE heights. The margin is applied to each side. This variable is ignored if `CORE_UTILIZATION` is undefined. |
271+
| `DIE_AREA` | The die area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). |
272+
| `CORE_AREA` | The core area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). |
272273
| `RESYNTH_AREA_RECOVER` | Enable re-synthesis for area reclaim. |
273274
| `RESYNTH_TIMING_RECOVER` | Enable re-synthesis for timing optimization. |
274275
| `MACRO_HALO_X` | Set macro halo for x-direction. Only available for ASAP7 PDK. |
275276
| `MACRO_HALO_Y` | Set macro halo for y-direction. Only available for ASAP7 PDK. |
276277

278+
The various methods to specify the die and core area(`FLOORPLAN_DEF`, `FOOTPRINT`, `DIE_AREA` and `CORE_UTILIZATION`) are mutually exclusive. If two methods are specified, floorplan.tcl will exit with an error requiring that a single method is used.
279+
277280
#### Placement
278281

279282

docs/user/InstructionsForAutoTuner.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@ User-defined coefficient values (`coeff_perform`, `coeff_power`, `coeff_area`) o
2323

2424
## Setting up AutoTuner
2525

26-
To setup AutoTuner, make sure you have a virtual environment set up with
27-
Python 3.9.X. There are plenty of ways to do this, we recommend using
28-
[Miniconda](https://docs.conda.io/en/latest/miniconda.html),
29-
which is a free minimal installer for the package manager `conda`.
26+
We have provided two convenience scripts, `./install.sh` and `./setup.sh`
27+
that works in Python3.8 for installation and configuration of AutoTuner,
28+
as shown below:
3029

3130
```shell
32-
# set up conda environment
33-
conda create -n autotuner_env python=3.9
34-
conda activate autotuner_env
31+
# Install prerequisites
32+
./tools/AutoTuner/install.sh
3533

36-
# install requirements
37-
pip install -r ./tools/AutoTuner/requirements.txt
34+
# Start virtual environment
35+
./tools/AutoTuner/setup.sh
3836
```
3937

4038
## Input JSON structure
@@ -198,6 +196,15 @@ We show three different views possible at the end, namely: `Table View`, `Scatte
198196
![Parallel Coordinate View](../images/Autotuner_best_parameter_view.webp)
199197
<p style="text-align: center;">Parallel Coordinate View (best run is in green)</p>
200198

199+
## Testing framework
200+
201+
Assuming the virtual environment is setup at `./tools/AutoTuner/autotuner_env`:
202+
203+
```
204+
./tools/AutoTuner/setup.sh
205+
python3 ./tools/AutoTuner/test/smoke_test_sweep.py
206+
python3 ./tools/AutoTuner/test/smoke_test_tune.py
207+
```
201208

202209
## Citation
203210

etc/DependencyInstaller.sh

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ _installCommon() {
3636
pip3 install --no-cache-dir --user -U $pkgs
3737
fi
3838

39-
baseDir=$(mktemp -d /tmp/DependencyInstaller-orfs-XXXXXX)
39+
if [[ "$constantBuildDir" == "true" ]]; then
40+
baseDir="/tmp/DependencyInstaller-ORFS"
41+
if [[ -d "$baseDir" ]]; then
42+
echo "[INFO] Removing old building directory $baseDir"
43+
fi
44+
mkdir -p "$baseDir"
45+
else
46+
baseDir=$(mktemp -d /tmp/DependencyInstaller-orfs-XXXXXX)
47+
fi
4048

4149
# Install Verilator
4250
verilatorPrefix=`realpath ${PREFIX:-"/usr/local"}`
@@ -126,7 +134,9 @@ _installUbuntuPackages() {
126134
zlib1g-dev
127135

128136
# install KLayout
129-
if _versionCompare $1 -ge 23.04; then
137+
if [[ $1 == "rodete" ]]; then
138+
apt-get -y install --no-install-recommends klayout python3-pandas
139+
elif _versionCompare "$1" -ge 23.04; then
130140
apt-get -y install --no-install-recommends klayout python3-pandas
131141
else
132142
arch=$(uname -m)
@@ -160,6 +170,14 @@ _installUbuntuPackages() {
160170
rm -rf "${baseDir}"
161171
fi
162172

173+
if command -v docker &> /dev/null; then
174+
# The user can uninstall docker if they want to reinstall it,
175+
# and also this allows the user to choose drop in replacements
176+
# for docker, such as podman-docker
177+
echo "Docker is already installed, skip docker reinstall."
178+
return 0
179+
fi
180+
163181
# Add Docker's official GPG key:
164182
install -m 0755 -d /etc/apt/keyrings
165183
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
@@ -172,11 +190,13 @@ _installUbuntuPackages() {
172190
tee /etc/apt/sources.list.d/docker.list > /dev/null
173191

174192
apt-get -y update
175-
apt-get -y install --no-install-recommends \
176-
docker-ce \
177-
docker-ce-cli \
178-
containerd.io \
179-
docker-buildx-plugin
193+
if [[ $1 != "rodete" ]]; then
194+
apt-get -y install --no-install-recommends \
195+
docker-ce \
196+
docker-ce-cli \
197+
containerd.io \
198+
docker-buildx-plugin
199+
fi
180200
}
181201

182202
_installDarwinPackages() {
@@ -227,6 +247,9 @@ Usage: $0
227247
# sudo or with root access.
228248
$0 -ci
229249
# Installs CI tools
250+
$0 -constant-build-dir
251+
# Use constant build directory, instead of
252+
# random one.
230253
EOF
231254
exit "${1:-1}"
232255
}
@@ -239,6 +262,7 @@ PREFIX=""
239262
option="all"
240263
# default isLocal
241264
isLocal="false"
265+
constantBuildDir="false"
242266
CI="no"
243267

244268
# default values, can be overwritten by cmdline args
@@ -266,11 +290,16 @@ while [ "$#" -gt 0 ]; do
266290
;;
267291
-ci)
268292
CI="yes"
293+
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} -save-deps-prefixes=/etc/openroad_deps_prefixes.txt"
269294
;;
270295
-prefix=*)
271296
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} $1"
272297
PREFIX=${1#*=}
273298
;;
299+
-constant-build-dir)
300+
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} $1"
301+
constantBuildDir="true"
302+
;;
274303
*)
275304
echo "unknown option: ${1}" >&2
276305
_help
@@ -315,8 +344,11 @@ case "${os}" in
315344
_installCommon
316345
fi
317346
;;
318-
"Ubuntu" )
347+
"Ubuntu" | "Debian GNU/Linux rodete" )
319348
version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g')
349+
if [[ -z ${version} ]]; then
350+
version=$(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release | sed 's/"//g')
351+
fi
320352
if [[ ${CI} == "yes" ]]; then
321353
echo "Installing CI Tools"
322354
_installCI
@@ -327,7 +359,9 @@ case "${os}" in
327359
_installUbuntuCleanUp
328360
fi
329361
if [[ "${option}" == "common" || "${option}" == "all" ]]; then
330-
if _versionCompare ${version} -lt 23.04 ; then
362+
if [[ $version == "rodete" ]]; then
363+
echo "Skip common for rodete"
364+
elif _versionCompare ${version} -lt 23.04 ; then
331365
_installCommon
332366
fi
333367
fi

0 commit comments

Comments
 (0)