Skip to content

Commit dd2cfe2

Browse files
committed
Utilized the is_timing_driven() method provided by the t_place_algorithm class to efficiently include SLACK_TIMING_PLACE in all branchings related to CRITICALITY_TIMING_PLACE.
1 parent cd79ff5 commit dd2cfe2

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

vpr/src/base/CheckSetup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void CheckSetup(const t_packer_opts& PackerOpts,
2323
}
2424

2525
if ((GLOBAL == RouterOpts.route_type)
26-
&& (PlacerOpts.place_algorithm != BOUNDING_BOX_PLACE)) {
26+
&& (PlacerOpts.place_algorithm.is_timing_driven())) {
2727
/* Works, but very weird. Can't optimize timing well, since you're
2828
* not doing proper architecture delay modelling. */
2929
VTR_LOG_WARN(
@@ -32,7 +32,7 @@ void CheckSetup(const t_packer_opts& PackerOpts,
3232
}
3333

3434
if ((false == Timing.timing_analysis_enabled)
35-
&& (PlacerOpts.place_algorithm == CRITICALITY_TIMING_PLACE)) {
35+
&& (PlacerOpts.place_algorithm.is_timing_driven())) {
3636
/* May work, not tested */
3737
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
3838
"Timing analysis must be enabled for timing-driven placement.\n");

vpr/src/base/ShowSetup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static void ShowPlacerOpts(const t_placer_opts& PlacerOpts,
541541

542542
VTR_LOG("PlacerOpts.place_chan_width: %d\n", PlacerOpts.place_chan_width);
543543

544-
if (PlacerOpts.place_algorithm == CRITICALITY_TIMING_PLACE) {
544+
if (PlacerOpts.place_algorithm.is_timing_driven()) {
545545
VTR_LOG("PlacerOpts.inner_loop_recompute_divider: %d\n", PlacerOpts.inner_loop_recompute_divider);
546546
VTR_LOG("PlacerOpts.recompute_crit_iter: %d\n", PlacerOpts.recompute_crit_iter);
547547
VTR_LOG("PlacerOpts.timing_tradeoff: %f\n", PlacerOpts.timing_tradeoff);

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ class t_place_algorithm {
886886
bool operator!=(e_place_algorithm rhs) const { return algo != rhs; }
887887

888888
///@brief Check if the algorithm belongs to the timing driven category.
889-
inline bool isTimingDriven() const {
889+
inline bool is_timing_driven() const {
890890
return algo == CRITICALITY_TIMING_PLACE || algo == SLACK_TIMING_PLACE;
891891
}
892892

vpr/src/place/place.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ void try_place(const t_placer_opts& placer_opts,
589589
num_swap_aborted = 0;
590590
num_ts_called = 0;
591591

592-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
592+
if (placer_opts.place_algorithm.is_timing_driven()) {
593593
/*do this before the initial placement to avoid messing up the initial placement */
594594
place_delay_model = alloc_lookups_and_criticalities(chan_width_dist, placer_opts, router_opts, det_routing_arch, segment_inf, directs, num_directs);
595595

@@ -620,7 +620,7 @@ void try_place(const t_placer_opts& placer_opts,
620620

621621
/* Gets initial cost and loads bounding boxes. */
622622

623-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
623+
if (placer_opts.place_algorithm.is_timing_driven()) {
624624
costs.bb_cost = comp_bb_cost(NORMAL);
625625

626626
first_crit_exponent = placer_opts.td_place_exp_first; /*this will be modified when rlim starts to change */
@@ -696,7 +696,7 @@ void try_place(const t_placer_opts& placer_opts,
696696
//Initial pacement statistics
697697
VTR_LOG("Initial placement cost: %g bb_cost: %g td_cost: %g\n",
698698
costs.cost, costs.bb_cost, costs.timing_cost);
699-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
699+
if (placer_opts.place_algorithm.is_timing_driven()) {
700700
VTR_LOG("Initial placement estimated Critical Path Delay (CPD): %g ns\n",
701701
1e9 * critical_path.delay());
702702
VTR_LOG("Initial placement estimated setup Total Negative Slack (sTNS): %g ns\n",
@@ -802,7 +802,7 @@ void try_place(const t_placer_opts& placer_opts,
802802
/* Outer loop of the simulated annealing begins */
803803
do {
804804
vtr::Timer temperature_timer;
805-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
805+
if (placer_opts.place_algorithm.is_timing_driven()) {
806806
costs.cost = 1;
807807
}
808808

@@ -836,7 +836,7 @@ void try_place(const t_placer_opts& placer_opts,
836836

837837
++num_temps;
838838

839-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
839+
if (placer_opts.place_algorithm.is_timing_driven()) {
840840
critical_path = timing_info->least_slack_critical_path();
841841
sTNS = timing_info->setup_total_negative_slack();
842842
sWNS = timing_info->setup_worst_negative_slack();
@@ -898,7 +898,7 @@ void try_place(const t_placer_opts& placer_opts,
898898

899899
calc_placer_stats(stats, success_rat, std_dev, costs, move_lim);
900900

901-
if (placer_opts.place_quench_algorithm == CRITICALITY_TIMING_PLACE) {
901+
if (placer_opts.place_quench_algorithm.is_timing_driven()) {
902902
critical_path = timing_info->least_slack_critical_path();
903903
sTNS = timing_info->setup_total_negative_slack();
904904
sWNS = timing_info->setup_worst_negative_slack();
@@ -935,7 +935,7 @@ void try_place(const t_placer_opts& placer_opts,
935935
VTR_LOG("Swaps called: %d\n", num_ts_called);
936936
report_aborted_moves();
937937

938-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
938+
if (placer_opts.place_algorithm.is_timing_driven()) {
939939
//Final timing estimate
940940
VTR_ASSERT(timing_info);
941941
perform_full_timing_update(state.crit_exponent,
@@ -1009,7 +1009,7 @@ static void outer_loop_update_timing_info(const t_placer_opts& placer_opts,
10091009
PlacerSetupSlacks* setup_slacks,
10101010
ClusteredPinTimingInvalidator* pin_timing_invalidator,
10111011
SetupTimingInfo* timing_info) {
1012-
if (placer_opts.place_algorithm != CRITICALITY_TIMING_PLACE) {
1012+
if (!placer_opts.place_algorithm.is_timing_driven()) {
10131013
return;
10141014
}
10151015

@@ -1238,7 +1238,7 @@ static void placement_inner_loop(float t,
12381238
num_swap_rejected++;
12391239
}
12401240

1241-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
1241+
if (placer_opts.place_algorithm.is_timing_driven()) {
12421242
/* Do we want to re-timing analyze the circuit to get updated slack and criticality values?
12431243
* We do this only once in a while, since it is expensive.
12441244
*/
@@ -1303,7 +1303,7 @@ static void recompute_costs_from_scratch(const t_placer_opts& placer_opts,
13031303
}
13041304
costs->bb_cost = new_bb_cost;
13051305

1306-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
1306+
if (placer_opts.place_algorithm.is_timing_driven()) {
13071307
double new_timing_cost = 0.;
13081308
comp_td_costs(delay_model, *criticalities, &new_timing_cost);
13091309
if (fabs(new_timing_cost - costs->timing_cost) > costs->timing_cost * ERROR_TOL) {
@@ -1424,7 +1424,7 @@ static bool update_annealing_state(t_annealing_state* state,
14241424
// The idea is that as the range limit shrinks (indicating we are fine-tuning a more optimized placement) we can focus more on a smaller number of critical connections, which a higher crit_exponent achieves.
14251425
update_rlim(&state->rlim, success_rat, device_ctx.grid);
14261426

1427-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
1427+
if (placer_opts.place_algorithm.is_timing_driven()) {
14281428
state->crit_exponent = (1 - (state->rlim - FINAL_RLIM) * state->inverse_delta_rlim)
14291429
* (placer_opts.td_place_exp_last - placer_opts.td_place_exp_first)
14301430
+ placer_opts.td_place_exp_first;
@@ -1817,7 +1817,7 @@ static int find_affected_nets_and_update_costs(const t_place_algorithm& place_al
18171817
//once per net, not once per pin.
18181818
update_net_bb(net_id, blocks_affected, iblk, blk, blk_pin);
18191819

1820-
if (place_algorithm == CRITICALITY_TIMING_PLACE || place_algorithm == SLACK_TIMING_PLACE) {
1820+
if (place_algorithm.is_timing_driven()) {
18211821
//Determine the change in timing costs if required
18221822
update_td_delta_costs(delay_model, *criticalities, net_id, blk_pin, blocks_affected, timing_delta_c);
18231823
}
@@ -2440,7 +2440,7 @@ static void alloc_and_load_placement_structs(float place_cost_exp,
24402440
max_pins_per_clb = max(max_pins_per_clb, type.num_pins);
24412441
}
24422442

2443-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
2443+
if (placer_opts.place_algorithm.is_timing_driven()) {
24442444
/* Allocate structures associated with timing driven placement */
24452445
/* [0..cluster_ctx.clb_nlist.nets().size()-1][1..num_pins-1] */
24462446
connection_delay = make_net_pins_matrix<float>(cluster_ctx.clb_nlist, 0.f);
@@ -2486,7 +2486,7 @@ static void alloc_and_load_placement_structs(float place_cost_exp,
24862486
/* Frees the major structures needed by the placer (and not needed *
24872487
* elsewhere). */
24882488
static void free_placement_structs(const t_placer_opts& placer_opts) {
2489-
if (placer_opts.place_algorithm == CRITICALITY_TIMING_PLACE) {
2489+
if (placer_opts.place_algorithm.is_timing_driven()) {
24902490
vtr::release_memory(connection_timing_cost);
24912491
vtr::release_memory(connection_delay);
24922492
vtr::release_memory(connection_setup_slack);
@@ -3085,7 +3085,7 @@ static int check_placement_costs(const t_placer_costs& costs,
30853085
error++;
30863086
}
30873087

3088-
if (place_algorithm == CRITICALITY_TIMING_PLACE) {
3088+
if (place_algorithm.is_timing_driven()) {
30893089
comp_td_costs(delay_model, *criticalities, &timing_cost_check);
30903090
//VTR_LOG("timing_cost recomputed from scratch: %g\n", timing_cost_check);
30913091
if (fabs(timing_cost_check - costs.timing_cost) > costs.timing_cost * ERROR_TOL) {
@@ -3355,5 +3355,5 @@ static void init_annealing_state(t_annealing_state* state,
33553355
}
33563356

33573357
bool placer_needs_lookahead(const t_vpr_setup& vpr_setup) {
3358-
return (vpr_setup.PlacerOpts.place_algorithm == CRITICALITY_TIMING_PLACE);
3358+
return (vpr_setup.PlacerOpts.place_algorithm.is_timing_driven());
33593359
}

0 commit comments

Comments
 (0)