Skip to content

Commit 898c73d

Browse files
re-normalize timing-tradeoff
1 parent 3d89417 commit 898c73d

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

vpr/src/place/annealer.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ PlacementAnnealer::PlacementAnnealer(const t_placer_opts& placer_opts,
227227
, congestion_modeling_started_(false) {
228228
const auto& device_ctx = g_vpr_ctx.device();
229229

230+
congestion_factor_ = placer_opts_.congestion_factor;
231+
placer_opts_.congestion_factor = 0.;
232+
230233
float first_crit_exponent;
231234
if (placer_opts.place_algorithm.is_timing_driven()) {
232235
first_crit_exponent = placer_opts.td_place_exp_first; /*this will be modified when rlim starts to change */
@@ -467,7 +470,7 @@ e_move_result PlacementAnnealer::try_swap_(MoveGenerator& move_generator,
467470
placer_opts_.timing_tradeoff,
468471
timing_delta_c,
469472
costs_.timing_cost_norm);
470-
delta_c = (1 - placer_opts_.timing_tradeoff) * bb_delta_c * costs_.bb_cost_norm
473+
delta_c = (1 - placer_opts_.timing_tradeoff - placer_opts_.congestion_factor) * bb_delta_c * costs_.bb_cost_norm
471474
+ placer_opts_.timing_tradeoff * timing_delta_c * costs_.timing_cost_norm
472475
+ placer_opts_.congestion_factor * congestion_delta_c * costs_.congestion_cost_norm;
473476
} else if (place_algorithm == e_place_algorithm::SLACK_TIMING_PLACE) {
@@ -672,9 +675,20 @@ void PlacementAnnealer::outer_loop_update_timing_info() {
672675
}
673676

674677
if (congestion_modeling_started_
675-
|| (placer_stats_.success_rate < placer_opts_.congestion_acceptance_rate_trigger && placer_stats_.av_cost != 0.)) {
678+
|| (annealing_state_.rlim / MoveGenerator::first_rlim) < placer_opts_.congestion_acceptance_rate_trigger) {
676679
costs_.congestion_cost = net_cost_handler_.estimate_routing_chann_util();
677-
congestion_modeling_started_ = true;
680+
681+
682+
if (!congestion_modeling_started_) {
683+
VTR_LOG("Congestion modeling started. %f %f\n", placer_opts_.congestion_factor, placer_opts_.timing_tradeoff);
684+
placer_opts_.congestion_factor = congestion_factor_;
685+
placer_opts_.congestion_factor /= 1.f + congestion_factor_;
686+
// placer_opts_.congestion_factor /= 1.f + placer_opts_.congestion_factor;
687+
placer_opts_.timing_tradeoff /= 1.f + congestion_factor_;
688+
VTR_LOG("Congestion modeling started. %f %f\n", placer_opts_.congestion_factor, placer_opts_.timing_tradeoff);
689+
congestion_modeling_started_ = true;
690+
}
691+
678692
}
679693

680694
// Update the cost normalization factors
@@ -760,11 +774,6 @@ void PlacementAnnealer::placement_inner_loop() {
760774
// Calculate the success_rate and std_dev of the costs.
761775
placer_stats_.calc_iteration_stats(costs_, annealing_state_.move_lim);
762776

763-
if (congestion_modeling_started_ || placer_stats_.success_rate < placer_opts_.congestion_acceptance_rate_trigger) {
764-
net_cost_handler_.estimate_routing_chann_util();
765-
congestion_modeling_started_ = true;
766-
}
767-
768777
// update the RL agent's state
769778
if (!quench_started_) {
770779
if (placer_opts_.place_algorithm.is_timing_driven() && placer_opts_.place_agent_multistate && agent_state_ == e_agent_state::EARLY_IN_THE_ANNEAL) {

vpr/src/place/annealer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ class PlacementAnnealer {
268268
float estimate_starting_temperature_();
269269

270270
private:
271-
const t_placer_opts& placer_opts_;
271+
t_placer_opts placer_opts_;
272+
float congestion_factor_;
273+
272274
PlacerState& placer_state_;
273275
const PlaceMacros& place_macros_;
274276
/// Stores different placement cost terms

vpr/src/place/place_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ 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) * (bb_cost * bb_cost_norm) + (placer_opts.timing_tradeoff) * (timing_cost * timing_cost_norm);
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);
4646
}
4747

48-
total_cost += congestion_cost * congestion_cost_norm;
48+
total_cost += placer_opts.congestion_factor * congestion_cost * congestion_cost_norm;
4949

5050
if (noc_opts.noc) {
5151
// in noc mode we include noc aggregate bandwidth, noc latency, and noc congestion

0 commit comments

Comments
 (0)