Skip to content

Commit c27ec1e

Browse files
committed
fix(variables): support forked variants in open.tcl, document genMetrics limits
FLOW_VARIANT and genMetrics.py works only within a single variant. Implement a hard stop in genMetrics.py if FLOW_INPUT_VARIANT is different from FLOW_VARIANT, as cross-variant log/report paths are not supported. Fix GUI reading netlist in forked variants by resolving V_FILE through orfs_input_path. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 7fa0d2b commit c27ec1e

6 files changed

Lines changed: 23 additions & 9 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ input directory too, independently of `FLOW_INPUT_VARIANT`.
215215
| <a name="FILL_CELLS"></a>FILL_CELLS| Fill cells are used to fill empty sites. If not set or empty, fill cell insertion is skipped.| |
216216
| <a name="FILL_CONFIG"></a>FILL_CONFIG| JSON rule file for metal fill during chip finishing.| |
217217
| <a name="FLOORPLAN_DEF"></a>FLOORPLAN_DEF| Use the DEF file to initialize floorplan. Mutually exclusive with FOOTPRINT or DIE_AREA/CORE_AREA or CORE_UTILIZATION.| |
218-
| <a name="FLOW_INPUT_VARIANT"></a>FLOW_INPUT_VARIANT| Flow variant a stage reads its inputs from, used in the INPUT_RESULTS_DIR/INPUT_LOG_DIR/INPUT_REPORTS_DIR/INPUT_OBJECTS_DIR directory names. Defaults to FLOW_VARIANT, i.e. a stage reads from the same variant directory it writes to. Set it to fork a variant off a shared upstream one: the forked variant reads the upstream results and writes only its own, so the shared stages are never re-run.| |
218+
| <a name="FLOW_INPUT_VARIANT"></a>FLOW_INPUT_VARIANT| Flow variant a stage reads its inputs from, used in the INPUT_RESULTS_DIR/INPUT_LOG_DIR/INPUT_REPORTS_DIR/INPUT_OBJECTS_DIR directory names. Defaults to FLOW_VARIANT, i.e. a stage reads from the same variant directory it writes to. Set it to fork a variant off a shared upstream one: the forked variant reads the upstream results and writes only its own, so the shared stages are never re-run. Note: FLOW_VARIANT and genMetrics.py works only within a single variant, FLOW_INPUT_VARIANT different from FLOW_VARIANT is not supported.| |
219219
| <a name="FLOW_VARIANT"></a>FLOW_VARIANT| Flow variant to use, used in the flow variant directory name.| base|
220220
| <a name="FOOTPRINT"></a>FOOTPRINT| Custom footprint definition file for ICeWall-based floorplan initialization. Mutually exclusive with FLOORPLAN_DEF or DIE_AREA/CORE_AREA or CORE_UTILIZATION.| |
221221
| <a name="FOOTPRINT_TCL"></a>FOOTPRINT_TCL| Specifies a Tcl script with custom footprint-related commands for floorplan setup.| |
222222
| <a name="GDS_ALLOW_EMPTY"></a>GDS_ALLOW_EMPTY| Single regular expression of module names of macros that have no .gds file| |
223223
| <a name="GDS_FILES"></a>GDS_FILES| Path to platform GDS files.| |
224-
| <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|
224+
| <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 Note: FLOW_VARIANT and genMetrics.py works only within a single variant, FLOW_INPUT_VARIANT different from FLOW_VARIANT is not supported. 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|
225225
| <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.| |
226226
| <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|
227227
| <a name="GLOBAL_ROUTE_USE_CUGR"></a>GLOBAL_ROUTE_USE_CUGR| Passed as -use_cugr to global_route. Uses CUGR as the global routing solver instead of the default FastRoute solver. NOTE: CUGR is not ready for production.| 0|

‎flow/scripts/open.tcl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if { [env_var_exists_and_non_empty DEF_FILE] } {
2424
log_cmd read_lef $lef
2525
}
2626
}
27-
set input_file $::env(V_FILE)
27+
set input_file [orfs_input_path [file tail $::env(V_FILE)]]
2828
log_cmd read_verilog $input_file
2929
log_cmd link_design {*}[hier_options] $::env(DESIGN_NAME)
3030
} else {

‎flow/scripts/util.tcl‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ proc recover_power_helper { } {
8080
# two are the same directory unless FLOW_INPUT_VARIANT says otherwise.
8181
proc orfs_input_dirs { } {
8282
set dirs [list $::env(RESULTS_DIR)]
83-
if {
84-
[info exists ::env(INPUT_RESULTS_DIR)] &&
85-
$::env(INPUT_RESULTS_DIR) ne $::env(RESULTS_DIR)
86-
} {
83+
if { $::env(INPUT_RESULTS_DIR) ne $::env(RESULTS_DIR) } {
8784
lappend dirs $::env(INPUT_RESULTS_DIR)
8885
}
8986
return $dirs

‎flow/scripts/variables.json‎

Lines changed: 2 additions & 2 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ GENERATE_ARTIFACTS_ON_FAILURE:
33
description: >
44
For instance Bazel needs artifacts (.odb and .rpt files) on a failure to
55
allow the user to save hours on re-running the failed step locally, but when
6+
Note: FLOW_VARIANT and genMetrics.py works only within a single variant, FLOW_INPUT_VARIANT
7+
different from FLOW_VARIANT is not supported.
68
working with a Makefile flow, it is more natural to fail the step and leave
79
the user to manually inspect the logs and artifacts directly via the file
810
system.
@@ -1518,6 +1520,8 @@ FLOW_INPUT_VARIANT:
15181520
off a shared upstream one: the forked variant reads the upstream
15191521
results and writes only its own, so the shared stages are never
15201522
re-run.
1523+
Note: FLOW_VARIANT and genMetrics.py works only within a single variant, FLOW_INPUT_VARIANT
1524+
different from FLOW_VARIANT is not supported.
15211525
RULES_JSON:
15221526
description: >
15231527
json files with the metrics baseline regression rules.

‎flow/util/genMetrics.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,19 @@ def extract_metrics(
399399
if __name__ == "__main__":
400400
args = parse_args()
401401

402+
# FLOW_INPUT_VARIANT is not supported for metrics generation because
403+
# resolving inputs requires a search path across logs/reports/results,
404+
# which this script does not currently implement.
405+
log_variant = os.path.basename(os.path.normpath(args.logs))
406+
if log_variant != args.flowVariant:
407+
import sys
408+
409+
print(
410+
f"ERROR: genMetrics.py does not support FLOW_INPUT_VARIANT ({log_variant}) different from FLOW_VARIANT ({args.flowVariant})",
411+
file=sys.stderr,
412+
)
413+
sys.exit(1)
414+
402415
extract_metrics(
403416
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"),
404417
args.platform,

0 commit comments

Comments
 (0)