Skip to content

make: immediately expand deferred vars, v2 - #4589

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
gtkiku:immediate-expand
Oct 17, 2026
Merged

maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
gtkiku:immediate-expand

Conversation

@gtkiku

@gtkiku gtkiku commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Previous approach apparently caused some externally-defined variables to become overwritten, and modifications made in 72eca88 effectively reverted back to the old behaviour of spawning a huge number of shells for each make invocation. Try to cut that number down again by requiring that the runtime environment provide appropriate values for PYTHON_EXE, OPENROAD_EXE, OPENSTA_EXE and YOSYS_EXE, otherwise use ORFS-built tools.


Related PR from which this was split: #4573. Weak dependency on #4588, as the Nix flake will not pass in the expected vars otherwise. Although, as mentioned in #4573, the flake is currently a bit broken anyway.

@oharboe

Previous approach apparently caused some externally-defined variables to
become overwritten, and modifications made in 72eca88 effectively
reverted back to the old behaviour of spawning a huge number of shells
for each `make` invocation. Try to cut that number down again by
requiring that the runtime environment provide appropriate values for
PYTHON_EXE, OPENROAD_EXE, OPENSTA_EXE and YOSYS_EXE, otherwise use
ORFS-built tools.

Signed-off-by: ctkiku <kim.kuparinen@tuni.fi>

@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 refactors flow/scripts/variables.mk to optimize performance by avoiding deferred shell commands that spawn excessive shell instances. It simplifies the definitions of OPENROAD_EXE, OPENSTA_EXE, and YOSYS_EXE, and checks if PYTHON_EXE is undefined before running a shell command to locate it. Feedback suggests using $(strip $(PYTHON_EXE)) instead of checking $(origin PYTHON_EXE) against undefined to more robustly handle cases where the variable is defined but empty.

Comment thread flow/scripts/variables.mk
Comment on lines +109 to +111
ifeq ($(origin PYTHON_EXE), undefined)
PYTHON_EXE := $(shell command -v python3)
endif

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.

medium

Checking $(origin PYTHON_EXE) against undefined will not detect cases where PYTHON_EXE is defined but empty (e.g., if exported as an empty string from the environment or a wrapper script). Using $(strip $(PYTHON_EXE)) is more robust as it handles both undefined and empty values gracefully.

ifeq ($(strip $(PYTHON_EXE)),)
  PYTHON_EXE := $(shell command -v python3)
endif

@gtkiku

gtkiku commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Just noticed that grepping for OPENSTA_EXE doesn't show any uses. Are they hidden by something or can/should it be removed?

@oharboe

oharboe commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Just noticed that grepping for OPENSTA_EXE doesn't show any uses. Are they hidden by something or can/should it be removed?

Keep it. Sometimes we use it to create standalone opensta test cases and also in power simulation, it can be handy. openroad normally executes .tcl scripts that opensta could have run.

@oharboe

oharboe commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

LGTM

@hzeller ?

@openroad-ci

openroad-ci commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

🔍 QoR check

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

Commit 839d5a5 · Jenkins build #4 · Baseline: build · View build on dashboard

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

@oharboe

oharboe commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@maliberty A nice simplification.

@maliberty
maliberty merged commit 3fb51dc into The-OpenROAD-Project:master Oct 17, 2026
11 of 12 checks passed
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.

4 participants