From 9b980098753572afb0692a59332ebc8140223679 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Thu, 9 Jan 2025 08:59:18 -0300 Subject: [PATCH 1/3] ci: fix AT CI setup logic Signed-off-by: Vitor Bandeira --- flow/test/test_autotuner.sh | 45 +++++++++++++++++++++ flow/test/test_helper.sh | 81 ++++++++++++------------------------- 2 files changed, 71 insertions(+), 55 deletions(-) create mode 100755 flow/test/test_autotuner.sh diff --git a/flow/test/test_autotuner.sh b/flow/test/test_autotuner.sh new file mode 100755 index 0000000000..5c9c0947fb --- /dev/null +++ b/flow/test/test_autotuner.sh @@ -0,0 +1,45 @@ +# run the commands in ORFS root dir +echo "[INFO FLW-0029] Installing dependencies in virtual environment." +cd ../ +./tools/AutoTuner/installer.sh +. ./tools/AutoTuner/setup.sh + +# remove dashes and capitalize platform name +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 + +echo "Running Autotuner smoke tests for --sample and --iteration." +python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration + +if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then + echo "Running Autotuner ref file test (only once)" + python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files +fi + +echo "Running Autotuner smoke algorithm & evaluation test" +python3 -m unittest tools.AutoTuner.test.smoke_test_algo_eval.${PLATFORM}AlgoEvalSmokeTest.test_algo_eval + +# run this test last (because it modifies current path) +echo "Running Autotuner remote test" +if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then + # Get the directory of the current script + script_dir="$(dirname "${BASH_SOURCE[0]}")" + cd "$script_dir"/../../ + latest_image=$(./etc/DockerTag.sh -dev) + echo "ORFS_VERSION=$latest_image" > ./tools/AutoTuner/.env + cd ./tools/AutoTuner + docker compose up --wait + docker compose exec ray-worker bash -c "cd /OpenROAD-flow-scripts/tools/AutoTuner/src/autotuner && \ + python3 distributed.py --design gcd --platform asap7 --server 127.0.0.1 --port 10001 \ + --config ../../../../flow/designs/asap7/gcd/autotuner.json tune --samples 1" + docker compose down -v --remove-orphans +fi + +exit $ret diff --git a/flow/test/test_helper.sh b/flow/test/test_helper.sh index 946575db49..aa0afaee54 100755 --- a/flow/test/test_helper.sh +++ b/flow/test/test_helper.sh @@ -76,69 +76,40 @@ if [ $ret -eq 0 ] && grep -q 'power:' <(echo $TARGETS); then $__make power 2>&1 | tee -a "$LOG_FILE" ret=$(( ret + $? )) fi +set -x # Run Autotuner CI specifically for gcd on selected platforms. if [ -z "${RUN_AUTOTUNER+x}" ]; then + echo "RUN_AUTOTUNER not set, disable AT test." RUN_AUTOTUNER=0 fi -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 - # run the commands in ORFS root dir - echo "[INFO FLW-0029] Installing dependencies in virtual environment." - cd ../ - ./tools/AutoTuner/installer.sh - . ./tools/AutoTuner/setup.sh - - # remove dashes and capitalize platform name - 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 - - echo "Running Autotuner smoke tests for --sample and --iteration." - python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration - - if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then - echo "Running Autotuner ref file test (only once)" - python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files - fi + case $DESIGN_NAME in + "gcd") + # Keep RUN_AUTOTUNER enabled only for these designs + ;; + "*") + echo "Disable AT test for design ${DESIGN_NAME}." + RUN_AUTOTUNER=0 + ;; + esac + case $PLATFORM in + "asap7" | "sky130hd" | "ihp-sg13g2" ) + # Keep RUN_AUTOTUNER enabled only for these platforms + ;; + *) + echo "Disable AT test for platform ${PLATFORM}." + RUN_AUTOTUNER=0 + ;; + esac +fi - echo "Running Autotuner smoke algorithm & evaluation test" - python3 -m unittest tools.AutoTuner.test.smoke_test_algo_eval.${PLATFORM}AlgoEvalSmokeTest.test_algo_eval - - # run this test last (because it modifies current path) - echo "Running Autotuner remote test" - if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then - # Get the directory of the current script - script_dir="$(dirname "${BASH_SOURCE[0]}")" - cd "$script_dir"/../../ - latest_image=$(./etc/DockerTag.sh -dev) - echo "ORFS_VERSION=$latest_image" > ./tools/AutoTuner/.env - cd ./tools/AutoTuner - docker compose up --wait - docker compose exec ray-worker bash -c "cd /OpenROAD-flow-scripts/tools/AutoTuner/src/autotuner && \ - python3 distributed.py --design gcd --platform asap7 --server 127.0.0.1 --port 10001 \ - --config ../../../../flow/designs/asap7/gcd/autotuner.json tune --samples 1" - docker compose down -v --remove-orphans - fi +if [ $RUN_AUTOTUNER -eq 1 ]; then + set +x + echo "Start AutoTuner test." + ./test_autotuner.sh + set -x fi exit $ret From 0344d3717bdd7aba1283da77fc0cd6685a9e92a9 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Thu, 9 Jan 2025 10:06:25 -0300 Subject: [PATCH 2/3] ci: match format used in groovy Signed-off-by: Vitor Bandeira --- flow/test/test_helper.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flow/test/test_helper.sh b/flow/test/test_helper.sh index aa0afaee54..24f39cc0ae 100755 --- a/flow/test/test_helper.sh +++ b/flow/test/test_helper.sh @@ -81,17 +81,17 @@ set -x # Run Autotuner CI specifically for gcd on selected platforms. if [ -z "${RUN_AUTOTUNER+x}" ]; then echo "RUN_AUTOTUNER not set, disable AT test." - RUN_AUTOTUNER=0 + RUN_AUTOTUNER="false" fi -if [ $RUN_AUTOTUNER -eq 1 ]; then +if [ "${RUN_AUTOTUNER}" == "true" ]; then case $DESIGN_NAME in "gcd") # Keep RUN_AUTOTUNER enabled only for these designs ;; "*") echo "Disable AT test for design ${DESIGN_NAME}." - RUN_AUTOTUNER=0 + RUN_AUTOTUNER="false" ;; esac case $PLATFORM in @@ -100,12 +100,12 @@ if [ $RUN_AUTOTUNER -eq 1 ]; then ;; *) echo "Disable AT test for platform ${PLATFORM}." - RUN_AUTOTUNER=0 + RUN_AUTOTUNER="false" ;; esac fi -if [ $RUN_AUTOTUNER -eq 1 ]; then +if [ "${RUN_AUTOTUNER}" == "true" ]; then set +x echo "Start AutoTuner test." ./test_autotuner.sh From f04d42fe4d0490b291a601290b3f9f73f7085fd4 Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Thu, 9 Jan 2025 10:07:51 -0300 Subject: [PATCH 3/3] ci: add missing info Signed-off-by: Vitor Bandeira --- flow/test/test_autotuner.sh | 2 ++ flow/test/test_helper.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flow/test/test_autotuner.sh b/flow/test/test_autotuner.sh index 5c9c0947fb..ae009fee1d 100755 --- a/flow/test/test_autotuner.sh +++ b/flow/test/test_autotuner.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # run the commands in ORFS root dir echo "[INFO FLW-0029] Installing dependencies in virtual environment." cd ../ diff --git a/flow/test/test_helper.sh b/flow/test/test_helper.sh index 24f39cc0ae..4507dba8f2 100755 --- a/flow/test/test_helper.sh +++ b/flow/test/test_helper.sh @@ -108,7 +108,7 @@ fi if [ "${RUN_AUTOTUNER}" == "true" ]; then set +x echo "Start AutoTuner test." - ./test_autotuner.sh + ./test/test_autotuner.sh set -x fi