Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#6351 from gudeh/gpl-overflow-…
Browse files Browse the repository at this point in the history
…debug

gpl: debug options for overflow
  • Loading branch information
eder-matheus authored Dec 13, 2024
2 parents f76b754 + 9c89af8 commit 6bd2ccb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/gpl/src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ bool Graphics::populateMap()
0.0f,
static_cast<float>(bin.instPlacedAreaUnscaled())
+ static_cast<float>(bin.nonPlaceAreaUnscaled()) - scaledBinArea);
addToMap(box, value);
odb::dbBlock* block = pbc_->db()->getChip()->getBlock();
addToMap(box, block->dbuAreaToMicrons(value));
}
}

Expand Down
47 changes: 37 additions & 10 deletions src/gpl/src/nesterovBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,12 @@ int BinGrid::binSizeY() const

int64_t BinGrid::overflowArea() const
{
return overflowArea_;
return sumOverflowArea_;
}

int64_t BinGrid::overflowAreaUnscaled() const
{
return overflowAreaUnscaled_;
return sumOverflowAreaUnscaled_;
}

static unsigned int roundDownToPowerOfTwo(unsigned int x)
Expand Down Expand Up @@ -876,12 +876,13 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
}
}

overflowArea_ = 0;
overflowAreaUnscaled_ = 0;
odb::dbBlock* block = pb_->db()->getChip()->getBlock();
sumOverflowArea_ = 0;
sumOverflowAreaUnscaled_ = 0;
// update density and overflowArea
// for nesterov use and FFT library
#pragma omp parallel for num_threads(num_threads_) \
reduction(+ : overflowArea_, overflowAreaUnscaled_)
reduction(+ : sumOverflowArea_, sumOverflowAreaUnscaled_)
for (auto it = bins_.begin(); it < bins_.end(); ++it) {
Bin& bin = *it; // old-style loop for old OpenMP

Expand All @@ -896,15 +897,41 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
+ static_cast<float>(bin.nonPlaceArea()))
/ scaledBinArea);

overflowArea_ += std::max(0.0f,
static_cast<float>(bin.instPlacedArea())
+ static_cast<float>(bin.nonPlaceArea())
- scaledBinArea);
sumOverflowArea_ += std::max(0.0f,
static_cast<float>(bin.instPlacedArea())
+ static_cast<float>(bin.nonPlaceArea())
- scaledBinArea);

overflowAreaUnscaled_ += std::max(
auto overflowAreaUnscaled = std::max(
0.0f,
static_cast<float>(bin.instPlacedAreaUnscaled())
+ static_cast<float>(bin.nonPlaceAreaUnscaled()) - scaledBinArea);
sumOverflowAreaUnscaled_ += overflowAreaUnscaled;
if (overflowAreaUnscaled > 0) {
debugPrint(log_,
GPL,
"overflow",
1,
"overflow:{}, bin:{},{}",
block->dbuAreaToMicrons(overflowAreaUnscaled),
block->dbuToMicrons(bin.lx()),
block->dbuToMicrons(bin.ly()));
debugPrint(log_,
GPL,
"overflow",
1,
"binArea:{}, scaledBinArea:{}",
block->dbuAreaToMicrons(binArea),
block->dbuAreaToMicrons(scaledBinArea));
debugPrint(
log_,
GPL,
"overflow",
1,
"bin.instPlacedAreaUnscaled():{}, bin.nonPlaceAreaUnscaled():{}",
block->dbuAreaToMicrons(bin.instPlacedAreaUnscaled()),
block->dbuAreaToMicrons(bin.nonPlaceAreaUnscaled()));
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/gpl/src/nesterovBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,8 @@ class BinGrid
int binSizeX_ = 0;
int binSizeY_ = 0;
float targetDensity_ = 0;
int64_t overflowArea_ = 0;
int64_t overflowAreaUnscaled_ = 0;
int64_t sumOverflowArea_ = 0;
int64_t sumOverflowAreaUnscaled_ = 0;
bool isSetBinCnt_ = false;
int num_threads_ = 1;
};
Expand Down

0 comments on commit 6bd2ccb

Please sign in to comment.