Skip to content

Commit a41a256

Browse files
recompute congestion cost when estimating channel utilization
1 parent 8b395aa commit a41a256

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

vpr/src/place/annealer.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,12 @@ void PlacementAnnealer::outer_loop_update_timing_info() {
671671
outer_crit_iter_count_++;
672672
}
673673

674+
if (congestion_modeling_started_
675+
|| (placer_stats_.success_rate < placer_opts_.congestion_acceptance_rate_trigger && placer_stats_.av_cost != 0.)) {
676+
costs_.congestion_cost = net_cost_handler_.estimate_routing_chann_util();
677+
congestion_modeling_started_ = true;
678+
}
679+
674680
// Update the cost normalization factors
675681
costs_.update_norm_factors();
676682

vpr/src/place/net_cost_handler.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ std::tuple<double, double, double> NetCostHandler::comp_cube_bb_cong_cost_(e_cos
300300
}
301301

302302
// Now that all bounding boxes are computed from scratch, we recompute the channel utilization
303-
estimate_routing_chann_util();
303+
// estimate_routing_chann_util();
304304

305305
// Compute congestion cost using recomputed bounding boxes and channel utilization map
306306
for (ClusterNetId net_id : cluster_ctx.clb_nlist.nets()) {
@@ -1564,8 +1564,8 @@ std::pair<double, double> NetCostHandler::recompute_bb_cong_cost_() {
15641564
}
15651565

15661566
static double wirelength_crossing_count(size_t fanout) {
1567-
/* Get the expected "crossing count" of a net, based on its number *
1568-
* of pins. Extrapolate for very large nets. */
1567+
/* Get the expected "crossing count" of a net, based on its number
1568+
* of pins. Extrapolate for very large nets. */
15691569

15701570
if (fanout > MAX_FANOUT_CROSSING_COUNT) {
15711571
return 2.7933 + 0.02616 * (fanout - MAX_FANOUT_CROSSING_COUNT);
@@ -1710,7 +1710,7 @@ double NetCostHandler::get_total_wirelength_estimate() const {
17101710
return estimated_wirelength;
17111711
}
17121712

1713-
void NetCostHandler::estimate_routing_chann_util() {
1713+
double NetCostHandler::estimate_routing_chann_util() {
17141714
const auto& cluster_ctx = g_vpr_ctx.clustering();
17151715
const auto& device_ctx = g_vpr_ctx.device();
17161716

@@ -1757,6 +1757,17 @@ void NetCostHandler::estimate_routing_chann_util() {
17571757

17581758
acc_chanx_util_ = vtr::PrefixSum2D<double>(chanx_util_);
17591759
acc_chany_util_ = vtr::PrefixSum2D<double>(chany_util_);
1760+
1761+
double cong_cost = 0.;
1762+
// Compute congestion cost using recomputed bounding boxes and channel utilization map
1763+
for (ClusterNetId net_id : cluster_ctx.clb_nlist.nets()) {
1764+
if (!cluster_ctx.clb_nlist.net_is_ignored(net_id)) {
1765+
net_cong_cost_[net_id] = get_net_cube_cong_cost_(net_id, /*use_ts=*/false);
1766+
cong_cost += net_cong_cost_[net_id];
1767+
}
1768+
}
1769+
1770+
return cong_cost;
17601771
}
17611772

17621773
void NetCostHandler::set_ts_bb_coord_(const ClusterNetId net_id) {

vpr/src/place/net_cost_handler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class NetCostHandler {
127127
*/
128128
double get_total_wirelength_estimate() const;
129129

130-
void estimate_routing_chann_util();
130+
double estimate_routing_chann_util();
131131

132132
private:
133133
///@brief Specifies whether the bounding box is computed using cube method or per-layer method.

0 commit comments

Comments
 (0)