Skip to content

Commit a5c3f0b

Browse files
committed
autotuner: report effective_clk_period & num_drc ; rename minimum -> metric
Report additional QOR metrics in the output Rename the target metric from 'minimum' to 'metric' for clarity Fix a minor bug when no runs succeed. Signed-off-by: Matt Liberty <[email protected]>
1 parent 3d1d6f4 commit a5c3f0b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

tools/AutoTuner/src/autotuner/distributed.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
ORFS_URL = "https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts"
6060
FASTROUTE_TCL = "fastroute.tcl"
6161
CONSTRAINTS_SDC = "constraint.sdc"
62-
METRIC = "minimum"
62+
METRIC = "metric"
6363
ERROR_METRIC = 9e99
6464
ORFS_FLOW_DIR = os.path.abspath(
6565
os.path.join(os.path.dirname(__file__), "../../../../flow")
@@ -90,10 +90,16 @@ def step(self):
9090
"""
9191
metrics_file = openroad(self.repo_dir, self.parameters, self.variant)
9292
self.step_ += 1
93-
score = self.evaluate(self.read_metrics(metrics_file))
93+
(score, effective_clk_period, num_drc) = self.evaluate(
94+
self.read_metrics(metrics_file)
95+
)
9496
# Feed the score back to Tune.
9597
# return must match 'metric' used in tune.run()
96-
return {METRIC: score}
98+
return {
99+
METRIC: score,
100+
"effective_clk_period": effective_clk_period,
101+
"num_drc": num_drc,
102+
}
97103

98104
def evaluate(self, metrics):
99105
"""
@@ -104,11 +110,13 @@ def evaluate(self, metrics):
104110
error = "ERR" in metrics.values()
105111
not_found = "N/A" in metrics.values()
106112
if error or not_found:
107-
return ERROR_METRIC
108-
gamma = (metrics["clk_period"] - metrics["worst_slack"]) / 10
109-
score = metrics["clk_period"] - metrics["worst_slack"]
110-
score = score * (self.step_ / 100) ** (-1) + gamma * metrics["num_drc"]
111-
return score
113+
return (ERROR_METRIC, "-", "-")
114+
effective_clk_period = metrics["clk_period"] - metrics["worst_slack"]
115+
num_drc = metrics["num_drc"]
116+
gamma = effective_clk_period / 10
117+
score = effective_clk_period
118+
score = score * (100 / self.step_) + gamma * num_drc
119+
return (score, effective_clk_period, num_drc)
112120

113121
@classmethod
114122
def read_metrics(cls, file_name):
@@ -1087,7 +1095,7 @@ def sweep():
10871095
print(f"[INFO TUN-0002] Best parameters found: {analysis.best_config}")
10881096

10891097
# if all runs have failed
1090-
if analysis.best_result["minimum"] == ERROR_METRIC:
1098+
if analysis.best_result[METRIC] == ERROR_METRIC:
10911099
print("[ERROR TUN-0016] No successful runs found.")
10921100
sys.exit(1)
10931101
elif args.mode == "sweep":

0 commit comments

Comments
 (0)