Skip to content

Commit

Permalink
Merge branch 'master' into autotuner_ci_level_4
Browse files Browse the repository at this point in the history
Signed-off-by: Song Luar <[email protected]>
  • Loading branch information
luarss authored Oct 11, 2024
2 parents 07588cc + 8f75399 commit 5c9ae13
Show file tree
Hide file tree
Showing 259 changed files with 13,538 additions and 13,233 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ mainREADME.md
build
.scala-build/
.bsp/

# autotuner artifacts
metadata-base-at.json
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
2 changes: 2 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 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
540 changes: 275 additions & 265 deletions docs/user/FlowVariables.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions docs/user/InstructionsForAutoTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ 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:

```{note}
Make sure you run the following commands in `./tools/AutoTuner/src/autotuner`.
```

```shell
# Install prerequisites
./tools/AutoTuner/install.sh
Expand Down Expand Up @@ -127,8 +131,8 @@ Example:

```shell
python3 distributed.py --design gcd --platform sky130hd \
--config ../designs/sky130hd/gcd/autotuner.json \
tune
--config ../../../../flow/designs/sky130hd/gcd/autotuner.json \
tune --samples 5
```
#### Sweep only

Expand Down
19 changes: 18 additions & 1 deletion 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 @@ -239,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 @@ -251,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 @@ -278,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 5c9ae13

Please sign in to comment.