Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a1aadb0
drt: incremental PA trial
osamahammad21 Jul 24, 2025
066fa1b
drt: fix incremental pin access
osamahammad21 Jul 30, 2025
17c073c
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Jul 30, 2025
8e61400
grt: update pin access at each incremental groute update
eder-matheus Jul 30, 2025
adc87a7
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Aug 19, 2025
1e48b11
merge changes needed
osamahammad21 Aug 19, 2025
b8326c7
drt: update db access points when needed only
osamahammad21 Aug 19, 2025
4dcd0b6
drt: fix updates
osamahammad21 Aug 20, 2025
208c3ed
drt: fix wrong parallelization for unique inst init
osamahammad21 Aug 21, 2025
c94efe1
drt: fixes
osamahammad21 Aug 21, 2025
3f97889
drt: fix missing setPinAccessIdx
osamahammad21 Aug 21, 2025
8fd38ab
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Sep 8, 2025
a749b35
in progress
osamahammad21 Sep 8, 2025
0127d98
fixes
osamahammad21 Sep 8, 2025
11670e1
drt: bug fixes
osamahammad21 Sep 10, 2025
9d33904
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Sep 10, 2025
4c03005
drt: remove unneeded test case
osamahammad21 Sep 10, 2025
c8fc014
drt: cleanup
osamahammad21 Sep 10, 2025
38f8699
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Sep 11, 2025
6f3e96b
drt: testing error guides again
osamahammad21 Sep 11, 2025
dee4e27
drt: handle missing instances in the insts_set_
osamahammad21 Sep 11, 2025
b37e271
drt: fixes
osamahammad21 Oct 9, 2025
57c5d25
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Oct 12, 2025
a7fd2c1
drt: fixes to incremental pa
osamahammad21 Oct 13, 2025
f443865
drt: fix dbBlock::getGCellIndices
osamahammad21 Oct 14, 2025
7427cbe
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Oct 19, 2025
f7bfa6c
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Oct 23, 2025
e95052c
Merge branch 'master' of https://github.com/The-OpenROAD-Project/Open…
eder-matheus Nov 5, 2025
bc0d3cf
Merge branch 'master' into drt-incremental-pa
eder-matheus Nov 11, 2025
9279035
grt: fix check for node connection with edge
eder-matheus Nov 11, 2025
d6083e8
grt: update ok files
eder-matheus Nov 11, 2025
33a0582
drt: update guide files for ndr_vias tests
eder-matheus Nov 11, 2025
0030275
Revert "grt: update ok files"
eder-matheus Nov 12, 2025
3730404
Revert "grt: fix check for node connection with edge"
eder-matheus Nov 12, 2025
7e9f000
grt: ensure pin coverage by adding extra vias for nodes not covered
eder-matheus Nov 12, 2025
1c3f6b5
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
eder-matheus Nov 12, 2025
26fc54d
grt: run ensurePinCoverage after fastroute flow is complete
eder-matheus Nov 13, 2025
efb7aa8
Merge branch 'drt-data-race' into drt-incremental-pa
osamahammad21 Nov 13, 2025
f20733e
drt: fix non-determinstic bug
osamahammad21 Nov 13, 2025
1954f9b
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Nov 16, 2025
5b739f1
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Nov 16, 2025
db27130
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Nov 20, 2025
3148978
Merge branch 'master' into drt-incremental-pa
eder-matheus Nov 27, 2025
ef7b34b
Merge branch 'master' of https://github.com/The-OpenROAD-Project/Open…
eder-matheus Nov 28, 2025
1fb1617
drt/grt: clang tidy and format
eder-matheus Nov 28, 2025
8f5c6fb
test: update metrics limits
eder-matheus Nov 28, 2025
1eb991d
drt: clang-tidy
eder-matheus Nov 28, 2025
4b3709e
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
osamahammad21 Nov 30, 2025
dd122d3
drt: remove testing error to allow ispd ci
osamahammad21 Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/drt/include/drt/TritonRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ class TritonRoute
void prep();
odb::dbDatabase* getDb() const { return db_; }
void fixMaxSpacing(int num_threads);
void deleteInstancePAData(frInst* inst);
void deleteInstancePAData(frInst* inst, bool delete_inst = false);
void addInstancePAData(frInst* inst);
void updateDirtyPAData();

private:
std::unique_ptr<frDesign> design_;
Expand Down
107 changes: 105 additions & 2 deletions src/drt/src/DesignCallBack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,31 @@

#include "drt/TritonRoute.h"
#include "frDesign.h"
#include "io/io.h"
#include "odb/db.h"

namespace drt {

void DesignCallBack::inDbInstCreate(odb::dbInst* db_inst)
{
auto design = router_->getDesign();
if (design == nullptr || design->getTopBlock() == nullptr) {
return;
}
io::Parser parser(router_->getDb(),
design,
router_->getLogger(),
router_->getRouterConfiguration());

parser.setInst(db_inst);
}

void DesignCallBack::inDbInstCreate(odb::dbInst* db_inst,
odb::dbRegion* db_region)
{
inDbInstCreate(db_inst);
}

void DesignCallBack::inDbPreMoveInst(odb::dbInst* db_inst)
{
auto design = router_->getDesign();
Expand All @@ -19,10 +40,10 @@ void DesignCallBack::inDbPreMoveInst(odb::dbInst* db_inst)
if (inst == nullptr) {
return;
}
router_->deleteInstancePAData(inst);
if (design->getRegionQuery() != nullptr) {
design->getRegionQuery()->removeBlockObj(inst);
}
router_->deleteInstancePAData(inst, false);
}

void DesignCallBack::inDbPostMoveInst(odb::dbInst* db_inst)
Expand Down Expand Up @@ -55,11 +76,93 @@ void DesignCallBack::inDbInstDestroy(odb::dbInst* db_inst)
if (inst == nullptr) {
return;
}
router_->deleteInstancePAData(inst);
if (design->getRegionQuery() != nullptr) {
design->getRegionQuery()->removeBlockObj(inst);
}
design->getTopBlock()->removeInst(inst);
router_->deleteInstancePAData(inst, true);
}

void DesignCallBack::inDbInstSwapMasterBefore(odb::dbInst* db_inst,
odb::dbMaster* db_master)
{
inDbInstDestroy(db_inst);
}

void DesignCallBack::inDbInstSwapMasterAfter(odb::dbInst* db_inst)
{
inDbInstCreate(db_inst);
inDbPostMoveInst(db_inst);
for (auto inst_term : db_inst->getITerms()) {
if (inst_term->getNet()) {
inDbITermPostConnect(inst_term);
}
}
}
void DesignCallBack::inDbNetCreate(odb::dbNet* db_net)
{
auto design = router_->getDesign();
if (design == nullptr || design->getTopBlock() == nullptr) {
return;
}
io::Parser parser(router_->getDb(),
design,
router_->getLogger(),
router_->getRouterConfiguration());
parser.addNet(db_net);
}

void DesignCallBack::inDbNetDestroy(odb::dbNet* db_net)
{
auto design = router_->getDesign();
if (design == nullptr || design->getTopBlock() == nullptr) {
return;
}
auto net = design->getTopBlock()->findNet(db_net->getName());
if (net == nullptr) {
return;
}
design->getTopBlock()->removeNet(net);
}

void DesignCallBack::inDbITermPostDisconnect(odb::dbITerm* db_iterm,
odb::dbNet* db_net)
{
auto design = router_->getDesign();
if (design == nullptr || design->getTopBlock() == nullptr) {
return;
}
auto inst = design->getTopBlock()->findInst(db_iterm->getInst());
auto net = design->getTopBlock()->findNet(db_net->getName());
if (inst == nullptr || net == nullptr) {
return;
}
auto inst_term = inst->getInstTerm(db_iterm->getMTerm()->getIndex());
if (inst_term == nullptr) {
return;
}
net->removeInstTerm(inst_term);
inst_term->addToNet(nullptr);
}

void DesignCallBack::inDbITermPostConnect(odb::dbITerm* db_iterm)
{
auto design = router_->getDesign();
if (design == nullptr || design->getTopBlock() == nullptr) {
return;
}
auto inst = design->getTopBlock()->findInst(db_iterm->getInst());
auto net = design->getTopBlock()->findNet(db_iterm->getNet()->getName());
if (inst == nullptr || net == nullptr) {
return;
}
auto inst_term = inst->getInstTerm(db_iterm->getMTerm()->getIndex());
if (inst_term == nullptr) {
return;
}
inst_term->addToNet(net);
net->addInstTerm(inst_term);
router_->addInstancePAData(inst);
}

} // namespace drt
8 changes: 8 additions & 0 deletions src/drt/src/DesignCallBack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ class DesignCallBack : public odb::dbBlockCallBackObj
{
public:
DesignCallBack(TritonRoute* router) : router_(router) {}
void inDbInstCreate(odb::dbInst*) override;
void inDbInstCreate(odb::dbInst*, odb::dbRegion*) override;
void inDbPreMoveInst(odb::dbInst* inst) override;
void inDbPostMoveInst(odb::dbInst* inst) override;
void inDbInstDestroy(odb::dbInst* inst) override;
void inDbInstSwapMasterBefore(odb::dbInst*, odb::dbMaster*) override;
void inDbInstSwapMasterAfter(odb::dbInst*) override;
void inDbNetCreate(odb::dbNet* net) override;
void inDbNetDestroy(odb::dbNet* net) override;
void inDbITermPostDisconnect(odb::dbITerm* iterm, odb::dbNet* net) override;
void inDbITermPostConnect(odb::dbITerm* iterm) override;

private:
TritonRoute* router_;
Expand Down
8 changes: 6 additions & 2 deletions src/drt/src/PACallBack.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#pragma once

#include "drt/TritonRoute.h"
#include "frDesign.h"
#include "utl/CallBack.h"
#include "utl/Logger.h"

namespace drt {

class frDesign;
Expand All @@ -21,7 +21,11 @@ class PACallBack : public utl::CallBack

void onPinAccessUpdateRequired() override
{
// TODO: Implement
auto design = router_->getDesign();
if (design == nullptr || design->getTopBlock() == nullptr) {
return;
}
router_->updateDirtyPAData();
}

private:
Expand Down
19 changes: 16 additions & 3 deletions src/drt/src/TritonRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,17 +1106,30 @@ void TritonRoute::pinAccess(const std::vector<odb::dbInst*>& target_insts)
writer.updateDb(db_, router_cfg_.get(), true);
}

void TritonRoute::deleteInstancePAData(frInst* inst)
void TritonRoute::deleteInstancePAData(frInst* inst, bool delete_inst)
{
if (pa_) {
pa_->deleteInst(inst);
pa_->removeFromInstsSet(inst);
if (delete_inst) {
pa_->deleteInst(inst);
}
}
}

void TritonRoute::addInstancePAData(frInst* inst)
{
if (pa_) {
pa_->addInst(inst);
pa_->addDirtyInst(inst);
}
}

void TritonRoute::updateDirtyPAData()
{
if (pa_) {
design_->getTopBlock()->removeDeletedObjects();
pa_->updateDirtyInsts();
io::Writer writer(getDesign(), logger_);
writer.updateDb(getDb(), getRouterConfiguration(), true);
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/drt/src/db/obj/frAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#include "db/obj/frShape.h"
#include "frBaseTypes.h"
#include "odb/geom.h"
namespace odb {
class dbAccessPoint;
}

namespace drt {
class frViaDef;
Expand Down Expand Up @@ -191,6 +194,8 @@ class frAccessPoint : public frBlockObject

void addPathSeg(const frPathSeg& ps) { pathSegs_.emplace_back(ps); }
std::vector<frPathSeg>& getPathSegs() { return pathSegs_; }
void setDbAccessPoint(odb::dbAccessPoint* in) { db_ap_ = in; }
odb::dbAccessPoint* getDbAccessPoint() const { return db_ap_; }

private:
odb::Point point_;
Expand All @@ -204,6 +209,7 @@ class frAccessPoint : public frBlockObject
frPinAccess* aps_{nullptr};
std::vector<frPathSeg> pathSegs_;
bool allow_via_{false};
odb::dbAccessPoint* db_ap_{nullptr};
template <class Archive>
void serialize(Archive& ar, unsigned int version);
friend class boost::serialization::access;
Expand Down Expand Up @@ -240,6 +246,7 @@ class frPinAccess : public frBlockObject
void setPin(frPin* in) { pin_ = in; }
// others
frBlockObjectEnum typeId() const override { return frcPinAccess; }
void clearAccessPoints() { aps_.clear(); }

private:
std::vector<std::unique_ptr<frAccessPoint>> aps_;
Expand Down
3 changes: 3 additions & 0 deletions src/drt/src/db/obj/frBTerm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class frBTerm : public frTerm
bool hasNet() const override { return (net_); }
frNet* getNet() const override { return net_; }
const std::vector<std::unique_ptr<frBPin>>& getPins() const { return pins_; }
bool hasPinAccessUpdate() const { return has_pin_access_update_; }
void setHasPinAccessUpdate(bool in) { has_pin_access_update_ = in; }
// setters
void addToNet(frNet* in) { net_ = in; }
void addPin(std::unique_ptr<frBPin> in)
Expand Down Expand Up @@ -89,6 +91,7 @@ class frBTerm : public frTerm
std::vector<std::unique_ptr<frBPin>> pins_; // set later
frNet* net_{nullptr};
bool isAboveTopLayer_{false};
bool has_pin_access_update_{true};
};

} // namespace drt
59 changes: 58 additions & 1 deletion src/drt/src/db/obj/frBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <algorithm>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -270,6 +271,39 @@ class frBlock : public frBlockObject
}
return odb::Point(idxX, idxY);
}

std::vector<odb::Point> getGCellIndices(const odb::Point& pt) const
{
const auto& gp = getGCellPatterns();
const auto& xgp = gp[0];
const auto& ygp = gp[1];
frCoord coord_x = pt.x() - xgp.getStartCoord();
frCoord coord_y = pt.y() - ygp.getStartCoord();
const frCoord max_coord_x = xgp.getSpacing() * (frCoord) xgp.getCount();
const frCoord max_coord_y = ygp.getSpacing() * (frCoord) ygp.getCount();
coord_x = std::clamp(coord_x, 0, max_coord_x - 1);
coord_y = std::clamp(coord_y, 0, max_coord_y - 1);

const frCoord base_idxX = coord_x / (frCoord) xgp.getSpacing();
const frCoord base_idxY = coord_y / (frCoord) ygp.getSpacing();
std::set<frCoord> x_indices{base_idxX};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "std::set" is directly included [misc-include-cleaner]

src/drt/src/db/obj/frBlock.h:8:

- #include <string>
+ #include <set>
+ #include <string>

std::set<frCoord> y_indices{base_idxY};
// TODO: handle case where gcell size is 1 unit
if (coord_x % xgp.getSpacing() == 0 && base_idxX != 0) {
x_indices.insert(base_idxX - 1);
}
if (coord_y % ygp.getSpacing() == 0 && base_idxY != 0) {
y_indices.insert(base_idxY - 1);
}
std::vector<odb::Point> sol;
for (auto& x : x_indices) {
for (auto& y : y_indices) {
sol.emplace_back(x, y);
}
}
return sol;
}

bool isValidGCellIdx(const odb::Point& pt) const
{
const auto& gp = getGCellPatterns();
Expand Down Expand Up @@ -319,18 +353,41 @@ class frBlock : public frBlockObject
name2inst_.erase(inst->getName());
inst->setToBeDeleted(true);
}
void removeDeletedInsts()

void removeNet(frNet* net)
{
name2net_.erase(net->getName());
for (auto term : net->getInstTerms()) {
term->addToNet(nullptr);
}
for (auto term : net->getBTerms()) {
term->addToNet(nullptr);
}
net->setToBeDeleted(true);
}

void removeDeletedObjects()
{
insts_.erase(std::remove_if(insts_.begin(),
insts_.end(),
[](const std::unique_ptr<frInst>& inst) {
return inst->isToBeDeleted();
}),
insts_.end());
nets_.erase(std::remove_if(nets_.begin(),
nets_.end(),
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use a ranges version of this algorithm [modernize-use-ranges]

Suggested change
nets_.end(),
nets_.erase(std::ranges::remove_if(nets_,
,

[](const std::unique_ptr<frNet>& net) {
return net->toBeDeleted();
}),
nets_.end());
int id = 0;
for (const auto& inst : insts_) {
inst->setId(id++);
}
id = 0;
for (const auto& net : nets_) {
net->setId(id++);
}
}
void addNet(std::unique_ptr<frNet> in)
{
Expand Down
6 changes: 6 additions & 0 deletions src/drt/src/db/obj/frInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ class frInst : public frRef
odb::Rect getBoundaryBBox() const;

frInstTerm* getInstTerm(int index);
bool hasPinAccessUpdate() const { return has_pin_access_update_; }
void setHasPinAccessUpdate(bool in) { has_pin_access_update_ = in; }
odb::dbTransform getLatestPATransform() const { return latest_pa_xform_; }
void setLatestPATransform() { latest_pa_xform_ = xform_; }

private:
frString name_;
Expand All @@ -137,8 +141,10 @@ class frInst : public frRef
std::vector<std::unique_ptr<frInstBlockage>> instBlockages_;
odb::dbInst* db_inst_;
odb::dbTransform xform_;
odb::dbTransform latest_pa_xform_;
int pinAccessIdx_{-1};
bool toBeDeleted_{false};
bool has_pin_access_update_{true};
};

} // namespace drt
Loading
Loading