Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xtofalex committed Sep 24, 2024
2 parents 4d34f4a + cd6e626 commit b837f59
Show file tree
Hide file tree
Showing 166 changed files with 8,514 additions and 7,895 deletions.
19 changes: 10 additions & 9 deletions build_openroad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
set -eu

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

# Set up paths to dependencies, such as cmake and boost. Safe no-op
# if tools were set up elsewhere in the path.
Expand Down Expand Up @@ -62,13 +63,13 @@ Options:
--yosys-args-overwrite Do not use default flags set by this scrip during
Yosys compilation.
--yosys-args STRING Aditional compilation flags for Yosys compilation.
--yosys-args STRING Additional compilation flags for Yosys compilation.
--openroad-args-overwrite
Do not use default flags set by this scrip during
OpenROAD app compilation.
--openroad-args STRING Aditional compilation flags for OpenROAD app
--openroad-args STRING Additional compilation flags for OpenROAD app
compilation.
--install-path PATH Path to install tools. Default is ${INSTALL_PATH}.
Expand All @@ -84,7 +85,7 @@ Options:
Options valid only for Docker builds:
-c, --copy-platforms Copy platforms to inside docker image.
--os=DOCKER_OS_NAME Choose beween ubuntu22.04 (default), ubuntu20.04.
--os=DOCKER_OS_NAME Choose between ubuntu22.04 (default), ubuntu20.04.
This script builds the OpenROAD tools: openroad, yosys and yosys plugins.
By default, the tools will be built from the linked submodule hashes.
Expand Down Expand Up @@ -128,14 +129,14 @@ while (( "$#" )); do
DOCKER_COPY_PLATFORMS=1
;;
--yosys-args-overwrite)
YOSYS_OVERWIRTE_ARGS=1
YOSYS_OVERWRITE_ARGS=1
;;
--yosys-args)
YOSYS_USER_ARGS="$2"
shift
;;
--openroad-args-overwrite)
OPENROAD_APP_OVERWIRTE_ARGS=1
OPENROAD_APP_OVERWRITE_ARGS=1
;;
--openroad-args)
OPENROAD_APP_USER_ARGS="$2"
Expand Down Expand Up @@ -189,14 +190,14 @@ if [ -n "$CMAKE_INSTALL_RPATH" ]; then
fi

__args_setup() {
if [ ! -z "${YOSYS_OVERWIRTE_ARGS+x}" ]; then
if [ ! -z "${YOSYS_OVERWRITE_ARGS+x}" ]; then
echo "[INFO FLW-0014] Overwriting Yosys compilation flags."
YOSYS_ARGS="${YOSYS_USER_ARGS}"
else
YOSYS_ARGS+=" ${YOSYS_USER_ARGS}"
fi

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

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

Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ COPY --link tools tools
ARG numThreads=$(nproc)
RUN echo "" > tools/yosys/abc/.gitcommit && \
env CFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
CXXFLAGS="-D__TIME__=0 -D__DATE__=0 -D__TIMESTAMP__=0 -Wno-builtin-macro-redefined" \
./build_openroad.sh --no_init --local --threads ${numThreads}

FROM orfs-base
Expand All @@ -33,6 +35,7 @@ COPY --link flow/platforms flow/platforms
COPY --link flow/util flow/util
COPY --link flow/scripts flow/scripts
COPY --link flow/designs flow/designs
COPY --link tools/AutoTuner tools/AutoTuner

COPY --link --from=orfs-builder-base /OpenROAD-flow-scripts/tools/install tools/install
COPY --link \
Expand Down
5 changes: 4 additions & 1 deletion docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ COPY InstallerOpenROAD.sh \
/tmp/installer/tools/OpenROAD/etc/DependencyInstaller.sh

ARG options=""
ARG constantBuildDir="-constant-build-dir"

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

ARG fromImage
Expand Down
20 changes: 10 additions & 10 deletions docs/user/FlowVariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Note:
| `PDN_TCL` | ?= | ?= | ?= | ?= | ?= |
| `IO_PLACER_H` | = | = | = | = | ?= |
| `IO_PLACER_V` | = | = | = | = | ?= |
| `FILL_CELLS` | = | = | = | = | = |
| Placement | | | | | |
| `CELL_PAD_IN_SITES_GLOBAL_PLACEMENT` | ?= | ?= | ?= | ?= | ?= |
| `CELL_PAD_IN_SITES_DETAIL_PLACEMENT` | ?= | ?= | ?= | ?= | ?= |
Expand All @@ -85,7 +86,6 @@ Note:
| `EQUIVALENCE_CHECK` | ?= | ?= | ?= | ?= | ?= |
| `REMOVE_CELLS_FOR_EQY` | ?= | ?= | ?= | ?= | ?= |
| Routing | | | | | |
| `FILL_CELLS` | = | = | = | = | = |
| `KLAYOUT_TECH_FILE` | = | = | = | = | = |
| `MAX_ROUTING_LAYER` | = | = | = | = | ?= |
| `MIN_ROUTING_LAYER` | = | = | = | = | ?= |
Expand Down Expand Up @@ -145,9 +145,8 @@ Note:
| `IO_PLACER_H` | The metal layer on which to place the I/O pins horizontally (top and bottom of the die). |
| `IO_PLACER_V` | The metal layer on which to place the I/O pins vertically (sides of the die). |
| `GUI_NO_TIMING` | Skip loading timing for a faster GUI load. |
| `GUI_SOURCE` | Source the script. |
| `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. |

| `FILL_CELLS` | Fill cells are used to fill empty sites. If not set or empty, fill cell insertion is skipped. |
| `TAP_CELL_NAME` | Name of the cell to use in tap cell insertion. |

### Placement

Expand Down Expand Up @@ -189,7 +188,6 @@ Note:

| Variable | Description |
|-----------------------|---------------------------------------------------------------------------------------------------|
| `FILL_CELLS` | Fill cells are used to fill empty sites. |
| `MIN_ROUTING_LAYER` | The lowest metal layer name to be used in routing. |
| `MAX_ROUTING_LAYER` | The highest metal layer name to be used in routing. |
| `DETAILED_ROUTE_ARGS` | Add additional arguments for debugging purpose during detail route. |
Expand Down Expand Up @@ -264,16 +262,18 @@ configuration file.

| Variable | Description |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `CORE_UTILIZATION` | The core utilization percentage (0-100). Overrides `DIE_AREA` and `CORE_AREA`. |
| `CORE_ASPECT_RATIO` | The core aspect ratio (height / width). This values is ignored if `CORE_UTILIZATION` undefined. |
| `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. |
| `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. |
| `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. |
| `CORE_UTILIZATION` | The core utilization percentage (0-100). |
| `CORE_ASPECT_RATIO` | The core aspect ratio (height / width). This values is ignored if `CORE_UTILIZATION` undefined. |
| `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. |
| `DIE_AREA` | The die area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). |
| `CORE_AREA` | The core area specified as a list of lower-left and upper-right corners in microns (X1 Y1 X2 Y2). |
| `RESYNTH_AREA_RECOVER` | Enable re-synthesis for area reclaim. |
| `RESYNTH_TIMING_RECOVER` | Enable re-synthesis for timing optimization. |
| `MACRO_HALO_X` | Set macro halo for x-direction. Only available for ASAP7 PDK. |
| `MACRO_HALO_Y` | Set macro halo for y-direction. Only available for ASAP7 PDK. |

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.

#### Placement


Expand Down
25 changes: 16 additions & 9 deletions docs/user/InstructionsForAutoTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@ User-defined coefficient values (`coeff_perform`, `coeff_power`, `coeff_area`) o

## Setting up AutoTuner

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

```shell
# set up conda environment
conda create -n autotuner_env python=3.9
conda activate autotuner_env
# Install prerequisites
./tools/AutoTuner/install.sh

# install requirements
pip install -r ./tools/AutoTuner/requirements.txt
# Start virtual environment
./tools/AutoTuner/setup.sh
```

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

## Testing framework

Assuming the virtual environment is setup at `./tools/AutoTuner/autotuner_env`:

```
./tools/AutoTuner/setup.sh
python3 ./tools/AutoTuner/test/smoke_test_sweep.py
python3 ./tools/AutoTuner/test/smoke_test_tune.py
```

## Citation

Expand Down
23 changes: 21 additions & 2 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ _installCommon() {
pip3 install --no-cache-dir --user -U $pkgs
fi

baseDir=$(mktemp -d /tmp/DependencyInstaller-orfs-XXXXXX)
if [[ "$constantBuildDir" == "true" ]]; then
baseDir="/tmp/DependencyInstaller-ORFS"
if [[ -d "$baseDir" ]]; then
echo "[INFO] Removing old building directory $baseDir"
fi
mkdir -p "$baseDir"
else
baseDir=$(mktemp -d /tmp/DependencyInstaller-orfs-XXXXXX)
fi

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

# install KLayout
if [[ $1 == "rodete" || $(_versionCompare "$1") -ge 23.04 ]]; then
if [[ $1 == "rodete" ]]; then
apt-get -y install --no-install-recommends klayout python3-pandas
elif _versionCompare "$1" -ge 23.04; then
apt-get -y install --no-install-recommends klayout python3-pandas
else
arch=$(uname -m)
Expand Down Expand Up @@ -237,6 +247,9 @@ Usage: $0
# sudo or with root access.
$0 -ci
# Installs CI tools
$0 -constant-build-dir
# Use constant build directory, instead of
# random one.
EOF
exit "${1:-1}"
}
Expand All @@ -249,6 +262,7 @@ PREFIX=""
option="all"
# default isLocal
isLocal="false"
constantBuildDir="false"
CI="no"

# default values, can be overwritten by cmdline args
Expand Down Expand Up @@ -276,11 +290,16 @@ while [ "$#" -gt 0 ]; do
;;
-ci)
CI="yes"
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} -save-deps-prefixes=/etc/openroad_deps_prefixes.txt"
;;
-prefix=*)
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} $1"
PREFIX=${1#*=}
;;
-constant-build-dir)
OR_INSTALLER_ARGS="${OR_INSTALLER_ARGS} $1"
constantBuildDir="true"
;;
*)
echo "unknown option: ${1}" >&2
_help
Expand Down
7 changes: 6 additions & 1 deletion etc/DockerHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ baseDir="$(pwd)"
org=openroad

DOCKER_CMD="docker"
noConstantBuildDir=""

_help() {
cat <<EOF
Expand All @@ -32,6 +33,7 @@ usage: $0 [CMD] [OPTIONS]
-password=PASSWORD Password to loging at the docker registry.
-ci Install CI tools in image
-dry-run Do not push images to the repository
-no-constant-build-dir Do not use constant build directory
-h -help Show this message and exits
EOF
Expand Down Expand Up @@ -67,7 +69,7 @@ _setup() {
fromImage="${FROM_IMAGE_OVERRIDE:-$osBaseImage}"
cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh
context="etc"
buildArgs="--build-arg options=${options}"
buildArgs="--build-arg options=${options} ${noConstantBuildDir}"
;;
*)
echo "Target ${target} not found" >&2
Expand Down Expand Up @@ -202,6 +204,9 @@ while [ "$#" -gt 0 ]; do
-tag=* )
tag="${1#*=}"
;;
-no-constant-build-dir )
noConstantBuildDir="--build-arg constantBuildDir= "
;;
-os | -target | -threads | -username | -password | -tag )
echo "${1} requires an argument" >&2
_help
Expand Down
Loading

0 comments on commit b837f59

Please sign in to comment.