Skip to content

Commit

Permalink
Add new type of callback to avoid early routing-driven calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloquinte committed Jan 30, 2024
1 parent 07d8cc6 commit 2d09a24
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions pycoloquinte/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ PYBIND11_MODULE(coloquinte_pybind, m) {
.value("LowerBound", PlacementStep::LowerBound)
.value("UpperBound", PlacementStep::UpperBound)
.value("Detailed", PlacementStep::Detailed)
.value("PenaltyUpdate", PlacementStep::PenaltyUpdate)
.export_values();

py::class_<ColoquinteParameters>(m, "ColoquinteParameters")
Expand Down
9 changes: 8 additions & 1 deletion src/coloquinte.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct Rectangle {
/**
* @brief Step of the placement process, for use in callbacks
*/
enum class PlacementStep { LowerBound, UpperBound, Detailed };
enum class PlacementStep { LowerBound, UpperBound, Detailed, PenaltyUpdate };

/**
* @brief Cost model to use when doing legalization
Expand Down Expand Up @@ -435,6 +435,13 @@ struct GlobalPlacerParameters {
*/
double distanceTolerance;

/**
* @brief Distance between lower and upper bound placement at which we start
* doing rounting and timing driven placement by calling PenaltyUpdate
* callbacks
*/
double penaltyUpdateDistance;

/**
* @brief Blending between lower-bound and upper-bound placement at export
* time; 0 to use lower bound, 1 to use upper bound
Expand Down
1 change: 1 addition & 0 deletions src/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ GlobalPlacerParameters::GlobalPlacerParameters(int effort)
nbInitialSteps = 0;
nbStepsBeforeRoughLegalization = 1;
distanceTolerance = 2.0;
penaltyUpdateDistance = 10.0;
// TODO: find best parameter
exportBlending = 0.99;
noise = 1.0e-4;
Expand Down
3 changes: 3 additions & 0 deletions src/place_global/place_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ void GlobalPlacer::run() {
std::cout << std::endl;
break;
}
if (dist < penaltyUpdateDistance()) {
callback(PlacementStep::PenaltyUpdate, xPlacementUB_, yPlacementUB_);
}
for (int i = 0; i < params_.global.nbStepsBeforeRoughLegalization; ++i) {
if (i != 0) {
std::cout << "#" << step_ << ":\t........\t........";
Expand Down
10 changes: 9 additions & 1 deletion src/place_global/place_global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ class GlobalPlacer {
return params_.global.distanceTolerance * averageCellLength_;
}

/**
* @brief Distance between upper and lower bound at which we start routing
* and timing driven placement
*/
float penaltyUpdateDistance() const {
return params_.global.penaltyUpdateDistance * averageCellLength_;
}

/**
* @brief Compute the penalty forces for this iteration
*/
Expand Down Expand Up @@ -148,4 +156,4 @@ class GlobalPlacer {
std::optional<PlacementCallback> callback_;
};

} // namespace coloquinte
} // namespace coloquinte

0 comments on commit 2d09a24

Please sign in to comment.