Skip to content

Commit dc9c018

Browse files
remove args of type t_place_algorithm and t_placer_opts
1 parent 3f70ff2 commit dc9c018

File tree

3 files changed

+49
-61
lines changed

3 files changed

+49
-61
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ static const float cross_count[MAX_FANOUT_CROSSING_COUNT] = {/* [0..49] */ 1.0,
5656
2.7933};
5757

5858
/**
59-
* @param net
60-
* @param moved_blocks
61-
* @return True if the driver block of the net is among the moving blocks
59+
* @param net The unique identifier of the net of interest.
60+
* @param moved_blocks A vector of moving clustered blocks.
61+
* @return True if the driver block of the net is among the moving blocks.
6262
*/
6363
static bool driven_by_moved_block(const ClusterNetId net,
6464
const std::vector<t_pl_moved_block>& moved_blocks);
@@ -339,23 +339,6 @@ double NetCostHandler::comp_per_layer_bb_cost_(e_cost_methods method) {
339339
return cost;
340340
}
341341

342-
//Returns true if 'net' is driven by one of the blocks in 'blocks_affected'
343-
static bool driven_by_moved_block(const ClusterNetId net,
344-
const std::vector<t_pl_moved_block>& moved_blocks) {
345-
auto& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
346-
bool is_driven_by_move_blk = false;
347-
ClusterBlockId net_driver_block = clb_nlist.net_driver_block(net);
348-
349-
for (const auto& block : moved_blocks) {
350-
if (net_driver_block == block.block_num) {
351-
is_driven_by_move_blk = true;
352-
break;
353-
}
354-
}
355-
356-
return is_driven_by_move_blk;
357-
}
358-
359342
void NetCostHandler::update_net_bb_(const ClusterNetId net,
360343
const ClusterBlockId blk,
361344
const ClusterPinId blk_pin,
@@ -493,16 +476,15 @@ void NetCostHandler::record_affected_net_(const ClusterNetId net) {
493476
}
494477
}
495478

496-
void NetCostHandler::update_net_info_on_pin_move_(const t_place_algorithm& place_algorithm,
497-
const PlaceDelayModel* delay_model,
479+
void NetCostHandler::update_net_info_on_pin_move_(const PlaceDelayModel* delay_model,
498480
const PlacerCriticalities* criticalities,
499-
const ClusterBlockId blk_id,
500481
const ClusterPinId pin_id,
501482
const t_pl_moved_block& moving_blk_inf,
502483
std::vector<ClusterPinId>& affected_pins,
503484
double& timing_delta_c,
504485
bool is_src_moving) {
505486
const auto& cluster_ctx = g_vpr_ctx.clustering();
487+
506488
const ClusterNetId net_id = cluster_ctx.clb_nlist.pin_net(pin_id);
507489
VTR_ASSERT_SAFE_MSG(net_id,
508490
"Only valid nets should be found in compressed netlist block pins");
@@ -516,10 +498,11 @@ void NetCostHandler::update_net_info_on_pin_move_(const t_place_algorithm& place
516498
/* Record effected nets */
517499
record_affected_net_(net_id);
518500

501+
ClusterBlockId blk_id = moving_blk_inf.block_num;
519502
/* Update the net bounding boxes. */
520503
update_net_bb_(net_id, blk_id, pin_id, moving_blk_inf);
521504

522-
if (place_algorithm.is_timing_driven()) {
505+
if (placer_opts_.place_algorithm.is_timing_driven()) {
523506
/* Determine the change in connection delay and timing cost. */
524507
update_td_delta_costs_(delay_model,
525508
*criticalities,
@@ -1621,8 +1604,7 @@ void NetCostHandler::set_bb_delta_cost_(double& bb_delta_c) {
16211604
}
16221605
}
16231606

1624-
void NetCostHandler::find_affected_nets_and_update_costs(const t_place_algorithm& place_algorithm,
1625-
const PlaceDelayModel* delay_model,
1607+
void NetCostHandler::find_affected_nets_and_update_costs(const PlaceDelayModel* delay_model,
16261608
const PlacerCriticalities* criticalities,
16271609
t_pl_blocks_to_be_moved& blocks_affected,
16281610
double& bb_delta_c,
@@ -1636,19 +1618,17 @@ void NetCostHandler::find_affected_nets_and_update_costs(const t_place_algorithm
16361618
/* Go through all the blocks moved. */
16371619
for (const t_pl_moved_block& moving_block : blocks_affected.moved_blocks) {
16381620
auto& affected_pins = blocks_affected.affected_pins;
1639-
ClusterBlockId blk = moving_block.block_num;
1621+
ClusterBlockId blk_id = moving_block.block_num;
16401622

16411623
/* Go through all the pins in the moved block. */
1642-
for (ClusterPinId blk_pin : clb_nlist.block_pins(blk)) {
1624+
for (ClusterPinId blk_pin : clb_nlist.block_pins(blk_id)) {
16431625
bool is_src_moving = false;
16441626
if (clb_nlist.pin_type(blk_pin) == PinType::SINK) {
16451627
ClusterNetId net_id = clb_nlist.pin_net(blk_pin);
16461628
is_src_moving = driven_by_moved_block(net_id, blocks_affected.moved_blocks);
16471629
}
1648-
update_net_info_on_pin_move_(place_algorithm,
1649-
delay_model,
1630+
update_net_info_on_pin_move_(delay_model,
16501631
criticalities,
1651-
blk,
16521632
blk_pin,
16531633
moving_block,
16541634
affected_pins,
@@ -1697,8 +1677,7 @@ void NetCostHandler::reset_move_nets() {
16971677
}
16981678
}
16991679

1700-
void NetCostHandler::recompute_costs_from_scratch(const t_placer_opts& placer_opts,
1701-
const t_noc_opts& noc_opts,
1680+
void NetCostHandler::recompute_costs_from_scratch(const t_noc_opts& noc_opts,
17021681
const PlaceDelayModel* delay_model,
17031682
const PlacerCriticalities* criticalities,
17041683
t_placer_costs* costs) {
@@ -1717,13 +1696,13 @@ void NetCostHandler::recompute_costs_from_scratch(const t_placer_opts& placer_op
17171696
check_and_print_cost(new_bb_cost, costs->bb_cost, "bb_cost");
17181697
costs->bb_cost = new_bb_cost;
17191698

1720-
if (placer_opts.place_algorithm.is_timing_driven()) {
1699+
if (placer_opts_.place_algorithm.is_timing_driven()) {
17211700
double new_timing_cost = 0.;
17221701
comp_td_costs(delay_model, *criticalities, placer_ctx_, &new_timing_cost);
17231702
check_and_print_cost(new_timing_cost, costs->timing_cost, "timing_cost");
17241703
costs->timing_cost = new_timing_cost;
17251704
} else {
1726-
VTR_ASSERT(placer_opts.place_algorithm == BOUNDING_BOX_PLACE);
1705+
VTR_ASSERT(placer_opts_.place_algorithm == BOUNDING_BOX_PLACE);
17271706
costs->cost = new_bb_cost * costs->bb_cost_norm;
17281707
}
17291708

@@ -1777,21 +1756,21 @@ void NetCostHandler::get_non_updatable_bb_(const ClusterNetId net) {
17771756
void NetCostHandler::update_bb_(ClusterNetId net_id, t_physical_tile_loc pin_old_loc, t_physical_tile_loc pin_new_loc, bool is_driver) {
17781757
if (cube_bb_) {
17791758
update_bb_(net_id,
1780-
ts_bb_edge_new_[net_id],
1781-
ts_bb_coord_new_[net_id],
1782-
ts_layer_sink_pin_count_[size_t(net_id)],
1783-
pin_old_loc,
1784-
pin_new_loc,
1785-
is_driver);
1759+
ts_bb_edge_new_[net_id],
1760+
ts_bb_coord_new_[net_id],
1761+
ts_layer_sink_pin_count_[size_t(net_id)],
1762+
pin_old_loc,
1763+
pin_new_loc,
1764+
is_driver);
17861765
}
17871766
else {
17881767
update_layer_bb_(net_id,
1789-
layer_ts_bb_edge_new_[net_id],
1790-
layer_ts_bb_coord_new_[net_id],
1791-
ts_layer_sink_pin_count_[size_t(net_id)],
1792-
pin_old_loc,
1793-
pin_new_loc,
1794-
is_driver);
1768+
layer_ts_bb_edge_new_[net_id],
1769+
layer_ts_bb_coord_new_[net_id],
1770+
ts_layer_sink_pin_count_[size_t(net_id)],
1771+
pin_old_loc,
1772+
pin_new_loc,
1773+
is_driver);
17951774
}
17961775
}
17971776

@@ -1821,3 +1800,20 @@ void NetCostHandler::set_ts_edge_(const ClusterNetId net_id) {
18211800
place_move_ctx.layer_bb_num_on_edges[net_id] = layer_ts_bb_edge_new_[net_id];
18221801
}
18231802
}
1803+
1804+
1805+
static bool driven_by_moved_block(const ClusterNetId net,
1806+
const std::vector<t_pl_moved_block>& moved_blocks) {
1807+
auto& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
1808+
bool is_driven_by_move_blk = false;
1809+
ClusterBlockId net_driver_block = clb_nlist.net_driver_block(net);
1810+
1811+
for (const t_pl_moved_block& block : moved_blocks) {
1812+
if (net_driver_block == block.block_num) {
1813+
is_driven_by_move_blk = true;
1814+
break;
1815+
}
1816+
}
1817+
1818+
return is_driven_by_move_blk;
1819+
}

vpr/src/place/net_cost_handler.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ class NetCostHandler {
8383
*
8484
* @return The number of affected nets.
8585
*/
86-
void find_affected_nets_and_update_costs(const t_place_algorithm& place_algorithm,
87-
const PlaceDelayModel* delay_model,
86+
void find_affected_nets_and_update_costs(const PlaceDelayModel* delay_model,
8887
const PlacerCriticalities* criticalities,
8988
t_pl_blocks_to_be_moved& blocks_affected,
9089
double& bb_delta_c,
@@ -105,14 +104,12 @@ class NetCostHandler {
105104
* @brief re-calculates different terms of the cost function (wire-length, timing, NoC) and update "costs" accordingly. It is important to note that
106105
* in this function bounding box and connection delays are not calculated from scratch. However, it iterates over all nets and connections and updates
107106
* their costs by a complete summation, rather than incrementally.
108-
* @param placer_opts
109107
* @param noc_opts
110108
* @param delay_model
111109
* @param criticalities
112110
* @param costs passed by reference and computed by this routine (i.e. returned by reference)
113111
*/
114-
void recompute_costs_from_scratch(const t_placer_opts& placer_opts,
115-
const t_noc_opts& noc_opts,
112+
void recompute_costs_from_scratch(const t_noc_opts& noc_opts,
116113
const PlaceDelayModel* delay_model,
117114
const PlacerCriticalities* criticalities,
118115
t_placer_costs* costs);
@@ -201,20 +198,16 @@ class NetCostHandler {
201198
/**
202199
* @brief Call suitable function based on the bounding box type to update the bounding box of the net connected to pin_id. Also,
203200
* call the function to update timing information if the placement algorithm is timing-driven.
204-
* @param place_algorithm Placement algorithm
205201
* @param delay_model Timing delay model used by placer
206202
* @param criticalities Connections timing criticalities
207-
* @param blk_id Block ID of that the moving pin belongs to.
208203
* @param pin_id Pin ID of the moving pin
209204
* @param moving_blk_inf Data structure that holds information, e.g., old location and new location, about all moving blocks
210205
* @param affected_pins Netlist pins which are affected, in terms placement cost, by the proposed move.
211206
* @param timing_delta_c Timing cost change based on the proposed move
212207
* @param is_src_moving Is the moving pin the source of a net.
213208
*/
214-
void update_net_info_on_pin_move_(const t_place_algorithm& place_algorithm,
215-
const PlaceDelayModel* delay_model,
209+
void update_net_info_on_pin_move_(const PlaceDelayModel* delay_model,
216210
const PlacerCriticalities* criticalities,
217-
const ClusterBlockId blk_id,
218211
const ClusterPinId pin_id,
219212
const t_pl_moved_block& moving_blk_inf,
220213
std::vector<ClusterPinId>& affected_pins,

vpr/src/place/place.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,7 @@ static void placement_inner_loop(const t_annealing_state* state,
11121112
++(*moves_since_cost_recompute);
11131113
if (*moves_since_cost_recompute > MAX_MOVES_BEFORE_RECOMPUTE) {
11141114
//VTR_LOG("recomputing costs from scratch, old bb_cost is %g\n", costs->bb_cost);
1115-
net_cost_handler.recompute_costs_from_scratch(placer_opts, noc_opts, delay_model,
1116-
criticalities, costs);
1115+
net_cost_handler.recompute_costs_from_scratch(noc_opts, delay_model, criticalities, costs);
11171116
//VTR_LOG("new_bb_cost is %g\n", costs->bb_cost);
11181117
*moves_since_cost_recompute = 0;
11191118
}
@@ -1381,8 +1380,8 @@ static e_move_result try_swap(const t_annealing_state* state,
13811380
//
13821381
//Also find all the pins affected by the swap, and calculates new connection
13831382
//delays and timing costs and store them in proposed_* data structures.
1384-
net_cost_handler.find_affected_nets_and_update_costs(place_algorithm, delay_model, criticalities,
1385-
blocks_affected, bb_delta_c, timing_delta_c);
1383+
net_cost_handler.find_affected_nets_and_update_costs(delay_model, criticalities, blocks_affected,
1384+
bb_delta_c, timing_delta_c);
13861385

13871386
//For setup slack analysis, we first do a timing analysis to get the newest
13881387
//slack values resulted from the proposed block moves. If the move turns out

0 commit comments

Comments
 (0)