Repository navigation
gpl: replace BiCGSTAB with double-prec ConjugateGradient in InitialPlace - #12397
mikesinouye wants to merge 4 commits into
Conversation
Signed-off-by: Mike Inouye <mikeinouye@google.com>
Signed-off-by: Mike Inouye <mikeinouye@google.com>
|
Hi @calewis , would you mind reviewing this PR (again? 🙂) |
There was a problem hiding this comment.
Code Review
This pull request replaces the BiCGSTAB solver with a Conjugate Gradient solver using double-precision arithmetic and regularization, updates coordinate clamping to handle non-finite values before float-to-int conversion, and adds a test for unanchored initial placement. Feedback suggests avoiding potential dangling reference issues in the custom clamp lambda by using direct comparisons instead of std::clamp with mixed types, and improving solver efficiency by modifying diagonal elements in-place rather than performing sparse matrix addition.
Signed-off-by: Mike Inouye <mikeinouye@google.com>
|
Hi @mikesinouye, have you performed any experiments? I understand you may be more interested in solving an error more than improving QoR? |
Signed-off-by: Mike Inouye <mikeinouye@google.com>
calewis
left a comment
There was a problem hiding this comment.
A bit hacky for something that needs redoing but should be okay IMO. LGTM.
| } | ||
|
|
||
| if (std::isnan(error.x) || std::isnan(error.y)) { | ||
| if (!std::isfinite(error.x) || !std::isfinite(error.y)) { |
There was a problem hiding this comment.
Should we just check inf and nan?
There was a problem hiding this comment.
Aren't those the same? but isfinite() is a single conditional
For our internal designs and PDK, the results were not affected beyond the noise threshold. You are correct, the intent here is the crash fix by using a more suited solver, than improving QoR. |
Summary
For designs that have no PLACED or FIXED pins or instances, the matrix for InitialPlace is singular. The cells are all clumped at the origin without anything pulling them outward. This happens in practice when using the new
global_placement -place_iosmode. In certain designs, when UBSan is enabled, this causes a crashe as we have failing float/int casts. This is because the existing BiCGSTAB solver handles this case poorly, producing coords exceeding int max.If InitialPlace can complete, core Nesterov is able to spread the cells even if all cells remain overlapping at the center (effectively no InitialPlace), so this issue does not actually cause QoR issues for most designs in
-c opt.This PR replaces the BiCGSTAB solver with a double-precision ConjugateGradient solver to address the issue. The PR also tightens the conditional check to prevent cases like these and add a test.
Type of Change
Impact
Prevents crashes in fastbuild for designs using
global_placement -place_ios.Verification
./etc/Build.sh).