Skip to content

Commit 07d6f5d

Browse files
committed
surrogate: add autotune workflow
Minimal flow scripts + docs + plumbing to run the OpenROAD surrogate autotuner.
1 parent 93c42b2 commit 07d6f5d

20 files changed

+1757
-6
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ flow/logs
1313
flow/reports
1414
flow/objects
1515
flow/tech
16+
flow/tmp_surrogate
1617

1718
# Tar archives
1819
flow/*tar.gz
@@ -105,3 +106,10 @@ bazel-testlogs
105106

106107
# python venv
107108
venv/
109+
flow/backup_*
110+
111+
# Local scratch notes (kept out of git)
112+
doc.md
113+
114+
# macOS
115+
.DS_Store

flow/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,20 @@ check-yosys:
750750
.PHONY: all
751751
all: check-yosys check-openroad synth floorplan place cts route finish
752752

753+
.PHONY: surrogate_tune
754+
surrogate_tune: check-openroad synth
755+
($(TIME_CMD) $(OPENROAD_CMD) $(SCRIPTS_DIR)/surrogate_tune.tcl) 2>&1 | tee $(abspath $(LOG_DIR)/surrogate_tune.log)
756+
757+
.PHONY: surrogate_tune_synthaware
758+
surrogate_tune_synthaware: check-openroad
759+
@mkdir -p $(LOG_DIR)
760+
($(TIME_CMD) $(PYTHON_EXE) $(SCRIPTS_DIR)/surrogate_tune_synthaware.py) 2>&1 | tee $(abspath $(LOG_DIR)/surrogate_tune_synthaware.log)
761+
762+
.PHONY: surrogate_autotune
763+
surrogate_autotune: check-openroad
764+
@mkdir -p $(LOG_DIR)
765+
($(TIME_CMD) $(PYTHON_EXE) $(SCRIPTS_DIR)/surrogate_autotune.py) 2>&1 | tee $(abspath $(LOG_DIR)/surrogate_autotune.log)
766+
753767
.PHONY: clean
754768
clean:
755769
@echo
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cts_cluster_size": 10,
3+
"cts_cluster_diameter": 50
4+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"clock_period": {
3+
"type": "float",
4+
"minmax": [300, 600],
5+
"step": 0
6+
},
7+
"core_utilization": {
8+
"type": "int",
9+
"minmax": [20, 99],
10+
"step": 1
11+
},
12+
"core_aspect_ratio": {
13+
"type": "float",
14+
"minmax": [0.9, 1.1],
15+
"step": 0
16+
},
17+
"tns_end_percent": {
18+
"type": "int",
19+
"minmax": [0, 100],
20+
"step": 1
21+
},
22+
"global_padding": {
23+
"type": "int",
24+
"minmax": [0, 3],
25+
"step": 1
26+
},
27+
"detail_padding": {
28+
"type": "int",
29+
"minmax": [0, 3],
30+
"step": 1
31+
},
32+
"enable_dpo": {
33+
"type": "binary",
34+
"minmax": [0, 1],
35+
"step": 1
36+
},
37+
"pin_layer_adjust": {
38+
"type": "float",
39+
"minmax": [0.2, 0.7],
40+
"step": 0
41+
},
42+
"above_layer_adjust": {
43+
"type": "float",
44+
"minmax": [0.2, 0.7],
45+
"step": 0
46+
},
47+
"density_margin_addon": {
48+
"type": "float",
49+
"minmax": [0.0, 0.99],
50+
"step": 0
51+
},
52+
"cts_cluster_size": {
53+
"type": "int",
54+
"minmax": [10, 40],
55+
"step": 1
56+
},
57+
"cts_cluster_diameter": {
58+
"type": "int",
59+
"minmax": [50, 200],
60+
"step": 1
61+
}
62+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"clock_period": {
3+
"type": "float",
4+
"minmax": [300, 600],
5+
"step": 0
6+
},
7+
"core_utilization": {
8+
"type": "int",
9+
"minmax": [20, 99],
10+
"step": 1
11+
},
12+
"core_aspect_ratio": {
13+
"type": "float",
14+
"minmax": [0.9, 1.1],
15+
"step": 0
16+
},
17+
"tns_end_percent": {
18+
"type": "int",
19+
"minmax": [0, 100],
20+
"step": 1
21+
},
22+
"global_padding": {
23+
"type": "int",
24+
"minmax": [0, 3],
25+
"step": 1
26+
},
27+
"detail_padding": {
28+
"type": "int",
29+
"minmax": [0, 3],
30+
"step": 1
31+
},
32+
"enable_dpo": {
33+
"type": "binary",
34+
"minmax": [0, 1],
35+
"step": 1
36+
},
37+
"pin_layer_adjust": {
38+
"type": "float",
39+
"minmax": [0.2, 0.7],
40+
"step": 0
41+
},
42+
"above_layer_adjust": {
43+
"type": "float",
44+
"minmax": [0.2, 0.7],
45+
"step": 0
46+
},
47+
"density_margin_addon": {
48+
"type": "float",
49+
"minmax": [0.0, 0.99],
50+
"step": 0
51+
}
52+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"clock_period": {
3+
"type": "float",
4+
"minmax": [300, 420],
5+
"step": 0
6+
},
7+
"core_utilization": {
8+
"type": "int",
9+
"minmax": [50, 80],
10+
"step": 1
11+
},
12+
"core_aspect_ratio": {
13+
"type": "float",
14+
"minmax": [0.9, 1.1],
15+
"step": 0
16+
},
17+
"tns_end_percent": {
18+
"type": "int",
19+
"minmax": [80, 100],
20+
"step": 1
21+
},
22+
"global_padding": {
23+
"type": "int",
24+
"minmax": [0, 3],
25+
"step": 1
26+
},
27+
"detail_padding": {
28+
"type": "int",
29+
"minmax": [0, 3],
30+
"step": 1
31+
},
32+
"enable_dpo": {
33+
"type": "binary",
34+
"minmax": [0, 1],
35+
"step": 1
36+
},
37+
"pin_layer_adjust": {
38+
"type": "float",
39+
"minmax": [0.2, 0.7],
40+
"step": 0
41+
},
42+
"above_layer_adjust": {
43+
"type": "float",
44+
"minmax": [0.2, 0.7],
45+
"step": 0
46+
},
47+
"density_margin_addon": {
48+
"type": "float",
49+
"minmax": [0.0, 0.35],
50+
"step": 0
51+
}
52+
}
53+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"core_utilization": 38
3+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"clock_period": {
3+
"type": "float",
4+
"minmax": [0.40, 2.00],
5+
"step": 0
6+
},
7+
"core_utilization": {
8+
"type": "int",
9+
"minmax": [20, 99],
10+
"step": 1
11+
},
12+
"tns_end_percent": {
13+
"type": "int",
14+
"minmax": [0, 100],
15+
"step": 1
16+
},
17+
"global_padding": {
18+
"type": "int",
19+
"minmax": [0, 3],
20+
"step": 1
21+
},
22+
"detail_padding": {
23+
"type": "int",
24+
"minmax": [0, 3],
25+
"step": 1
26+
},
27+
"enable_dpo": {
28+
"type": "binary",
29+
"minmax": [0, 1],
30+
"step": 1
31+
},
32+
"pin_layer_adjust": {
33+
"type": "float",
34+
"minmax": [0.2, 0.7],
35+
"step": 0
36+
},
37+
"above_layer_adjust": {
38+
"type": "float",
39+
"minmax": [0.2, 0.7],
40+
"step": 0
41+
},
42+
"density_margin_addon": {
43+
"type": "float",
44+
"minmax": [0.0, 0.99],
45+
"step": 0
46+
}
47+
}

flow/platforms/asap7/fastroute.tcl

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1-
set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) 0.25
1+
# Configure global routing adjustment. Prefer explicit two-level per-layer
2+
# adjustments (PIN_LAYER_ADJUST/ABOVE_LAYER_ADJUST) when provided, otherwise
3+
# fall back to the platform default.
4+
if { [info exists ::env(PIN_LAYER_ADJUST)] && $::env(PIN_LAYER_ADJUST) != "" \
5+
&& [info exists ::env(ABOVE_LAYER_ADJUST)] && $::env(ABOVE_LAYER_ADJUST) != "" } {
6+
set min_layer $::env(MIN_ROUTING_LAYER)
7+
set max_layer $::env(MAX_ROUTING_LAYER)
8+
9+
set next1 ""
10+
set next2 ""
11+
if { [regexp {^([A-Za-z_]+)([0-9]+)$} $min_layer -> prefix num] } {
12+
set next1 "${prefix}[expr {$num + 1}]"
13+
set next2 "${prefix}[expr {$num + 2}]"
14+
}
15+
16+
if { $next1 != "" && $next2 != "" } {
17+
set_global_routing_layer_adjustment $min_layer-$next1 $::env(PIN_LAYER_ADJUST)
18+
set_global_routing_layer_adjustment $next2-$max_layer $::env(ABOVE_LAYER_ADJUST)
19+
} else {
20+
set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) 0.25
21+
}
22+
} else {
23+
set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) 0.25
24+
}
225
set_routing_layers -clock $::env(MIN_CLK_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER)
326
set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER)
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
1-
set_global_routing_layer_adjustment metal2-metal3 0.5
2-
set_global_routing_layer_adjustment metal4-$::env(MAX_ROUTING_LAYER) 0.25
1+
# Configure global routing adjustment. Prefer explicit two-level per-layer
2+
# adjustments (PIN_LAYER_ADJUST/ABOVE_LAYER_ADJUST) when provided, otherwise
3+
# fall back to the Nangate45 defaults.
4+
if { [info exists ::env(PIN_LAYER_ADJUST)] && $::env(PIN_LAYER_ADJUST) != "" \
5+
&& [info exists ::env(ABOVE_LAYER_ADJUST)] && $::env(ABOVE_LAYER_ADJUST) != "" } {
6+
set min_layer $::env(MIN_ROUTING_LAYER)
7+
set max_layer $::env(MAX_ROUTING_LAYER)
8+
9+
set next1 ""
10+
set next2 ""
11+
if { [regexp {^([A-Za-z_]+)([0-9]+)$} $min_layer -> prefix num] } {
12+
set next1 "${prefix}[expr {$num + 1}]"
13+
set next2 "${prefix}[expr {$num + 2}]"
14+
}
15+
16+
if { $next1 != "" && $next2 != "" } {
17+
set_global_routing_layer_adjustment $min_layer-$next1 $::env(PIN_LAYER_ADJUST)
18+
set_global_routing_layer_adjustment $next2-$max_layer $::env(ABOVE_LAYER_ADJUST)
19+
} else {
20+
set_global_routing_layer_adjustment metal2-metal3 0.5
21+
set_global_routing_layer_adjustment metal4-$::env(MAX_ROUTING_LAYER) 0.25
22+
}
23+
} else {
24+
set_global_routing_layer_adjustment metal2-metal3 0.5
25+
set_global_routing_layer_adjustment metal4-$::env(MAX_ROUTING_LAYER) 0.25
26+
}
327

428
set_routing_layers -clock $::env(MIN_CLK_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER)
529
set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER)

0 commit comments

Comments
 (0)