Skip to content

flow: optional values for synth..cts default to "" and are read without a helper - #4922

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-defaults-values
Open

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:tcl-defaults-values

Conversation

@oharboe

@oharboe oharboe commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Sixteen optional values read in synthesis, floorplan, place and CTS have no default in variables.yaml; their absence means "let the tool choose", and every read is guarded. This gives each one default: "". Where the value decides whether an option is passed, the guard becomes an explicit $::env(X) ne "", which is exactly what the helper tested; where it goes through append_env_var ... 1, the call is left alone, as an empty value passes nothing there.

variable script now
INFER_CLKGATES_MIN_NET_SIZE synth.tcl ne "" (-min_net_size)
TAP_CELL_NAME regfile_dissolve.tcl ne "" (-endcap_master)
PLACE_DENSITY_LB_ADDON util.tcl ne "" (else PLACE_DENSITY)
GPL_KEEP_OVERFLOW global_place.tcl ne "", was info exists
EARLY_SIZING_CAP_RATIO resize.tcl ne ""
ADDITIONAL_SITES, RTLMP_MAX_INST, RTLMP_MIN_INST, RTLMP_MAX_MACRO, RTLMP_MIN_MACRO, GPL_RANDOM_SEED, CTS_BUF_DISTANCE, CTS_CLUSTER_SIZE, CTS_CLUSTER_DIAMETER, CTS_BUF_LIST, CTS_LIB_NAME floorplan.tcl, macro_place_util.tcl, global_place*.tcl, cts.tcl default only (append_env_var ... 1)

One behaviour change, on a value nobody sets: GPL_KEEP_OVERFLOW was tested with info exists, so an explicitly empty value passed -keep_resize_below_overflow {}, and global_placement stopped on it (on master, nangate45/gcd). It now passes nothing, as when unset.

No in-tree config sets any of the sixteen to empty. Platform values are unaffected: the platform config.mk is read before the variables.yaml defaults, which assign with ?= (asap7's ADDITIONAL_SITES += included). Every stage that reads each variable is in its stages: list, or the variable has no stages: list (TAP_CELL_NAME). FlowVariables.md renders default: "" as it renders no default, so it is unchanged.

TclContract.md gets the rule: an optional value the tool chooses when it is absent defaults to "" and is tested with ne "" where it decides whether an option is passed. #4921, the same cleanup for the grt..final values, adds the same line.

Why

Easier to read: if { $::env(EARLY_SIZING_CAP_RATIO) ne "" } says what it tests. Failures are hard and early: a misspelled or erased variable fails at the line that reads it, where today it silently lets the tool choose. And fewer squirrels for AI to chase: an info exists that lets "" through to a command that rejects it is a code path no CI run takes, and an agent reading the scripts chases it instead of the real problem.

Test

Full flows to 6_report, master vs this branch, logs (runtimes, memory and paths dropped) and every stage metric compared:

design flow covers logs differing metrics differing
asap7/gcd separate stages / KEEP_VARS=1 ADDITIONAL_SITES (platform), place, cts 0 / 0 0 / 0
nangate45/gcd separate stages / KEEP_VARS=1 PLACE_DENSITY_LB_ADDON (design), place, cts 0 / 0 0 / 0
sky130hd/gcd separate stages / KEEP_VARS=1 same 0 / 0 0 / 0
gf180/uart-blocks separate stages / KEEP_VARS=1 macro placement (rtl_macro_placer, the RTLMP_* values) 0 / 0 0 / 0

Set values take effect, identically before and after (0 logs, 0 metrics differ):

  • asap7/gcd INFER_CLKGATES=1 INFER_CLKGATES_MIN_NET_SIZE=4: clockgate ... -min_net_size 4.
  • nangate45/gcd GPL_KEEP_OVERFLOW=0.3: -keep_resize_below_overflow 0.3.
  • nangate45/gcd EARLY_SIZING_CAP_RATIO=4: set_opt_config -set_early_sizing_cap_ratio 4.
  • nangate45/gcd PLACE_DENSITY_LB_ADDON= (empty): global_placement -density 0.3, the design's PLACE_DENSITY, as before.
  • nangate45/gcd CTS_CLUSTER_SIZE=10 CTS_BUF_DISTANCE=60 GPL_RANDOM_SEED=3: -distance_between_buffers 60 -sink_clustering_size 10 and -random_seed 3.

Unset in the tool's environment: master runs on and lets the tool choose; this branch stops at the read, can't read "::env(X)": no such variable: INFER_CLKGATES_MIN_NET_SIZE in yosys, GPL_KEEP_OVERFLOW and PLACE_DENSITY_LB_ADDON in 3_3_place_gp, EARLY_SIZING_CAP_RATIO in 3_4_place_resized. The eleven append_env_var variables still pass nothing when unset; that helper's guard is a separate change. No in-tree design reaches the TAP_CELL_NAME read in regfile_dissolve.tcl (it needs an AUTO_MEMORIES_REGFILES spec); every platform with tap cells sets it.

tclint/tclfmt 0.9.0 are clean; flow/test test_generate_vars.py and test_make_issue.py pass; this merges cleanly with each of #4910-#4921, and with the other open Tcl cleanup branches.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Tcl contract documentation and various Tcl scripts to check optional environment variables using $::env(X) ne "" instead of env_var_exists_and_non_empty or info exists, while defining their default values as "" in variables.yaml. The review feedback suggests using $::env instead of $env inside flow/scripts/resize.tcl to ensure consistency and prevent potential runtime errors if the script is sourced within a non-global scope.

Comment thread flow/scripts/resize.tcl Resolved
Sixteen optional values read in synthesis, floorplan, place and CTS
have no default in variables.yaml; their absence means "let the tool
choose". Give each `default: ""`. The five `if` guards become
`$::env(X) ne ""`, which keeps exactly what the helpers tested; the
eleven `append_env_var ... 1` calls are left alone, as an empty value
passes nothing there.

GPL_KEEP_OVERFLOW was tested with `info exists`, so an explicitly empty
value passed `-keep_resize_below_overflow ""`; it now passes nothing.

TclContract.md gets the rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Øyvind Harboe <[email protected]>
@openroad-ci

openroad-ci commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

🔍 QoR check

Metrics reflect the PR merge build — i.e. what will land on the target branch.

Commit 39deaeb · Jenkins build #2 · Baseline: build · View build on dashboard

62 design(s) checked — 0 with regression(s), 0 without a comparable baseline.

✅ QoR is compared against the master build at this PR's merge base 58710a4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants