Skip to content

Commit df2f086

Browse files
Remove unused per-layer sink pin counts from NetCostHandler
1 parent 2f6404e commit df2f086

2 files changed

Lines changed: 6 additions & 62 deletions

File tree

vpr/src/place/net_cost_handler.cpp

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ NetCostHandler::NetCostHandler(PlacerState& placer_state,
8787

8888
bb_num_on_edges_.resize(num_nets, t_bb());
8989

90-
// This initializes the whole matrix to UNDEFINED which is an invalid value
91-
ts_layer_sink_pin_count_.resize({num_nets, size_t(num_layers)}, UNDEFINED);
92-
num_sink_pin_layer_.resize({num_nets, size_t(num_layers)}, UNDEFINED);
93-
9490
ts_nets_to_update_.resize(num_nets, ClusterNetId::INVALID());
9591

9692
// negative net costs mean the cost is not valid.
@@ -221,7 +217,6 @@ void NetCostHandler::update_net_bb_(const ClusterNetId net,
221217
t_physical_tile_type_ptr blk_type = physical_tile_type(block_loc);
222218
int pin_width_offset = blk_type->pin_width_offset[iblk_pin];
223219
int pin_height_offset = blk_type->pin_height_offset[iblk_pin];
224-
bool is_driver = cluster_ctx.clb_nlist.pin_type(blk_pin) == PinType::DRIVER;
225220

226221
//Incremental bounding box update
227222
update_bb_(net,
@@ -230,8 +225,7 @@ void NetCostHandler::update_net_bb_(const ClusterNetId net,
230225
pl_moved_block.old_loc.layer},
231226
{pl_moved_block.new_loc.x + pin_width_offset,
232227
pl_moved_block.new_loc.y + pin_height_offset,
233-
pl_moved_block.new_loc.layer},
234-
is_driver);
228+
pl_moved_block.new_loc.layer});
235229
}
236230
}
237231

@@ -375,13 +369,10 @@ void NetCostHandler::update_net_info_on_pin_move_(const PlaceDelayModel* delay_m
375369
void NetCostHandler::get_non_updatable_bb_(ClusterNetId net_id, bool use_ts) {
376370
//TODO: account for multiple physical pin instances per logical pin
377371
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
378-
const DeviceContext& device_ctx = g_vpr_ctx.device();
379372
const BlkLocRegistry& blk_loc_registry = placer_state_.blk_loc_registry();
380373

381374
// the bounding box coordinates that is going to be updated by this function
382375
t_bb& bb_coord_new = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
383-
// the number of sink pins of "net_id" on each layer
384-
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)];
385376

386377
// get the source pin's location
387378
ClusterPinId source_pin_id = cluster_ctx.clb_nlist.net_pin(net_id, 0);
@@ -395,10 +386,6 @@ void NetCostHandler::get_non_updatable_bb_(ClusterNetId net_id, bool use_ts) {
395386
bb_coord_new.ymax = source_pin_loc.y;
396387
bb_coord_new.layer_max = source_pin_loc.layer_num;
397388

398-
for (size_t layer_num = 0; layer_num < device_ctx.grid.get_num_layers(); layer_num++) {
399-
num_sink_pin_layer[layer_num] = 0;
400-
}
401-
402389
for (ClusterPinId pin_id : cluster_ctx.clb_nlist.net_sinks(net_id)) {
403390
t_physical_tile_loc pin_loc = blk_loc_registry.get_coordinate_of_pin(pin_id);
404391

@@ -419,8 +406,6 @@ void NetCostHandler::get_non_updatable_bb_(ClusterNetId net_id, bool use_ts) {
419406
} else if (pin_loc.layer_num > bb_coord_new.layer_max) {
420407
bb_coord_new.layer_max = pin_loc.layer_num;
421408
}
422-
423-
num_sink_pin_layer[pin_loc.layer_num]++;
424409
}
425410

426411
// Update average CHANX and CHANY usage for this net within its bounding box if congestion modeling is enabled
@@ -434,28 +419,20 @@ void NetCostHandler::get_non_updatable_bb_(ClusterNetId net_id, bool use_ts) {
434419

435420
void NetCostHandler::update_bb_(ClusterNetId net_id,
436421
t_physical_tile_loc pin_old_loc,
437-
t_physical_tile_loc pin_new_loc,
438-
bool src_pin) {
422+
t_physical_tile_loc pin_new_loc) {
439423
//TODO: account for multiple physical pin instances per logical pin
440-
const DeviceContext& device_ctx = g_vpr_ctx.device();
441-
442-
const int num_layers = device_ctx.grid.get_num_layers();
443424

444425
// Number of blocks on the edges of the bounding box
445426
t_bb& bb_edge_new = ts_bb_edge_new_[net_id];
446427
// Coordinates of the bounding box
447428
t_bb& bb_coord_new = ts_bb_coord_new_[net_id];
448-
// Number of sinks of the given net on each layer
449-
vtr::NdMatrixProxy<int, 1> num_sink_pin_layer_new = ts_layer_sink_pin_count_[size_t(net_id)];
450429

451430
/* Check if the net had been updated before. */
452431
if (bb_update_status_[net_id] == NetUpdateState::GOT_FROM_SCRATCH) {
453432
/* The net had been updated from scratch, DO NOT update again! */
454433
return;
455434
}
456435

457-
vtr::NdMatrixProxy<int, 1> curr_num_sink_pin_layer = (bb_update_status_[net_id] == NetUpdateState::NOT_UPDATED_YET) ? num_sink_pin_layer_[size_t(net_id)] : num_sink_pin_layer_new;
458-
459436
const t_bb *curr_bb_edge, *curr_bb_coord;
460437
if (bb_update_status_[net_id] == NetUpdateState::NOT_UPDATED_YET) {
461438
/* The net had NOT been updated before, could use the old values */
@@ -616,18 +593,6 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
616593

617594
/* Now account for the layer motion. */
618595
if (is_multi_layer_) {
619-
/* We need to update it only if multiple layers are available */
620-
for (int layer_num = 0; layer_num < num_layers; layer_num++) {
621-
num_sink_pin_layer_new[layer_num] = curr_num_sink_pin_layer[layer_num];
622-
}
623-
if (!src_pin) {
624-
/* if src pin is being moved, we don't need to update this data structure */
625-
if (pin_old_loc.layer_num != pin_new_loc.layer_num) {
626-
num_sink_pin_layer_new[pin_old_loc.layer_num] = (curr_num_sink_pin_layer)[pin_old_loc.layer_num] - 1;
627-
num_sink_pin_layer_new[pin_new_loc.layer_num] = (curr_num_sink_pin_layer)[pin_new_loc.layer_num] + 1;
628-
}
629-
}
630-
631596
if (pin_new_loc.layer_num < pin_old_loc.layer_num) {
632597
if (pin_old_loc.layer_num == curr_bb_coord->layer_max) {
633598
if (curr_bb_edge->layer_max == 1) {
@@ -709,13 +674,10 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
709674

710675
void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id, bool use_ts) {
711676
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
712-
const DeviceContext& device_ctx = g_vpr_ctx.device();
713-
const DeviceGrid& grid = device_ctx.grid;
714677
const BlkLocRegistry& blk_loc_registry = placer_state_.blk_loc_registry();
715678

716679
t_bb& coords = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
717680
t_bb& num_on_edges = use_ts ? ts_bb_edge_new_[net_id] : bb_num_on_edges_[net_id];
718-
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];
719681

720682
// get the source pin's location
721683
ClusterPinId source_pin_id = cluster_ctx.clb_nlist.net_pin(net_id, 0);
@@ -735,10 +697,6 @@ void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id, bool use_ts) {
735697
int ymax_edge = 1;
736698
int layer_max_edge = 1;
737699

738-
for (size_t layer_num = 0; layer_num < grid.get_num_layers(); layer_num++) {
739-
num_sink_pin_layer[layer_num] = 0;
740-
}
741-
742700
for (ClusterPinId pin_id : cluster_ctx.clb_nlist.net_sinks(net_id)) {
743701
t_physical_tile_loc pin_loc = blk_loc_registry.get_coordinate_of_pin(pin_id);
744702

@@ -780,8 +738,6 @@ void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id, bool use_ts) {
780738
layer_max = pin_loc.layer_num;
781739
layer_max_edge = 1;
782740
}
783-
784-
num_sink_pin_layer[pin_loc.layer_num]++;
785741
}
786742

787743
// Copy the coordinates and number on edges information into the proper structures.
@@ -791,8 +747,8 @@ void NetCostHandler::get_bb_from_scratch_(ClusterNetId net_id, bool use_ts) {
791747
coords.ymax = ymax;
792748
coords.layer_min = layer_min;
793749
coords.layer_max = layer_max;
794-
VTR_ASSERT_DEBUG(layer_min >= 0 && layer_min < (int)device_ctx.grid.get_num_layers());
795-
VTR_ASSERT_DEBUG(layer_max >= 0 && layer_max < (int)device_ctx.grid.get_num_layers());
750+
VTR_ASSERT_DEBUG(layer_min >= 0 && layer_min < (int)g_vpr_ctx.device().grid.get_num_layers());
751+
VTR_ASSERT_DEBUG(layer_max >= 0 && layer_max < (int)g_vpr_ctx.device().grid.get_num_layers());
796752

797753
num_on_edges.xmin = xmin_edge;
798754
num_on_edges.xmax = xmax_edge;
@@ -993,10 +949,6 @@ void NetCostHandler::update_move_nets() {
993949

994950
set_ts_bb_coord_(net_id);
995951

996-
for (size_t layer_num = 0; layer_num < g_vpr_ctx.device().grid.get_num_layers(); layer_num++) {
997-
num_sink_pin_layer_[size_t(net_id)][layer_num] = ts_layer_sink_pin_count_[size_t(net_id)][layer_num];
998-
}
999-
1000952
if (cluster_ctx.clb_nlist.net_sinks(net_id).size() >= SMALL_NET) {
1001953
set_ts_edge_(net_id);
1002954
}

vpr/src/place/net_cost_handler.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ class NetCostHandler {
205205

206206
/* [0...cluster_ctx.clb_nlist.nets().size()-1] -> 3D bounding box*/
207207
vtr::vector<ClusterNetId, t_bb> ts_bb_coord_new_, ts_bb_edge_new_;
208-
/* [0...cluster_ctx.clb_nlist.nets().size()-1][0...num_layers-1] -> number of sink pins on a layer*/
209-
vtr::Matrix<int> ts_layer_sink_pin_count_;
210208
/* [0...num_affected_nets] -> net_id of the affected nets */
211209
std::vector<ClusterNetId> ts_nets_to_update_;
212210

@@ -222,10 +220,6 @@ class NetCostHandler {
222220

223221
vtr::vector<ClusterNetId, std::pair<float, float>> avg_chan_util_;
224222

225-
/// Store the number of blocks on each layer ()
226-
/// [0..cluster_ctx.clb_nlist.nets().size()-1]
227-
vtr::Matrix<int> num_sink_pin_layer_;
228-
229223
/**
230224
* @brief In each of these vectors, there is one entry per cluster level net:
231225
* [0...cluster_ctx.clb_nlist.nets().size()-1].
@@ -388,7 +382,7 @@ class NetCostHandler {
388382
void get_non_updatable_bb_(ClusterNetId net_id, bool use_ts);
389383

390384
/**
391-
* @brief Calculate the 3D BB of a large net from scratch and update coord, edge, and num_sink_pin_layer data structures.
385+
* @brief Calculate the 3D BB of a large net from scratch and update its coordinates and number of blocks on each edge.
392386
* @details This routine finds the bounding box of each net from scratch (i.e. from only the block location information).
393387
* It updates both the coordinate and number of pins on each edge information. It should only be called when the bounding box
394388
* information is not valid.
@@ -409,12 +403,10 @@ class NetCostHandler {
409403
* @param net_id ID of the net which the moving pin belongs to
410404
* @param pin_old_loc The old location of the moving pin
411405
* @param pin_new_loc The new location of the moving pin
412-
* @param src_pin Is the moving pin driving the net
413406
*/
414407
void update_bb_(ClusterNetId net_id,
415408
t_physical_tile_loc pin_old_loc,
416-
t_physical_tile_loc pin_new_loc,
417-
bool src_pin);
409+
t_physical_tile_loc pin_new_loc);
418410

419411
/**
420412
* @brief if "net" is not already stored as an affected net, add it in ts_nets_to_update.

0 commit comments

Comments
 (0)