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: change bin size from int to float #6530

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

openroad-ci
Copy link
Collaborator

The bin size was calculated by dividing the size of the CoreBBox by the number of bins and then rounding it up.
This can cause some bins to have a negative size.

Changes:

  • The bin size is calculated in double
  • The ceil function was removed from the bin size calculations.
  • Now the bin corners are snapped in place by rounding only after calculating their positions using double variables.

Copy link
Contributor

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

@eder-matheus
Copy link
Contributor

@LucasYuki Is this ready for review? Please fix clang-format too.

@eder-matheus eder-matheus marked this pull request as draft January 16, 2025 16:58
@@ -895,7 +893,7 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
bin.setDensity((static_cast<float>(bin.instPlacedArea())
+ static_cast<float>(bin.fillerArea())
+ static_cast<float>(bin.nonPlaceArea()))
/ scaledBinArea);
/ binArea);
Copy link
Contributor

@gudeh gudeh Jan 21, 2025

Choose a reason for hiding this comment

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

@maliberty I talked to you about this change. Other code changes are to fix the negative bin sizes.

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

x_grid_set.push_back(bin[x].ux());
}
for (int y = 0; y < y_grid; y++) {
y_grid_set.push_back(bin[y*x_grid].uy());
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: performing an implicit widening conversion to type 'std::vector::size_type' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result]

    y_grid_set.push_back(bin[y*x_grid].uy());
                             ^
Additional context

src/gpl/src/graphics.cpp:493: make conversion explicit to silence this warning

    y_grid_set.push_back(bin[y*x_grid].uy());
                             ^

src/gpl/src/graphics.cpp:493: perform multiplication in a wider type

    y_grid_set.push_back(bin[y*x_grid].uy());
                             ^

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

x_grid_set.push_back(bin[x].ux());
}
for (int y = 0; y < y_grid; y++) {
y_grid_set.push_back(bin[y * x_grid].uy());
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: performing an implicit widening conversion to type 'std::vector::size_type' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result]

    y_grid_set.push_back(bin[y * x_grid].uy());
                             ^
Additional context

src/gpl/src/graphics.cpp:495: make conversion explicit to silence this warning

    y_grid_set.push_back(bin[y * x_grid].uy());
                             ^

src/gpl/src/graphics.cpp:495: perform multiplication in a wider type

    y_grid_set.push_back(bin[y * x_grid].uy());
                             ^

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

x_grid_set.push_back(bin[x].ux());
}
for (int y = 0; y < y_grid; y++) {
y_grid_set.push_back(bin[y * x_grid].uy());
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: performing an implicit widening conversion to type 'std::vector::size_type' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result]

    y_grid_set.push_back(bin[y * x_grid].uy());
                             ^
Additional context

src/gpl/src/graphics.cpp:493: make conversion explicit to silence this warning

    y_grid_set.push_back(bin[y * x_grid].uy());
                             ^

src/gpl/src/graphics.cpp:493: perform multiplication in a wider type

    y_grid_set.push_back(bin[y * x_grid].uy());
                             ^

@LucasYuki LucasYuki requested a review from gudeh January 29, 2025 12:10
Copy link
Contributor

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

x_grid_set.push_back(bin[0].lx());
y_grid_set.push_back(bin[0].ly());

for (std::vector<Bin>::size_type x = 0; x < x_grid; x++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you using std::vector<Bin>::size_type when your x_grid limit for the loop is an int?

Copy link
Contributor

Choose a reason for hiding this comment

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

It was to implement this clang-tidy suggestion, but in the x_grid it was not necessary.
Do I change back to int?

x_grid_set.push_back(bin[0].lx());
y_grid_set.push_back(bin[0].ly());

for (std::vector<Bin>::size_type x = 0; x < x_grid; x++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you using std::vector<Bin>::size_type when your x_grid limit for the loop is an int?

@LucasYuki LucasYuki requested a review from maliberty January 30, 2025 17:44
@maliberty maliberty marked this pull request as ready for review January 30, 2025 17:45
@maliberty
Copy link
Member

Is there an ORFS PR this needs to pair with?

Copy link
Contributor

github-actions bot commented Feb 3, 2025

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

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

github-actions bot commented Feb 3, 2025

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

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

bins_[bin_index]
= Bin(idxX, idxY, bin_lx, bin_ly, bin_ux, bin_uy, targetDensity_);
auto& bin = bins_[bin_index];
if (bin.dx() < 0 || bin.dy() < 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: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
if (bin.dx() < 0 || bin.dy() < 0)
if (bin.dx() < 0 || bin.dy() < 0) {

src/gpl/src/nesterovBase.cpp:792:

-                    bin.dy());
+                    bin.dy());
+ }

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