From 9c89af83538c52250d8d0fa0ca8f832368cc7bd0 Mon Sep 17 00:00:00 2001 From: Augusto Berndt Date: Fri, 13 Dec 2024 16:53:21 +0000 Subject: [PATCH] gpl: add debu prints for overflow, show microns instead of dbu for bins in debug mode Signed-off-by: Augusto Berndt --- src/gpl/src/graphics.cpp | 3 ++- src/gpl/src/nesterovBase.cpp | 47 ++++++++++++++++++++++++++++-------- src/gpl/src/nesterovBase.h | 4 +-- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/gpl/src/graphics.cpp b/src/gpl/src/graphics.cpp index 331eb9fe853..d4985af66c1 100644 --- a/src/gpl/src/graphics.cpp +++ b/src/gpl/src/graphics.cpp @@ -454,7 +454,8 @@ bool Graphics::populateMap() 0.0f, static_cast(bin.instPlacedAreaUnscaled()) + static_cast(bin.nonPlaceAreaUnscaled()) - scaledBinArea); - addToMap(box, value); + odb::dbBlock* block = pbc_->db()->getChip()->getBlock(); + addToMap(box, block->dbuAreaToMicrons(value)); } } diff --git a/src/gpl/src/nesterovBase.cpp b/src/gpl/src/nesterovBase.cpp index 2e45876505b..cdb7404bd6e 100644 --- a/src/gpl/src/nesterovBase.cpp +++ b/src/gpl/src/nesterovBase.cpp @@ -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) @@ -876,12 +876,13 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector& 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 @@ -896,15 +897,41 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector& cells) + static_cast(bin.nonPlaceArea())) / scaledBinArea); - overflowArea_ += std::max(0.0f, - static_cast(bin.instPlacedArea()) - + static_cast(bin.nonPlaceArea()) - - scaledBinArea); + sumOverflowArea_ += std::max(0.0f, + static_cast(bin.instPlacedArea()) + + static_cast(bin.nonPlaceArea()) + - scaledBinArea); - overflowAreaUnscaled_ += std::max( + auto overflowAreaUnscaled = std::max( 0.0f, static_cast(bin.instPlacedAreaUnscaled()) + static_cast(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())); + } } } diff --git a/src/gpl/src/nesterovBase.h b/src/gpl/src/nesterovBase.h index abd8d24a189..08156ceaa52 100644 --- a/src/gpl/src/nesterovBase.h +++ b/src/gpl/src/nesterovBase.h @@ -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; };