Skip to content

Commit ae67ef8

Browse files
update t_exit to avoid cost factor normalization when congestion modeling is enabeld
1 parent 3becbb6 commit ae67ef8

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

vpr/src/place/annealer.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ t_annealing_state::t_annealing_state(float first_t,
118118
}
119119

120120
bool t_annealing_state::outer_loop_update(float success_rate,
121+
bool congestion_modeling_enabled,
121122
const t_placer_costs& costs,
122123
const t_placer_opts& placer_opts) {
123124
#ifndef NO_GRAPHICS
@@ -140,7 +141,12 @@ bool t_annealing_state::outer_loop_update(float success_rate,
140141

141142
// Automatically determine exit temperature.
142143
const ClusteringContext& cluster_ctx = g_vpr_ctx.clustering();
143-
float t_exit = 0.005 * costs.cost / cluster_ctx.clb_nlist.nets().size();
144+
float t_exit;
145+
if (congestion_modeling_enabled) {
146+
t_exit = 0.005 * (1. + placer_opts.congestion_factor) * costs.cost / cluster_ctx.clb_nlist.nets().size();
147+
} else {
148+
t_exit = 0.005 * costs.cost / cluster_ctx.clb_nlist.nets().size();
149+
}
144150

145151
VTR_ASSERT_SAFE(placer_opts.anneal_sched.type == e_sched_type::AUTO_SCHED);
146152
// Automatically adjust alpha according to success rate.
@@ -232,8 +238,6 @@ PlacementAnnealer::PlacementAnnealer(const t_placer_opts& placer_opts,
232238
, congestion_modeling_started_(false) {
233239
const auto& device_ctx = g_vpr_ctx.device();
234240

235-
congestion_factor_ = placer_opts_.congestion_factor;
236-
placer_opts_.congestion_factor = 0.;
237241

238242
float first_crit_exponent;
239243
if (placer_opts.place_algorithm.is_timing_driven()) {
@@ -474,7 +478,7 @@ e_move_result PlacementAnnealer::try_swap_(MoveGenerator& move_generator,
474478
placer_opts_.timing_tradeoff,
475479
timing_delta_c,
476480
costs_.timing_cost_norm);
477-
delta_c = (1 - placer_opts_.timing_tradeoff - placer_opts_.congestion_factor) * bb_delta_c * costs_.bb_cost_norm
481+
delta_c = (1 - placer_opts_.timing_tradeoff) * bb_delta_c * costs_.bb_cost_norm
478482
+ placer_opts_.timing_tradeoff * timing_delta_c * costs_.timing_cost_norm
479483
+ placer_opts_.congestion_factor * congestion_delta_c * costs_.congestion_cost_norm;
480484
} else if (place_algorithm == e_place_algorithm::SLACK_TIMING_PLACE) {
@@ -683,12 +687,7 @@ void PlacementAnnealer::outer_loop_update_timing_info() {
683687
costs_.congestion_cost = net_cost_handler_.estimate_routing_chan_util();
684688

685689
if (!congestion_modeling_started_) {
686-
VTR_LOG("Congestion modeling started. %f %f\n", placer_opts_.congestion_factor, placer_opts_.timing_tradeoff);
687-
placer_opts_.congestion_factor = congestion_factor_;
688-
placer_opts_.congestion_factor /= 1.f + congestion_factor_;
689-
// placer_opts_.congestion_factor /= 1.f + placer_opts_.congestion_factor;
690-
placer_opts_.timing_tradeoff /= 1.f + congestion_factor_;
691-
VTR_LOG("Congestion modeling started. %f %f\n", placer_opts_.congestion_factor, placer_opts_.timing_tradeoff);
690+
VTR_LOG("Congestion modeling started.\n");
692691
congestion_modeling_started_ = true;
693692
}
694693
}
@@ -803,7 +802,7 @@ const t_annealing_state& PlacementAnnealer::get_annealing_state() const {
803802
}
804803

805804
bool PlacementAnnealer::outer_loop_update_state() {
806-
return annealing_state_.outer_loop_update(placer_stats_.success_rate, costs_, placer_opts_);
805+
return annealing_state_.outer_loop_update(placer_stats_.success_rate, congestion_modeling_started_, costs_, placer_opts_);
807806
}
808807

809808
void PlacementAnnealer::start_quench() {

vpr/src/place/annealer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class t_annealing_state {
105105
* @return True->continues the annealing. False->exits the annealing.
106106
*/
107107
bool outer_loop_update(float success_rate,
108+
bool congestion_modeling_enabled,
108109
const t_placer_costs& costs,
109110
const t_placer_opts& placer_opts);
110111

@@ -269,8 +270,7 @@ class PlacementAnnealer {
269270
float estimate_starting_temperature_();
270271

271272
private:
272-
t_placer_opts placer_opts_;
273-
float congestion_factor_;
273+
const t_placer_opts& placer_opts_;
274274

275275
PlacerState& placer_state_;
276276
const PlaceMacros& place_macros_;

vpr/src/place/place_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ double t_placer_costs::get_total_cost(const t_placer_opts& placer_opts, const t_
4242
total_cost = bb_cost * bb_cost_norm;
4343
} else if (placer_opts.place_algorithm.is_timing_driven()) {
4444
// in timing mode we include both wirelength and timing costs
45-
total_cost = (1 - placer_opts.timing_tradeoff - placer_opts.congestion_factor) * (bb_cost * bb_cost_norm) + (placer_opts.timing_tradeoff) * (timing_cost * timing_cost_norm);
45+
total_cost = (1 - placer_opts.timing_tradeoff) * (bb_cost * bb_cost_norm) + (placer_opts.timing_tradeoff) * (timing_cost * timing_cost_norm);
4646
}
4747

4848
total_cost += placer_opts.congestion_factor * congestion_cost * congestion_cost_norm;

0 commit comments

Comments
 (0)