Skip to content

Commit 3becbb6

Browse files
rename congestion_acceptance_rate_trigger to congestion_rlim_trigger_ratio to be more consistent with what it actually does
1 parent 4c635b8 commit 3becbb6

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
656656

657657
PlacerOpts->timing_tradeoff = Options.PlaceTimingTradeoff;
658658
PlacerOpts->congestion_factor = Options.place_congestion_factor;
659-
PlacerOpts->congestion_acceptance_rate_trigger = Options.place_congestion_acceptance_rate_trigger;
659+
PlacerOpts->congestion_rlim_trigger_ratio = Options.place_congestion_rlim_trigger_ratio;
660660
PlacerOpts->congestion_chan_util_threshold = Options.place_congestion_chan_util_threshold;
661661

662662
/* Depends on PlacerOpts->place_algorithm */

vpr/src/base/read_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
24942494
.default_value("0.0")
24952495
.show_in(argparse::ShowIn::HELP_ONLY);
24962496

2497-
place_timing_grp.add_argument(args.place_congestion_acceptance_rate_trigger, "--congestion_acceptance_rate_trigger")
2497+
place_timing_grp.add_argument(args.place_congestion_rlim_trigger_ratio, "--congestion_rlim_trigger_ratio")
24982498
.help("To be written")
24992499
.default_value("0.0")
25002500
.show_in(argparse::ShowIn::HELP_ONLY);

vpr/src/base/read_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ struct t_options {
188188
/* Timing-driven placement options only */
189189
argparse::ArgValue<float> PlaceTimingTradeoff;
190190
argparse::ArgValue<float> place_congestion_factor;
191-
argparse::ArgValue<float> place_congestion_acceptance_rate_trigger;
191+
argparse::ArgValue<float> place_congestion_rlim_trigger_ratio;
192192
argparse::ArgValue<float> place_congestion_chan_util_threshold;
193193

194194
argparse::ArgValue<int> RecomputeCritIter;

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ struct t_placer_opts {
10141014
t_annealing_sched anneal_sched; ///<Placement option annealing schedule
10151015
float timing_tradeoff;
10161016
float congestion_factor;
1017-
float congestion_acceptance_rate_trigger;
1017+
float congestion_rlim_trigger_ratio;
10181018
float congestion_chan_util_threshold;
10191019
int place_chan_width;
10201020
enum e_pad_loc_type pad_loc_type;

vpr/src/place/annealer.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool t_annealing_state::outer_loop_update(float success_rate,
139139
}
140140

141141
// Automatically determine exit temperature.
142-
auto& cluster_ctx = g_vpr_ctx.clustering();
142+
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
143143
float t_exit = 0.005 * costs.cost / cluster_ctx.clb_nlist.nets().size();
144144

145145
VTR_ASSERT_SAFE(placer_opts.anneal_sched.type == e_sched_type::AUTO_SCHED);
@@ -377,15 +377,13 @@ e_move_result PlacementAnnealer::try_swap_(MoveGenerator& move_generator,
377377

378378
MoveOutcomeStats move_outcome_stats;
379379

380-
/* I'm using negative values of proposed_net_cost as a flag,
381-
* so DO NOT use cost functions that can go negative. */
382-
double delta_c = 0.; //Change in cost due to this swap.
383-
double bb_delta_c = 0.; //Change in the bounding box (wiring) cost.
384-
double timing_delta_c = 0.; //Change in the timing cost (delay * criticality).
385-
double congestion_delta_c = 0.;
380+
double delta_c = 0.; // Change in cost due to this swap.
381+
double bb_delta_c = 0.; // Change in the bounding box (wiring) cost.
382+
double timing_delta_c = 0.; // Change in the timing cost (delay * criticality).
383+
double congestion_delta_c = 0.; // Change in the congestion cost
386384

387-
/* Allow some fraction of moves to not be restricted by rlim,
388-
* in the hopes of better escaping local minima. */
385+
// Allow some fraction of moves to not be restricted by rlim,
386+
// in the hopes of better escaping local minima.
389387
float rlim;
390388
if (placer_opts_.rlim_escape_fraction > 0. && rng_.frand() < placer_opts_.rlim_escape_fraction) {
391389
rlim = std::numeric_limits<float>::infinity();
@@ -401,19 +399,19 @@ e_move_result PlacementAnnealer::try_swap_(MoveGenerator& move_generator,
401399
router_block_move = check_for_router_swap(noc_opts_.noc_swap_percentage, rng_);
402400
}
403401

404-
//When manual move toggle button is active, the manual move window asks the user for input.
402+
// When manual move toggle button is active, the manual move window asks the user for input.
405403
if (manual_move_enabled) {
406404
#ifndef NO_GRAPHICS
407405
create_move_outcome = manual_move_display_and_propose(manual_move_generator_, blocks_affected_,
408406
proposed_action.move_type, rlim,
409407
placer_opts_, criticalities_);
410-
#endif //NO_GRAPHICS
408+
#endif // NO_GRAPHICS
411409
} else if (router_block_move) {
412410
// generate a move where two random router blocks are swapped
413411
create_move_outcome = propose_router_swap(blocks_affected_, rlim, blk_loc_registry, place_macros_, rng_);
414412
proposed_action.move_type = e_move_type::UNIFORM;
415413
} else {
416-
//Generate a new move (perturbation) used to explore the space of possible placements
414+
// Generate a new move (perturbation) used to explore the space of possible placements
417415
create_move_outcome = move_generator.propose_move(blocks_affected_, proposed_action, rlim, placer_opts_, criticalities_);
418416
}
419417

@@ -681,7 +679,7 @@ void PlacementAnnealer::outer_loop_update_timing_info() {
681679
}
682680

683681
if (congestion_modeling_started_
684-
|| (annealing_state_.rlim / MoveGenerator::first_rlim) < placer_opts_.congestion_acceptance_rate_trigger) {
682+
|| (annealing_state_.rlim / MoveGenerator::first_rlim) < placer_opts_.congestion_rlim_trigger_ratio) {
685683
costs_.congestion_cost = net_cost_handler_.estimate_routing_chan_util();
686684

687685
if (!congestion_modeling_started_) {

vpr/src/place/net_cost_handler.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ double NetCostHandler::get_net_cube_cong_cost_(ClusterNetId net_id, bool use_ts)
14211421
VTR_ASSERT_SAFE(congestion_modeling_started_);
14221422
const auto [x_chan_util, y_chan_util] = use_ts ? ts_avg_chann_util_new_[net_id] : avg_chann_util_[net_id];
14231423

1424-
const t_bb& bb = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
1424+
// const t_bb& bb = use_ts ? ts_bb_coord_new_[net_id] : bb_coords_[net_id];
14251425

14261426
// int distance_x = bb.xmax - bb.xmin + 1;
14271427
// int distance_y = bb.ymax - bb.ymin + 1;
@@ -1802,6 +1802,7 @@ double NetCostHandler::estimate_routing_chan_util() {
18021802
}
18031803
}
18041804

1805+
// Channel width is computed only once and reused in later calls.
18051806
if (chanx_width_.empty()) {
18061807
VTR_ASSERT(chany_width_.empty());
18071808
std::tie(chanx_width_, chany_width_) = calculate_channel_width();
@@ -1811,9 +1812,9 @@ double NetCostHandler::estimate_routing_chan_util() {
18111812
VTR_ASSERT(chanx_util_.size() == chanx_width_.size());
18121813
VTR_ASSERT(chany_util_.size() == chany_width_.size());
18131814

1814-
for (size_t layer = 0; layer < chanx_util_.dim_size(0); ++layer) {
1815-
for (size_t x = 0; x < chanx_util_.dim_size(1); ++x) {
1816-
for (size_t y = 0; y < chanx_util_.dim_size(2); ++y) {
1815+
for (size_t layer = 0; layer < num_layers; ++layer) {
1816+
for (size_t x = 0; x < grid_width; ++x) {
1817+
for (size_t y = 0; y < grid_height; ++y) {
18171818
if (chanx_width_[layer][x][y] > 0) {
18181819
chanx_util_[layer][x][y] /= chanx_width_[layer][x][y];
18191820
} else {

vpr/src/place/place_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "noc_place_utils.h"
1212

1313
void t_placer_costs::update_norm_factors() {
14-
const auto& clustered_nlist = g_vpr_ctx.clustering().clb_nlist;
14+
const ClusteredNetlist& clustered_nlist = g_vpr_ctx.clustering().clb_nlist;
1515

1616
bb_cost_norm = 1 / bb_cost;
1717

@@ -76,7 +76,7 @@ int get_place_inner_loop_num_move(const t_placer_opts& placer_opts, const t_anne
7676
move_lim = int(annealing_sched.inner_num * pow(device_size, 2. / 3.) * pow(num_blocks, 2. / 3.));
7777
}
7878

79-
/* Avoid having a non-positive move_lim */
79+
// Avoid having a non-positive move_lim
8080
move_lim = std::max(move_lim, 1);
8181

8282
return move_lim;

0 commit comments

Comments
 (0)