Skip to content

Commit

Permalink
[Autotuner] CI Smoke Test - Tune & Sweep (#2042)
Browse files Browse the repository at this point in the history
* Add CI integration for AT Smoke tests
* ci: bump version

---------

Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: luarss <[email protected]>
Signed-off-by: Vitor Bandeira <[email protected]>
Signed-off-by: luarss <[email protected]>
Signed-off-by: Vitor Bandeira <[email protected]>
Co-authored-by: Vitor Bandeira <[email protected]>
Co-authored-by: Vitor Bandeira <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent 629c464 commit ec45357
Show file tree
Hide file tree
Showing 18 changed files with 487 additions and 270 deletions.
1 change: 1 addition & 0 deletions docker/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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
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
2 changes: 1 addition & 1 deletion flow/designs/asap7/gcd/autotuner.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_SDC_CLK_PERIOD": {
"type": "float",
"minmax": [
50,
300,
1000
],
"step": 0
Expand Down
10 changes: 5 additions & 5 deletions flow/designs/ihp-sg13g2/gcd/autotuner.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"_SDC_CLK_PERIOD": {
"type": "float",
"minmax": [
1.0,
4.3647
7.0,
12.0
],
"step": 0
},
Expand Down Expand Up @@ -52,23 +52,23 @@
"type": "float",
"minmax": [
0.1,
0.7
0.3
],
"step": 0
},
"PLACE_DENSITY_LB_ADDON": {
"type": "float",
"minmax": [
0.0,
0.99
0.1
],
"step": 0
},
"_PINS_DISTANCE": {
"type": "int",
"minmax": [
1,
4
1
],
"step": 1
},
Expand Down
1 change: 1 addition & 0 deletions flow/designs/sky130hd/gcd/autotuner.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@
"step": 0
}
}

35 changes: 35 additions & 0 deletions flow/test/test_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,39 @@ if [ $ret -eq 0 ] && grep -q 'power:' <(echo $TARGETS); then
ret=$(( ret + $? ))
fi

# Run Autotuner CI specifically for gcd on selected platforms.
RUN_AUTOTUNER=0
case $DESIGN_NAME in
"gcd")
RUN_AUTOTUNER=1
;;
esac
case $PLATFORM in
"asap7" | "sky130hd" | "ihp-sg13g2" )
# Keep RUN_AUTOTUNER enabled only for these platforms
;;
*)
RUN_AUTOTUNER=0
;;
esac

if [ $RUN_AUTOTUNER -eq 1 ]; then
# change directory to the root of the repo
echo "Install and starting venv"
cd ../
./tools/AutoTuner/installer.sh
. ./tools/AutoTuner/setup.sh

# remove dashes
PLATFORM=${PLATFORM//-/}
# convert to uppercase
PLATFORM=${PLATFORM^^}

echo "Running Autotuner smoke tune test"
python3 -m unittest tools.AutoTuner.test.smoke_test_tune.${PLATFORM}TuneSmokeTest.test_tune

echo "Running Autotuner smoke sweep test"
python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeTest.test_sweep
fi

exit $ret
4 changes: 3 additions & 1 deletion flow/util/genReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ def write_summary():

for log_dir, dirs, files in sorted(os.walk(LOGS_FOLDER, topdown=False)):
dir_list = log_dir.split(os.sep)
if len(dir_list) != 4:
# Handles autotuner folders, which do not have `report.log` natively.
# TODO: Can we log something for autotuner?
if len(dir_list) != 4 or "test-" in dir_list[-1]:
continue
report_dir = log_dir.replace(LOGS_FOLDER, REPORTS_FOLDER)

Expand Down
2 changes: 1 addition & 1 deletion jenkins/public_nightly.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('[email protected].0') _
@Library('[email protected].1') _

node {

Expand Down
2 changes: 1 addition & 1 deletion jenkins/public_tests_all.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('[email protected].0') _
@Library('[email protected].1') _

node {

Expand Down
11 changes: 10 additions & 1 deletion tools/AutoTuner/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# Autotuner specific
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
*.egg-info/

# Jupyter Notebook
.ipynb_checkpoints

# Autotuner env
autotuner_env
Loading

0 comments on commit ec45357

Please sign in to comment.