Skip to content

code and regression#10241

Closed
openroad-ci wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix_long_sdc_match_runtime
Closed

code and regression#10241
openroad-ci wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:fix_long_sdc_match_runtime

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Summary

dbSdcNetwork::findInstancesMatching1 traverses the entire design
hierarchy for every wildcard pattern, matching each instance's full
path against the pattern. On hierarchical loads with millions of
instances, a single read_sdc containing ~100k constraints like
set_false_path -from [get_cells cpu/core0/icache/*_reg] performs
O(patterns x insts) work -- tens of minutes to hours to read an SDC
that other tools load in seconds.

Anchor the DFS at the deepest literal path prefix before any
wildcard. For cpu/core0/icache/*_reg we resolve cpu/core0/icache
via the existing findInstance() hash (which already covers divider
and bracket escape variants) and only DFS under that subtree.
Patterns with a leading wildcard (*/clk) are unchanged.

Correctness

  • Match semantics are preserved: path_buffer is seeded with the
    literal prefix, so pattern->match() still sees the full
    hierarchical name.
  • Regex patterns skip the optimization entirely (cannot assume /
    is a literal segment boundary under regex).
  • The scan honors pathEscape() so escaped dividers in a prefix
    don't misanchor.
  • Flat-mode designs (read_def) can have leaf names like b1/r1
    with embedded dividers where no instance b1 exists -- the
    optimization only anchors when the resolved prefix is non-leaf,
    otherwise falls through to the legacy unanchored DFS. Caught by
    the existing sdc_names1 test during development.

Type of Change

  • Bug fix
  • Performance

Impact

  • Hierarchical read_sdc on customer design with ~6M instances and
    ~100k constraints: hours -> seconds.
  • All 62 existing dbSta regressions continue to pass.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Related Issues

Reported slowdown on hierarchical SDC load for 6M-instance design.

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>

@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 optimizes hierarchical instance matching in dbSdcNetwork::findInstancesMatching1 by implementing prefix pruning. The search now identifies the deepest literal prefix in a pattern to anchor the depth-first search at a specific sub-instance rather than the design root, which improves performance for non-regex patterns. A new test case, sdc_hier_wildcard, has been added to verify this logic against various wildcard scenarios. I have no feedback to provide as there were no review comments.

@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@dsengupta0628

Copy link
Copy Markdown
Contributor

/gemini review

@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 optimizes hierarchical instance matching in dbSdcNetwork::findInstancesMatching1 by anchoring the depth-first search at the deepest literal prefix of the pattern. This optimization avoids traversing the entire design hierarchy when a specific prefix is provided. Additionally, a new test case sdc_hier_wildcard was added to verify the logic. I have no feedback to provide.

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants