Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpl: revert if diverge #6561

Conversation

openroad-ci
Copy link
Collaborator

This PR introduces a new TCL command that allows GPL to finish with an incomplete solution if divergence is detected. The solution is considered incomplete because it does not meet the 0.10 target for total overflow.

With the new option enabled gpl will snapshot the placement state (using a similar methodology as routability-mode already does), the snapshot is saved considering the smallest HPWL and when the total overflow is below 0.25. In the event of divergence, GPL will revert to the snapshot and complete the process with this solution instead of failing and throwing an error.

This approach has been tested successfully on Megaboom and nangate45/bp_be designs in cases of divergence.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

diverge_snapshot_iter_,
diverge_snapshot_average_overflow_unscaled_,
min_hpwl_);
curA = diverge_snapshotA;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: Value stored to 'curA' is never read [clang-analyzer-deadcode.DeadStores]

        curA = diverge_snapshotA;
        ^
Additional context

src/gpl/src/nesterovPlace.cpp:572: Value stored to 'curA' is never read

        curA = diverge_snapshotA;
        ^

src/gpl/src/replace.tcl Outdated Show resolved Hide resolved
@oharboe
Copy link
Collaborator

oharboe commented Jan 21, 2025

@gudeh Is this a solution or a way to cope with the algorithm diverging unexpectedly/undesirably?

@gudeh
Copy link
Contributor

gudeh commented Jan 21, 2025

@gudeh Is this a solution or a way to cope with the algorithm diverging unexpectedly/undesirably?

Hi @oharboe, this is just a way to take some pressure away from this problem, a way to cope with the divergence. The actual solution for the divergence occurring in gpl is still under investigation.

@gudeh
Copy link
Contributor

gudeh commented Jan 21, 2025

This PR should help avoiding the errors reported at issues #6542 and #6465

@gudeh
Copy link
Contributor

gudeh commented Jan 22, 2025

This PR only adds the new non-default option, it has no change in functionality. In another ORFS PR I activated the new functionality only for nangate45/BP_BE. We have no metrics changing and both PR could be merged separately

@oharboe
Copy link
Collaborator

oharboe commented Jan 22, 2025

@gudeh FYI The-OpenROAD-Project/OpenROAD-flow-scripts#2705

Comment on lines 424 to 425
// log_->report("[NesterovSolve] Snapshot for divergence saved at iter =
// {}", iter);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commented code.

Comment on lines 337 to 338
utl::warn "GPL" 153 \
"Allow revert to saved snapshot if a divergence is detected."
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this a warning? If the user set this flag, it is not something unexpected. This can be a utl::info, but I'm not sure if it is necessary at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

Other existing messages in gpl/src/replace.tcl tend to be warnings also.

I think this message is useful to make sure the non-default behavior is activated. Maybe let's leave it as ult::info?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ok with utl::info.

@@ -198,7 +199,7 @@ void Replace::doIncrementalPlace(int threads)
int iter = doNesterovPlace(threads);
setNesterovPlaceMaxIter(previous_max_iter);

// Finish the overflow resolution from the rough placement
// Finish' the overflow resolution from the rough placement
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

diverge_snapshot_iter_,
diverge_snapshot_average_overflow_unscaled_,
min_hpwl_);
curA = diverge_snapshotA;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: Value stored to 'curA' is never read [clang-analyzer-deadcode.DeadStores]

        curA = diverge_snapshotA;
        ^
Additional context

src/gpl/src/nesterovPlace.cpp:570: Value stored to 'curA' is never read

        curA = diverge_snapshotA;
        ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

bool isDivergeTriedRevert = false;

// divergence snapshot info
float diverge_snapshotA = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'diverge_snapshotA' set but not used [clang-diagnostic-unused-but-set-variable]

  float diverge_snapshotA = 0;
        ^

if (is_min_hpwl_) {
diverge_snapshotWlCoefX = wireLengthCoefX_;
diverge_snapshotWlCoefY = wireLengthCoefY_;
diverge_snapshotA = curA;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: Value stored to 'diverge_snapshotA' is never read [clang-analyzer-deadcode.DeadStores]

        diverge_snapshotA = curA;
        ^
Additional context

src/gpl/src/nesterovPlace.cpp:419: Value stored to 'diverge_snapshotA' is never read

        diverge_snapshotA = curA;
        ^

Signed-off-by: Augusto Berndt <[email protected]>
Copy link
Contributor

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

Copy link
Contributor

@eder-matheus eder-matheus left a comment

Choose a reason for hiding this comment

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

LGTM, but I'll wait for @maliberty's comments on the changes before merging.

Copy link
Member

@maliberty maliberty left a comment

Choose a reason for hiding this comment

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

Fine aside from flipping the default

@@ -198,7 +199,7 @@ void Replace::doIncrementalPlace(int threads)
int iter = doNesterovPlace(threads);
setNesterovPlaceMaxIter(previous_max_iter);

// Finish the overflow resolution from the rough placement
// Finish' the overflow resolution from the rough placement
Copy link
Member

Choose a reason for hiding this comment

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

stray character

Comment on lines 424 to 425
// log_->report("[NesterovSolve] Snapshot for divergence saved at iter =
// {}", iter);
Copy link
Member

Choose a reason for hiding this comment

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

rm

@@ -97,6 +97,7 @@ global_placement
[-timing_driven_net_weight_max]
[-timing_driven_nets_percentage]
[-keep_resize_below_overflow]
[-allow_revert_if_diverge]
Copy link
Member

Choose a reason for hiding this comment

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

We are going to flip this to on by default with a disable.

Copy link
Contributor

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

1 similar comment
Copy link
Contributor

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

@gudeh gudeh requested a review from maliberty January 24, 2025 15:01
@eder-matheus eder-matheus merged commit 1ab5157 into The-OpenROAD-Project:master Jan 24, 2025
11 checks passed
@openroad-ci openroad-ci deleted the gpl-revert-if-diverge branch January 24, 2025 16:09
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.

5 participants