Skip to content

cts: fix infinite loop in HTree bisection when sink count reaches 1 - #11146

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:cts-lockup-fix
Open

cts: fix infinite loop in HTree bisection when sink count reaches 1#11146
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:cts-lockup-fix

Conversation

@oharboe

@oharboe oharboe commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

With max_wl set, once sinks per sub-region reaches 1 the only remaining stop criteria were hpwl < max_wl (CTS-0038) or hpwl not improving (CTS-0054). If hpwl keeps improving asymptotically above max_wl, the loop bisects up to clock_tree_max_depth (100) with per-level cost doubling, i.e. a practical hang. Break once sinks <= 1: further bisection cannot reduce fanout.

Reviewer notes:

  • All .ok diffs change only the stop-criterion message line; buffer counts and tree structure are unchanged, so no QoR change in the existing suite.
  • Trade-off: under max_wl this stops even if hpwl is still improving toward max_wl; a long final wire is left to repair_clock_nets.
  • Check is placed after computeLevelTopology, matching where the old criteria fired. CTS-0136 is a new message ID.

Reported in ascenium/issues/50; demonstrated by max_wl_two_sinks.

Summary

[Describe your changes here]

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Impact

[How does this change the tool's behavior?]

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 included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

[Link issues here]

With max_wl set, once sinks per sub-region reaches 1 the only remaining
stop criteria were hpwl < max_wl (CTS-0038) or hpwl not improving
(CTS-0054). If hpwl keeps improving asymptotically above max_wl, the
loop bisects up to clock_tree_max_depth (100) with per-level cost
doubling, i.e. a practical hang. Break once sinks <= 1: further
bisection cannot reduce fanout.

Reviewer notes:
- All .ok diffs change only the stop-criterion message line; buffer
  counts and tree structure are unchanged, so no QoR change in the
  existing suite.
- Trade-off: under max_wl this stops even if hpwl is still improving
  toward max_wl; a long final wire is left to repair_clock_nets.
- Check is placed after computeLevelTopology, matching where the old
  criteria fired. CTS-0136 is a new message ID.

Reported in ascenium/issues/50; demonstrated by max_wl_two_sinks.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe requested a review from a team as a code owner August 14, 2026 12:51
@oharboe
oharboe requested a review from luis201420 August 14, 2026 12:51

@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 introduces an early stop criterion in HTreeBuilder::run() when the number of sinks per sub-region is less than or equal to 1, logging the event with a new message ID CTS-0136 and breaking the loop. Multiple test expectation files (.ok files) have been updated to reflect this change. There are no review comments, so I have no feedback to provide.

@oharboe

oharboe commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

@luis201420 @maliberty Shooting from the hip here... I got this from letting agy loose on a confidential test case with an infinite loop.

Is this plausible?

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.

1 participant