Skip to content

Conversation

@oharboe
Copy link
Collaborator

@oharboe oharboe commented Jan 6, 2026

minimizes surprises, same behavior as orfs_flow()

minimizes surprises, same behavior as orfs_flow()

Signed-off-by: Øyvind Harboe <[email protected]>
@oharboe oharboe requested a review from Copilot January 6, 2026 11:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors orfs_synth to filter stage-specific arguments before passing them to the underlying rule implementation, matching the behavior of orfs_flow(). This prevents unnecessary rebuilds by ensuring only relevant arguments are passed to each stage.

Key changes:

  • Introduced _filter_stage_args() helper function to filter arguments per stage
  • Converted orfs_synth from a rule to a macro wrapper that calls the new _orfs_synth rule
  • Applied the same argument filtering pattern to synthesis and other stages in _orfs_pass()

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
openroad.bzl Renamed orfs_synth rule to _orfs_synth, added _filter_stage_args() function, created new orfs_synth() macro wrapper, and updated _orfs_pass() to use filtered arguments
BUILD Added test comment with PLACE_DENSITY argument to verify synth stage doesn't rebuild when non-synth arguments change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1178 to +1179
"""Filter and prepare the arguments for a specific stage."""

Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The _filter_stage_args function lacks a docstring explaining its parameters and return value. While line 1178 provides a brief description, it should document the stage parameter and the **kwargs structure including expected keys like arguments, data, settings, etc.

Suggested change
"""Filter and prepare the arguments for a specific stage."""
"""
Filter and prepare the keyword arguments for a specific flow stage.
This helper normalizes and combines generic and per-stage arguments,
sources, and data before invoking a particular stage of the flow.
Args:
stage: String name of the stage to prepare arguments for (for example
"synth", "place", or "route"). This value is used to select
per-stage entries from the structures in ``**kwargs``.
**kwargs: Keyword arguments controlling how stage arguments are built.
Recognized keys include:
* ``arguments``: dict mapping generic argument names to values that
apply to all stages.
* ``data``: list of data targets or files that apply to all stages.
* ``settings``: dict of generic settings (similar structure to
``arguments``) that apply to all stages.
* ``extra_configs``: dict mapping stage name to a list of additional
configuration files or labels for that stage.
* ``sources``: dict or structure containing source files or labels
that are shared across stages.
* ``stage_arguments``: dict mapping stage name to a dict of
arguments specific to that stage.
* ``stage_sources``: dict mapping stage name to additional source
entries specific to that stage.
* ``stage_data``: dict mapping stage name to a list of data entries
(targets or files) specific to that stage.
Any additional keyword arguments are passed through unchanged to the
returned dictionary.
Returns:
A dict containing the prepared keyword arguments for ``stage`` with at
least the following keys:
* ``arguments``: merged generic and per-stage arguments.
* ``data``: combined generic and per-stage data.
* ``extra_configs``: list of extra configuration entries for the
given stage.
* ``settings``: merged generic and per-stage settings.
Any additional keys provided in ``**kwargs`` are also included in the
returned dict.
"""

Copilot uses AI. Check for mistakes.
Comment on lines +1180 to +1181
def _args(**kwargs):
return kwargs
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The nested _args() helper function simply returns its arguments as a dictionary. This adds unnecessary indirection - you can directly return a dictionary literal in the outer function's return statement instead.

Copilot uses AI. Check for mistakes.
@oharboe oharboe merged commit ece1244 into main Jan 6, 2026
19 checks passed
@oharboe oharboe deleted the orfs-synth-rebuild-fix branch January 8, 2026 08:00
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