Skip to content

Commit 8878630

Browse files
authored
Merge pull request #4796 from oharboe/grt-fails-hard
flow: simplify global_route.tcl, clean out the obsolete GENERATE_ARTIFACTS_ON_FAILURE
2 parents c5310d7 + dc359a6 commit 8878630

5 files changed

Lines changed: 124 additions & 186 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ configuration file.
157157
| <a name="FOOTPRINT_TCL"></a>FOOTPRINT_TCL| Specifies a Tcl script with custom footprint-related commands for floorplan setup.| |
158158
| <a name="GDS_ALLOW_EMPTY"></a>GDS_ALLOW_EMPTY| Single regular expression of module names of macros that have no .gds file| |
159159
| <a name="GDS_FILES"></a>GDS_FILES| Path to platform GDS files.| |
160-
| <a name="GENERATE_ARTIFACTS_ON_FAILURE"></a>GENERATE_ARTIFACTS_ON_FAILURE| For instance Bazel needs artifacts (.odb and .rpt files) on a failure to allow the user to save hours on re-running the failed step locally, but when working with a Makefile flow, it is more natural to fail the step and leave the user to manually inspect the logs and artifacts directly via the file system. Set to 1 to change the behavior to generate artifacts upon failure to e.g. do a global route. The exit code will still be non-zero on all other failures that aren't covered by the "useful to inspect the artifacts on failure" use-case. Example: just like detailed routing, a global route that fails with congestion, is not a build failure(as in exit code non-zero), it is a successful(as in zero exit code) global route that produce reports detailing the problem. Detailed route will not proceed, if there is global routing congestion This allows build systems, such as bazel, to create artifacts for global and detailed route, even if the operation had problems, without having know about the semantics between global and detailed route. Considering that global and detailed route can run for a long time and use a lot of memory, this allows inspecting results on a laptop for a build that ran on a server.| 0|
161160
| <a name="GLOBAL_CONNECT_TCL"></a>GLOBAL_CONNECT_TCL| File path to the add_global_connection rules that connect the supply pins of the instances to the supply nets. Sourced at floorplan right after the netlist is loaded, before any step can mark an instance dont_touch; the rules are kept in the database. The platform's file by default; a design whose PDN_TCL names other supply nets sets its own. PDN_TCL defines the grids.| |
162161
| <a name="GLOBAL_PLACEMENT_ARGS"></a>GLOBAL_PLACEMENT_ARGS| Use additional tuning parameters during global placement other than default args defined in global_place.tcl.| |
163162
| <a name="GLOBAL_ROUTE_ARGS"></a>GLOBAL_ROUTE_ARGS| Replaces default arguments for global route. The -congestion_iterations default is set by the flow (30 for FastRoute, 10 for CUGR); add -congestion_iterations here to override it.| -congestion_report_iter_step 5 -verbose|
@@ -681,7 +680,6 @@ configuration file.
681680
- [FILL_CONFIG](#FILL_CONFIG)
682681
- [FLOW_VARIANT](#FLOW_VARIANT)
683682
- [GDS_FILES](#GDS_FILES)
684-
- [GENERATE_ARTIFACTS_ON_FAILURE](#GENERATE_ARTIFACTS_ON_FAILURE)
685683
- [GUI_TIMING](#GUI_TIMING)
686684
- [IR_DROP_LAYER](#IR_DROP_LAYER)
687685
- [KLAYOUT_TECH_FILE](#KLAYOUT_TECH_FILE)

‎flow/scripts/detail_route.tcl‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ utl::set_metrics_stage "detailedroute__{}"
22
source $::env(SCRIPTS_DIR)/load.tcl
33
load_design 5_1_grt.odb 5_1_grt.sdc
44
source_step_tcl PRE DETAIL_ROUTE
5-
if { ![grt::have_routes] } {
6-
error "Global routing failed, run `make gui_grt` and load $::global_route_congestion_report \
7-
in DRC viewer to view congestion"
8-
}
95

106
if { !$::env(SKIP_DETAILED_ROUTE) } {
117
erase_non_stage_variables route

‎flow/scripts/global_route.tcl‎

Lines changed: 124 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -3,187 +3,158 @@ source $::env(SCRIPTS_DIR)/load.tcl
33
erase_non_stage_variables grt
44
load_design 4_cts.odb 4_cts.sdc
55

6-
# This proc is here to allow us to use 'return' to return early from this
7-
# file which is sourced
8-
proc global_route_helper { } {
9-
source_step_tcl PRE GLOBAL_ROUTE
10-
11-
set res_aware ""
12-
append_env_var res_aware ENABLE_RESISTANCE_AWARE -resistance_aware 0
13-
14-
set use_cugr ""
15-
append_env_var use_cugr GLOBAL_ROUTE_USE_CUGR -use_cugr 0
16-
17-
# The flow's choice to accept congestion, from GLOBAL_ROUTE_ARGS, passed
18-
# to every incremental reroute and to repair_antennas: each call decides
19-
# for itself, and one without -allow_congestion reroutes a congested route
20-
# harder and then fails on it.
21-
set allow_congestion ""
22-
if { [lsearch -exact $::env(GLOBAL_ROUTE_ARGS) -allow_congestion] >= 0 } {
23-
set allow_congestion -allow_congestion
6+
source_step_tcl PRE GLOBAL_ROUTE
7+
8+
set res_aware ""
9+
append_env_var res_aware ENABLE_RESISTANCE_AWARE -resistance_aware 0
10+
11+
set use_cugr ""
12+
append_env_var use_cugr GLOBAL_ROUTE_USE_CUGR -use_cugr 0
13+
14+
# The flow's choice to accept congestion, from GLOBAL_ROUTE_ARGS, passed
15+
# to every incremental reroute and to repair_antennas: each call decides
16+
# for itself, and one without -allow_congestion reroutes a congested route
17+
# harder and then fails on it.
18+
set allow_congestion ""
19+
if { [lsearch -exact $::env(GLOBAL_ROUTE_ARGS) -allow_congestion] >= 0 } {
20+
set allow_congestion -allow_congestion
21+
}
22+
23+
proc set_grt_seed { } {
24+
set seed_arg [env_var_or_empty GRT_SEED]
25+
if { $seed_arg ne "" } {
26+
log_cmd set_global_routing_random -seed $seed_arg
2427
}
28+
}
2529

26-
proc set_grt_seed { } {
27-
set seed_arg [env_var_or_empty GRT_SEED]
28-
if { $seed_arg ne "" } {
29-
log_cmd set_global_routing_random -seed $seed_arg
30-
}
30+
proc run_global_route_and_catch_failures { args } {
31+
if { [catch { log_cmd global_route {*}$args } errMsg] } {
32+
log_cmd write_db $::env(RESULTS_DIR)/5_1_grt-failed.odb
33+
error $errMsg
3134
}
35+
}
3236

33-
proc run_global_route_and_catch_failures { args } {
34-
set result [catch { log_cmd global_route {*}$args } errMsg]
35-
36-
if { $result != 0 } {
37-
if { !$::env(GENERATE_ARTIFACTS_ON_FAILURE) } {
38-
log_cmd write_db $::env(RESULTS_DIR)/5_1_grt-failed.odb
39-
error $errMsg
40-
}
41-
orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc
42-
# A route that failed has no parasitics to time the endpoints with.
43-
orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb 0
44-
return 0
45-
}
46-
return 1
37+
proc do_global_route { res_aware use_cugr } {
38+
set_grt_seed
39+
# CUGR runs a full 3D maze pass per iteration; use a tighter default.
40+
set cong_iters "-congestion_iterations 30"
41+
if { $use_cugr ne "" } {
42+
set cong_iters "-congestion_iterations 10"
4743
}
44+
set all_args [concat [list \
45+
-congestion_report_file $::global_route_congestion_report] \
46+
$cong_iters $::env(GLOBAL_ROUTE_ARGS) {*}$res_aware {*}$use_cugr]
4847

49-
proc do_global_route { res_aware use_cugr } {
50-
set_grt_seed
51-
# CUGR runs a full 3D maze pass per iteration; use a tighter default.
52-
set cong_iters "-congestion_iterations 30"
53-
if { $use_cugr ne "" } {
54-
set cong_iters "-congestion_iterations 10"
55-
}
56-
set all_args [concat [list \
57-
-congestion_report_file $::global_route_congestion_report] \
58-
$cong_iters $::env(GLOBAL_ROUTE_ARGS) {*}$res_aware {*}$use_cugr]
48+
run_global_route_and_catch_failures {*}$all_args
49+
}
50+
set additional_args ""
51+
append_env_var additional_args dbProcessNode -db_process_node 1
52+
append_env_var additional_args VIA_IN_PIN_MIN_LAYER -via_in_pin_bottom_layer 1
53+
append_env_var additional_args VIA_IN_PIN_MAX_LAYER -via_in_pin_top_layer 1
5954

60-
return [run_global_route_and_catch_failures {*}$all_args]
61-
}
62-
set additional_args ""
63-
append_env_var additional_args dbProcessNode -db_process_node 1
64-
append_env_var additional_args VIA_IN_PIN_MIN_LAYER -via_in_pin_bottom_layer 1
65-
append_env_var additional_args VIA_IN_PIN_MAX_LAYER -via_in_pin_top_layer 1
55+
log_cmd pin_access {*}$additional_args
6656

67-
log_cmd pin_access {*}$additional_args
57+
do_global_route $res_aware $use_cugr
6858

69-
if { ![do_global_route $res_aware $use_cugr] } {
70-
return
71-
}
59+
set_placement_padding -global \
60+
-left $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT) \
61+
-right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT)
7262

73-
set_placement_padding -global \
74-
-left $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT) \
75-
-right $::env(CELL_PAD_IN_SITES_DETAIL_PLACEMENT)
63+
set_propagated_clock [all_clocks]
64+
log_cmd estimate_parasitics
7665

77-
set_propagated_clock [all_clocks]
78-
log_cmd estimate_parasitics
66+
if { [env_var_exists_and_non_empty DONT_USE_CELLS] } {
67+
set_dont_use $::env(DONT_USE_CELLS)
68+
}
7969

80-
if { [env_var_exists_and_non_empty DONT_USE_CELLS] } {
81-
set_dont_use $::env(DONT_USE_CELLS)
70+
if { !$::env(SKIP_INCREMENTAL_REPAIR) } {
71+
if { $::env(DETAILED_METRICS) } {
72+
report_metrics 5 "global route pre repair design"
8273
}
8374

84-
if { !$::env(SKIP_INCREMENTAL_REPAIR) } {
85-
if { $::env(DETAILED_METRICS) } {
86-
report_metrics 5 "global route pre repair design"
87-
}
75+
# Repair design using global route parasitics
76+
repair_design_helper
77+
if { $::env(DETAILED_METRICS) } {
78+
report_metrics 5 "global route post repair design"
79+
}
8880

89-
# Repair design using global route parasitics
90-
repair_design_helper
91-
if { $::env(DETAILED_METRICS) } {
92-
report_metrics 5 "global route post repair design"
93-
}
81+
# Running DPL to fix overlapped instances
82+
# Run to get modified net by DPL
83+
log_cmd global_route -start_incremental {*}$allow_congestion
84+
detailed_placement_helper -quiet
85+
# Route only the modified net by DPL
86+
run_global_route_and_catch_failures -end_incremental {*}$res_aware \
87+
{*}$allow_congestion \
88+
-congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_design.rpt
89+
90+
# Repair timing using global route parasitics
91+
puts "Repair setup and hold violations..."
92+
log_cmd estimate_parasitics
9493

95-
# Running DPL to fix overlapped instances
96-
# Run to get modified net by DPL
97-
log_cmd global_route -start_incremental {*}$allow_congestion
98-
detailed_placement_helper -quiet
99-
# Route only the modified net by DPL
100-
if {
101-
![run_global_route_and_catch_failures -end_incremental {*}$res_aware \
102-
{*}$allow_congestion \
103-
-congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_design.rpt]
104-
} {
105-
return
106-
}
94+
repair_timing_helper
10795

108-
# Repair timing using global route parasitics
109-
puts "Repair setup and hold violations..."
110-
log_cmd estimate_parasitics
96+
if { $::env(DETAILED_METRICS) } {
97+
report_metrics 5 "global route post repair timing"
98+
}
11199

112-
repair_timing_helper
100+
log_cmd global_route -start_incremental {*}$allow_congestion
101+
detailed_placement_helper -quiet
102+
log_cmd check_placement -placeable -verbose
103+
# Route only the modified net by DPL
104+
run_global_route_and_catch_failures -end_incremental {*}$res_aware \
105+
{*}$allow_congestion \
106+
-congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_timing.rpt
113107

114-
if { $::env(DETAILED_METRICS) } {
115-
report_metrics 5 "global route post repair timing"
116-
}
108+
log_cmd estimate_parasitics
117109

118-
log_cmd global_route -start_incremental {*}$allow_congestion
119-
detailed_placement_helper -quiet
120-
log_cmd check_placement -placeable -verbose
121-
# Route only the modified net by DPL
122-
if {
123-
![run_global_route_and_catch_failures -end_incremental {*}$res_aware \
124-
{*}$allow_congestion \
125-
-congestion_report_file $::env(REPORTS_DIR)/congestion_post_repair_timing.rpt]
126-
} {
127-
return
110+
if { $::env(OPT_POST_GRT_WNS) } {
111+
set repair_timing_args \
112+
[list -setup -sequence "vt_swap reroute" -skip_last_gasp -repair_tns 0 -verbose]
113+
if { [env_var_exists_and_non_empty MATCH_CELL_FOOTPRINT] } {
114+
lappend repair_timing_args -match_cell_footprint
128115
}
129-
130-
log_cmd estimate_parasitics
131-
132-
if { $::env(OPT_POST_GRT_WNS) } {
133-
set repair_timing_args \
134-
[list -setup -sequence "vt_swap reroute" -skip_last_gasp -repair_tns 0 -verbose]
135-
if { [env_var_exists_and_non_empty MATCH_CELL_FOOTPRINT] } {
136-
lappend repair_timing_args -match_cell_footprint
137-
}
138-
if { $::env(SETUP_SLACK_MARGIN) != 0 } {
139-
lappend repair_timing_args -setup_margin $::env(SETUP_SLACK_MARGIN)
140-
}
141-
log_cmd repair_timing {*}$repair_timing_args
142-
143-
if { $::env(DETAILED_METRICS) } {
144-
report_metrics 5 "global route post repair timing_opt_wns"
145-
}
116+
if { $::env(SETUP_SLACK_MARGIN) != 0 } {
117+
lappend repair_timing_args -setup_margin $::env(SETUP_SLACK_MARGIN)
146118
}
147-
}
119+
log_cmd repair_timing {*}$repair_timing_args
148120

149-
if { !$::env(OPT_POST_GRT_WNS) } {
150-
log_cmd global_route -start_incremental {*}$allow_congestion
151-
recover_power_helper
152-
# Route the modified nets by rsz journal restore
153-
if {
154-
![run_global_route_and_catch_failures -end_incremental {*}$res_aware \
155-
{*}$allow_congestion \
156-
-congestion_report_file $::env(REPORTS_DIR)/congestion_post_recover_power.rpt]
157-
} {
158-
return
121+
if { $::env(DETAILED_METRICS) } {
122+
report_metrics 5 "global route post repair timing_opt_wns"
159123
}
160124
}
125+
}
161126

162-
if {
163-
!$::env(SKIP_ANTENNA_REPAIR) &&
164-
[env_var_exists_and_non_empty MAX_REPAIR_ANTENNAS_ITER_GRT]
165-
} {
166-
puts "Repair antennas..."
167-
repair_antennas -iterations $::env(MAX_REPAIR_ANTENNAS_ITER_GRT) \
168-
{*}$allow_congestion
169-
# repair antennas calls DPL internally
170-
log_cmd check_placement -placeable -verbose
171-
check_antennas -report_file $::env(REPORTS_DIR)/grt_antennas.log
172-
}
127+
if { !$::env(OPT_POST_GRT_WNS) } {
128+
log_cmd global_route -start_incremental {*}$allow_congestion
129+
recover_power_helper
130+
# Route the modified nets by rsz journal restore
131+
run_global_route_and_catch_failures -end_incremental {*}$res_aware \
132+
{*}$allow_congestion \
133+
-congestion_report_file $::env(REPORTS_DIR)/congestion_post_recover_power.rpt
134+
}
173135

174-
puts "Estimate parasitics..."
175-
log_cmd estimate_parasitics
136+
if {
137+
!$::env(SKIP_ANTENNA_REPAIR) &&
138+
[env_var_exists_and_non_empty MAX_REPAIR_ANTENNAS_ITER_GRT]
139+
} {
140+
puts "Repair antennas..."
141+
repair_antennas -iterations $::env(MAX_REPAIR_ANTENNAS_ITER_GRT) \
142+
{*}$allow_congestion
143+
# repair antennas calls DPL internally
144+
log_cmd check_placement -placeable -verbose
145+
check_antennas -report_file $::env(REPORTS_DIR)/grt_antennas.log
146+
}
176147

177-
report_metrics 5 "global route"
148+
puts "Estimate parasitics..."
149+
log_cmd estimate_parasitics
178150

179-
# Write SDC to results with updated clock periods that are just failing.
180-
# Use make target update_sdc_clock to install the updated sdc.
181-
source [file join $::env(SCRIPTS_DIR) "write_ref_sdc.tcl"]
151+
report_metrics 5 "global route"
182152

183-
write_guides $::env(RESULTS_DIR)/route.guide
184-
source_step_tcl POST GLOBAL_ROUTE
185-
orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb
186-
orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc
187-
}
153+
# Write SDC to results with updated clock periods that are just failing.
154+
# Use make target update_sdc_clock to install the updated sdc.
155+
source [file join $::env(SCRIPTS_DIR) "write_ref_sdc.tcl"]
188156

189-
global_route_helper
157+
write_guides $::env(RESULTS_DIR)/route.guide
158+
source_step_tcl POST GLOBAL_ROUTE
159+
orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb
160+
orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc

‎flow/scripts/variables.json‎

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flow/scripts/variables.yaml‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
11
---
2-
GENERATE_ARTIFACTS_ON_FAILURE:
3-
description: >
4-
For instance Bazel needs artifacts (.odb and .rpt files) on a failure to
5-
allow the user to save hours on re-running the failed step locally, but when
6-
working with a Makefile flow, it is more natural to fail the step and leave
7-
the user to manually inspect the logs and artifacts directly via the file
8-
system.
9-
Set to 1 to change the behavior to generate artifacts upon failure to e.g.
10-
do a global route. The exit code will still be non-zero on all other
11-
failures that aren't covered by the "useful to inspect the artifacts on
12-
failure" use-case.
13-
Example: just like detailed routing, a global route that fails with
14-
congestion, is not a build failure(as in exit code non-zero), it is a
15-
successful(as in zero exit code) global route that produce reports
16-
detailing the problem.
17-
Detailed route will not proceed, if there is global routing congestion
18-
This allows build systems, such as bazel, to create artifacts for global and
19-
detailed route, even if the operation had problems, without having know
20-
about the semantics between global and detailed route.
21-
Considering that global and detailed route can run for a long time and use a
22-
lot of memory, this allows inspecting results on a laptop for a build that
23-
ran on a server.
24-
default: 0
252
TNS_END_PERCENT:
263
description: >
274
Default TNS_END_PERCENT value for post CTS timing repair. Try fixing all

0 commit comments

Comments
 (0)