Skip to content

Commit d43da9c

Browse files
eder-matheusclaude
andcommitted
grt,psm: fix stale heatmap pointers on database reload
Override setChip in RoutingCongestionDataSource to reset the cached layer pointer. Override setChip in RUDYDataSource to reset the cached rudy pointer, unregister from the old block, and re-register on the new block. Add GlobalRouter::clearRudy() to delete the cached Rudy so it is recreated for the new block. Reset layer_, net_, and corner_ in IRDropDataSource::setChip to prevent dangling pointer access. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent 8ec475a commit d43da9c

6 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/grt/include/grt/GlobalRouter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ class GlobalRouter
332332
odb::dbDatabase* db() const { return db_; }
333333
FastRouteCore* fastroute() const { return fastroute_; }
334334
Rudy* getRudy();
335+
void clearRudy();
335336

336337
void writePinLocations(const char* file_name);
337338

src/grt/src/GlobalRouter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,12 @@ Rudy* GlobalRouter::getRudy()
11381138
return rudy_;
11391139
}
11401140

1141+
void GlobalRouter::clearRudy()
1142+
{
1143+
delete rudy_;
1144+
rudy_ = nullptr;
1145+
}
1146+
11411147
bool GlobalRouter::findPinAccessPointPositions(
11421148
const Pin& pin,
11431149
std::map<int, std::vector<PointPair>>& ap_positions,

src/grt/src/heatMap.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ class RoutingCongestionDataSource : public gui::GlobalRoutingDataSource
1515
public:
1616
RoutingCongestionDataSource(utl::Logger* logger, odb::dbDatabase* db);
1717

18+
void setChip(odb::dbChip* chip) override
19+
{
20+
layer_ = nullptr;
21+
HeatMapDataSource::setChip(chip);
22+
}
23+
1824
protected:
1925
bool populateMap() override;
2026
void combineMapData(bool base_has_value,

src/grt/src/heatMapRudy.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ bool RUDYDataSource::populateMap()
156156
return true;
157157
}
158158

159+
void RUDYDataSource::setChip(odb::dbChip* chip)
160+
{
161+
grouter_->clearRudy();
162+
rudy_ = nullptr;
163+
removeOwner();
164+
HeatMapDataSource::setChip(chip);
165+
if (chip && chip->getBlock()) {
166+
addOwner(chip->getBlock());
167+
}
168+
}
169+
159170
void RUDYDataSource::onShow()
160171
{
161172
HeatMapDataSource::onShow();

src/grt/src/heatMapRudy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class RUDYDataSource : public gui::GlobalRoutingDataSource,
2323
grt::GlobalRouter* grouter,
2424
odb::dbDatabase* db);
2525

26+
void setChip(odb::dbChip* chip) override;
2627
void onShow() override;
2728
void onHide() override;
2829

src/psm/src/heatMap.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ IRDropDataSource::IRDropDataSource(PDNSim* psm,
9696

9797
void IRDropDataSource::setChip(odb::dbChip* chip)
9898
{
99+
layer_ = nullptr;
100+
net_ = nullptr;
101+
corner_ = nullptr;
99102
gui::HeatMapDataSource::setChip(chip);
100103
if (chip != nullptr) {
101104
odb::dbBlock* block = chip->getBlock();

0 commit comments

Comments
 (0)