Skip to content

Commit 2703a64

Browse files
fix valgrind issue (using uninitialized variable)
1 parent 5b94af7 commit 2703a64

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ double NetCostHandler::get_total_wirelength_estimate() const {
17251725
return estimated_wirelength;
17261726
}
17271727

1728-
double NetCostHandler::estimate_routing_chan_util() {
1728+
double NetCostHandler::estimate_routing_chan_util(bool compute_congestion_cost/* = true*/) {
17291729
const auto& cluster_ctx = g_vpr_ctx.clustering();
17301730
const DeviceContext& device_ctx = g_vpr_ctx.device();
17311731

@@ -1850,10 +1850,12 @@ double NetCostHandler::estimate_routing_chan_util() {
18501850

18511851
double cong_cost = 0.;
18521852
// Compute congestion cost using recomputed bounding boxes and channel utilization map
1853-
for (ClusterNetId net_id : cluster_ctx.clb_nlist.nets()) {
1854-
if (!cluster_ctx.clb_nlist.net_is_ignored(net_id)) {
1855-
net_cong_cost_[net_id] = get_net_cube_cong_cost_(net_id, /*use_ts=*/false);
1856-
cong_cost += net_cong_cost_[net_id];
1853+
if (compute_congestion_cost) {
1854+
for (ClusterNetId net_id : cluster_ctx.clb_nlist.nets()) {
1855+
if (!cluster_ctx.clb_nlist.net_is_ignored(net_id)) {
1856+
net_cong_cost_[net_id] = get_net_cube_cong_cost_(net_id, /*use_ts=*/false);
1857+
cong_cost += net_cong_cost_[net_id];
1858+
}
18571859
}
18581860
}
18591861

vpr/src/place/net_cost_handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class NetCostHandler {
143143
*
144144
* @return Total congestion cost.
145145
*/
146-
double estimate_routing_chan_util();
146+
double estimate_routing_chan_util(bool compute_congestion_cost = true);
147147

148148
std::pair<const vtr::NdMatrix<double, 3>&, const vtr::NdMatrix<double, 3>&> get_chanxy_util() const;
149149

vpr/src/route/route_utilization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ std::pair<vtr::NdMatrix<double, 3>, vtr::NdMatrix<double, 3>> RoutingChanUtilEst
2424
net_cost_handler_->comp_bb_cong_cost(e_cost_methods::NORMAL);
2525

2626
// Estimate routing channel utilization using
27-
net_cost_handler_->estimate_routing_chan_util();
27+
net_cost_handler_->estimate_routing_chan_util(/*compute_congestion_cost=*/false);
2828

2929
return net_cost_handler_->get_chanxy_util();
3030
} else {

0 commit comments

Comments
 (0)