Skip to content

Commit 20aba1a

Browse files
committed
tools: Autotuner: Add smoke test for Vizier
Signed-off-by: Eryk Szpotanski <eszpotanski@antmicro.com>
1 parent 16c0f8a commit 20aba1a

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

flow/test/test_helper.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ if [[ -n "${RUN_AUTOTUNER+x}" ]] && [[ ${RUN_AUTOTUNER} -eq 1 ]]; then
9898
echo "Running Autotuner smoke tests for --sample and --iteration."
9999
python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration
100100

101+
echo "Running Autotuner smoke Vizier test"
102+
python3 -m unittest tools.AutoTuner.test.smoke_test_vizier.${PLATFORM}VizierSmokeTest.test_vizier
103+
101104
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then
102105
echo "Running Autotuner ref file test (only once)"
103106
python3 -m unittest tools.AutoTuner.test.ref_file_check.RefFileCheck.test_files
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import unittest
2+
import subprocess
3+
import os
4+
from datetime import datetime
5+
6+
cur_dir = os.path.dirname(os.path.abspath(__file__))
7+
8+
9+
class BaseVizierSmokeTest(unittest.TestCase):
10+
platform = ""
11+
design = ""
12+
13+
def setUp(self):
14+
self.config = os.path.join(
15+
cur_dir,
16+
f"../../../flow/designs/{self.platform}/{self.design}/autotuner.json",
17+
)
18+
self.experiment = f"smoke-test-tune-{self.platform}-{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}"
19+
self.command = (
20+
"python3 -m autotuner.vizier"
21+
f" --design {self.design}"
22+
f" --platform {self.platform}"
23+
f" --experiment {self.experiment}"
24+
f" --config {self.config}"
25+
f" --iteration 1 --suggestions 1"
26+
)
27+
28+
def test_vizier(self):
29+
if not (self.platform and self.design):
30+
raise unittest.SkipTest("Platform and design have to be defined")
31+
out = subprocess.run(self.command, shell=True, check=True)
32+
successful = out.returncode == 0
33+
self.assertTrue(successful)
34+
35+
36+
class ASAP7VizierSmokeTest(BaseVizierSmokeTest):
37+
platform = "asap7"
38+
design = "gcd"
39+
40+
41+
class SKY130HDVizierSmokeTest(BaseVizierSmokeTest):
42+
platform = "sky130hd"
43+
design = "gcd"
44+
45+
46+
class IHPSG13G2VizierSmokeTest(BaseVizierSmokeTest):
47+
platform = "ihp-sg13g2"
48+
design = "gcd"
49+
50+
51+
if __name__ == "__main__":
52+
unittest.main()

0 commit comments

Comments
 (0)