Skip to content

Commit 649f3b6

Browse files
get_bb_from_scratch_() accepts use_ts as its argument
1 parent 4c8d908 commit 649f3b6

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,7 @@ std::pair<double, double> NetCostHandler::comp_cube_bb_cost_(e_cost_methods meth
260260
/* Small nets don't use incremental updating on their bounding boxes, *
261261
* so they can use a fast bounding box calculator. */
262262
if (cluster_ctx.clb_nlist.net_sinks(net_id).size() >= SMALL_NET && method == e_cost_methods::NORMAL) {
263-
get_bb_from_scratch_(net_id,
264-
bb_coords_[net_id],
265-
bb_num_on_edges_[net_id],
266-
num_sink_pin_layer_[size_t(net_id)]);
263+
get_bb_from_scratch_(net_id, /*use_ts=*/false);
267264
} else {
268265
get_non_updatable_cube_bb_(net_id, /*use_ts=*/false);
269266
}
@@ -580,7 +577,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
580577
//TODO: account for multiple physical pin instances per logical pin
581578
const t_bb *curr_bb_edge, *curr_bb_coord;
582579

583-
auto& device_ctx = g_vpr_ctx.device();
580+
const auto& device_ctx = g_vpr_ctx.device();
584581

585582
const int num_layers = device_ctx.grid.get_num_layers();
586583

@@ -618,7 +615,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
618615

619616
if (pin_old_loc.x == curr_bb_coord->xmax) { /* Old position at xmax. */
620617
if (curr_bb_edge->xmax == 1) {
621-
get_bb_from_scratch_(net_id, bb_coord_new, bb_edge_new, num_sink_pin_layer_new);
618+
get_bb_from_scratch_(net_id, /*use_ts=*/true);
622619
bb_update_status_[net_id] = NetUpdateState::GOT_FROM_SCRATCH;
623620
return;
624621
} else {
@@ -650,7 +647,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
650647

651648
if (pin_old_loc.x == curr_bb_coord->xmin) { /* Old position at xmin. */
652649
if (curr_bb_edge->xmin == 1) {
653-
get_bb_from_scratch_(net_id, bb_coord_new, bb_edge_new, num_sink_pin_layer_new);
650+
get_bb_from_scratch_(net_id, /*use_ts=*/true);
654651
bb_update_status_[net_id] = NetUpdateState::GOT_FROM_SCRATCH;
655652
return;
656653
} else {
@@ -691,7 +688,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
691688

692689
if (pin_old_loc.y == curr_bb_coord->ymax) { /* Old position at ymax. */
693690
if (curr_bb_edge->ymax == 1) {
694-
get_bb_from_scratch_(net_id, bb_coord_new, bb_edge_new, num_sink_pin_layer_new);
691+
get_bb_from_scratch_(net_id, /*use_ts=*/true);
695692
bb_update_status_[net_id] = NetUpdateState::GOT_FROM_SCRATCH;
696693
return;
697694
} else {
@@ -723,7 +720,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
723720

724721
if (pin_old_loc.y == curr_bb_coord->ymin) { /* Old position at ymin. */
725722
if (curr_bb_edge->ymin == 1) {
726-
get_bb_from_scratch_(net_id, bb_coord_new, bb_edge_new, num_sink_pin_layer_new);
723+
get_bb_from_scratch_(net_id, /*use_ts=*/true);
727724
bb_update_status_[net_id] = NetUpdateState::GOT_FROM_SCRATCH;
728725
return;
729726
} else {
@@ -773,7 +770,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
773770
if (pin_new_loc.layer_num < pin_old_loc.layer_num) {
774771
if (pin_old_loc.layer_num == curr_bb_coord->layer_max) {
775772
if (curr_bb_edge->layer_max == 1) {
776-
get_bb_from_scratch_(net_id, bb_coord_new, bb_edge_new, num_sink_pin_layer_new);
773+
get_bb_from_scratch_(net_id, /*use_ts=*/true);
777774
bb_update_status_[net_id] = NetUpdateState::GOT_FROM_SCRATCH;
778775
return;
779776
} else {
@@ -799,7 +796,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
799796
} else if (pin_new_loc.layer_num > pin_old_loc.layer_num) {
800797
if (pin_old_loc.layer_num == curr_bb_coord->layer_min) {
801798
if (curr_bb_edge->layer_min == 1) {
802-
get_bb_from_scratch_(net_id, bb_coord_new, bb_edge_new, num_sink_pin_layer_new);
799+
get_bb_from_scratch_(net_id, /*use_ts=*/true);
803800
bb_update_status_[net_id] = NetUpdateState::GOT_FROM_SCRATCH;
804801
return;
805802
} else {
@@ -1180,15 +1177,16 @@ static void add_block_to_bb(const t_physical_tile_loc& new_pin_loc,
11801177
}
11811178
}
11821179

1183-
void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id,
1184-
t_bb& coords,
1185-
t_bb& num_on_edges,
1186-
vtr::NdMatrixProxy<int, 1> num_sink_pin_layer) {
1180+
void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id, bool use_ts) {
11871181
const auto& cluster_ctx = g_vpr_ctx.clustering();
11881182
const auto& device_ctx = g_vpr_ctx.device();
11891183
const auto& grid = device_ctx.grid;
11901184
const auto& blk_loc_registry = placer_state_.blk_loc_registry();
11911185

1186+
t_bb& coords = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
1187+
t_bb& num_on_edges = use_ts ? ts_bb_edge_new_[net_id] : bb_num_on_edges_[net_id];
1188+
vtr::NdMatrixProxy<int, 1> num_sink_pin_layer = use_ts ? ts_layer_sink_pin_count_[(size_t)net_id] : num_sink_pin_layer_[(size_t)net_id];
1189+
11921190
// get the source pin's location
11931191
ClusterPinId source_pin_id = cluster_ctx.clb_nlist.net_pin(net_id, 0);
11941192
t_physical_tile_loc source_pin_loc = blk_loc_registry.get_coordinate_of_pin(source_pin_id);

vpr/src/place/net_cost_handler.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,9 @@ class NetCostHandler {
342342
* It updates both the coordinate and number of pins on each edge information. It should only be called when the bounding box
343343
* information is not valid.
344344
* @param net_id ID of the net which the moving pin belongs to
345-
* @param coords Bounding box coordinates of the net. It is calculated in this function
346-
* @param num_on_edges Net's number of blocks on the edges of the bounding box. It is calculated in this function.
347-
* @param num_sink_pin_layer Net's number of sinks on each layer, calculated in this function.
345+
* @param use_ts Specifies whether the `ts` bounding box is updated or the actual one.
348346
*/
349-
void get_bb_from_scratch_(ClusterNetId net_id,
350-
t_bb& coords,
351-
t_bb& num_on_edges,
352-
vtr::NdMatrixProxy<int, 1> num_sink_pin_layer);
347+
void get_bb_from_scratch_(ClusterNetId net_id, bool use_ts);
353348

354349
/**
355350
* @brief Calculate the per-layer BB of a large net from scratch and update coord, edge, and num_sink_pin_layer data structures.

0 commit comments

Comments
 (0)