@@ -327,19 +327,19 @@ static e_swap_result try_swap(float t,
327
327
t_placer_costs* costs,
328
328
t_placer_prev_inverse_costs* prev_inverse_costs,
329
329
float rlim,
330
- const PlaceDelayModel& delay_model,
330
+ const PlaceDelayModel* delay_model,
331
331
float rlim_escape_fraction,
332
332
enum e_place_algorithm place_algorithm,
333
333
float timing_tradeoff);
334
334
335
335
static ClusterBlockId pick_from_block ();
336
336
337
337
static void check_place (const t_placer_costs& costs,
338
- const PlaceDelayModel& delay_model,
338
+ const PlaceDelayModel* delay_model,
339
339
enum e_place_algorithm place_algorithm);
340
340
341
341
static int check_placement_costs (const t_placer_costs& costs,
342
- const PlaceDelayModel& delay_model,
342
+ const PlaceDelayModel* delay_model,
343
343
enum e_place_algorithm place_algorithm);
344
344
static int check_placement_consistency ();
345
345
static int check_block_placement_consistency ();
@@ -350,7 +350,7 @@ static float starting_t(t_placer_costs* costs,
350
350
t_annealing_sched annealing_sched,
351
351
int max_moves,
352
352
float rlim,
353
- const PlaceDelayModel& delay_model,
353
+ const PlaceDelayModel* delay_model,
354
354
const t_placer_opts& placer_opts);
355
355
356
356
static void update_t (float * t, float rlim, float success_rat, t_annealing_sched annealing_sched);
@@ -365,15 +365,15 @@ static double get_std_dev(int n, double sum_x_squared, double av_x);
365
365
366
366
static double recompute_bb_cost ();
367
367
368
- static float comp_td_point_to_point_delay (const PlaceDelayModel& delay_model, ClusterNetId net_id, int ipin);
368
+ static float comp_td_point_to_point_delay (const PlaceDelayModel* delay_model, ClusterNetId net_id, int ipin);
369
369
370
- static void comp_td_point_to_point_delays (const PlaceDelayModel& delay_model);
370
+ static void comp_td_point_to_point_delays (const PlaceDelayModel* delay_model);
371
371
372
372
static void update_td_cost ();
373
373
374
374
static bool driven_by_moved_block (const ClusterNetId net);
375
375
376
- static void comp_td_costs (const PlaceDelayModel& delay_model, double * timing_cost);
376
+ static void comp_td_costs (const PlaceDelayModel* delay_model, double * timing_cost);
377
377
378
378
static e_swap_result assess_swap (double delta_c, double t);
379
379
@@ -383,12 +383,12 @@ static void get_non_updateable_bb(ClusterNetId net_id, t_bb* bb_coord_new);
383
383
384
384
static void update_bb (ClusterNetId net_id, t_bb* bb_coord_new, t_bb* bb_edge_new, int xold, int yold, int xnew, int ynew);
385
385
386
- static int find_affected_nets_and_update_costs (e_place_algorithm place_algorithm, const PlaceDelayModel& delay_model, double & bb_delta_c, double & timing_delta_c);
386
+ static int find_affected_nets_and_update_costs (e_place_algorithm place_algorithm, const PlaceDelayModel* delay_model, double & bb_delta_c, double & timing_delta_c);
387
387
388
388
static void record_affected_net (const ClusterNetId net, int & num_affected_nets);
389
389
390
390
static void update_net_bb (const ClusterNetId net, int iblk, const ClusterBlockId blk, const ClusterPinId blk_pin);
391
- static void update_td_delta_costs (const PlaceDelayModel& delay_model, const ClusterNetId net, const ClusterPinId pin, double & delta_timing_cost);
391
+ static void update_td_delta_costs (const PlaceDelayModel* delay_model, const ClusterNetId net, const ClusterPinId pin, double & delta_timing_cost);
392
392
393
393
static double get_net_cost (ClusterNetId net_id, t_bb* bb_ptr);
394
394
@@ -405,7 +405,7 @@ static void outer_loop_recompute_criticalities(const t_placer_opts& placer_opts,
405
405
float crit_exponent,
406
406
int * outer_crit_iter_count,
407
407
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
408
- const PlaceDelayModel& delay_model,
408
+ const PlaceDelayModel* delay_model,
409
409
SetupTimingInfo& timing_info);
410
410
411
411
static void placement_inner_loop (float t,
@@ -419,10 +419,10 @@ static void placement_inner_loop(float t,
419
419
t_placer_prev_inverse_costs* prev_inverse_costs,
420
420
int * moves_since_cost_recompute,
421
421
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
422
- const PlaceDelayModel& delay_model,
422
+ const PlaceDelayModel* delay_model,
423
423
SetupTimingInfo& timing_info);
424
424
425
- static void recompute_costs_from_scratch (const t_placer_opts& placer_opts, const PlaceDelayModel& delay_model, t_placer_costs* costs);
425
+ static void recompute_costs_from_scratch (const t_placer_opts& placer_opts, const PlaceDelayModel* delay_model, t_placer_costs* costs);
426
426
427
427
static void calc_placer_stats (t_placer_statistics& stats, float & success_rat, double & std_dev, const t_placer_costs& costs, const int move_lim);
428
428
@@ -485,7 +485,8 @@ void try_place(const t_placer_opts& placer_opts,
485
485
486
486
std::shared_ptr<SetupTimingInfo> timing_info;
487
487
std::shared_ptr<PlacementDelayCalculator> placement_delay_calc;
488
- std::unique_ptr<PlaceDelayModel> place_delay_model;
488
+ std::unique_ptr<PlaceDelayModel> place_delay_model_holder;
489
+ const PlaceDelayModel* place_delay_model = nullptr ;
489
490
490
491
/* Allocated here because it goes into timing critical code where each memory allocation is expensive */
491
492
IntraLbPbPinLookup pb_gpin_lookup (device_ctx.block_types , device_ctx.num_block_types );
@@ -499,7 +500,8 @@ void try_place(const t_placer_opts& placer_opts,
499
500
if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE
500
501
|| placer_opts.enable_timing_computations ) {
501
502
/* do this before the initial placement to avoid messing up the initial placement */
502
- place_delay_model = alloc_lookups_and_criticalities (chan_width_dist, placer_opts, router_opts, det_routing_arch, segment_inf, directs, num_directs);
503
+ place_delay_model_holder = alloc_lookups_and_criticalities (chan_width_dist, placer_opts, router_opts, det_routing_arch, segment_inf, directs, num_directs);
504
+ place_delay_model = place_delay_model_holder.get ();
503
505
504
506
if (isEchoFileEnabled (E_ECHO_PLACEMENT_DELTA_DELAY_MODEL)) {
505
507
place_delay_model->dump_echo (getEchoFileName (E_ECHO_PLACEMENT_DELTA_DELAY_MODEL));
@@ -532,7 +534,7 @@ void try_place(const t_placer_opts& placer_opts,
532
534
VTR_LOG (" \n " );
533
535
534
536
// Update the point-to-point delays from the initial placement
535
- comp_td_point_to_point_delays (* place_delay_model);
537
+ comp_td_point_to_point_delays (place_delay_model);
536
538
537
539
/*
538
540
* Initialize timing analysis
@@ -560,7 +562,7 @@ void try_place(const t_placer_opts& placer_opts,
560
562
}
561
563
562
564
/* now we can properly compute costs */
563
- comp_td_costs (* place_delay_model, &costs.timing_cost ); /* also updates values in point_to_point_delay */
565
+ comp_td_costs (place_delay_model, &costs.timing_cost ); /* also updates values in point_to_point_delay */
564
566
565
567
outer_crit_iter_count = 1 ;
566
568
@@ -581,7 +583,7 @@ void try_place(const t_placer_opts& placer_opts,
581
583
}
582
584
583
585
// Sanity check that initial placement is legal
584
- check_place (costs, * place_delay_model, placer_opts.place_algorithm );
586
+ check_place (costs, place_delay_model, placer_opts.place_algorithm );
585
587
586
588
// Initial pacement statistics
587
589
VTR_LOG (" Initial placement cost: %g bb_cost: %g td_cost: %g\n " ,
@@ -638,7 +640,7 @@ void try_place(const t_placer_opts& placer_opts,
638
640
639
641
t = starting_t (&costs, &prev_inverse_costs,
640
642
annealing_sched, move_lim, rlim,
641
- * place_delay_model,
643
+ place_delay_model,
642
644
placer_opts);
643
645
644
646
tot_iter = 0 ;
@@ -655,7 +657,7 @@ void try_place(const t_placer_opts& placer_opts,
655
657
crit_exponent,
656
658
&outer_crit_iter_count,
657
659
netlist_pin_lookup,
658
- * place_delay_model,
660
+ place_delay_model,
659
661
*timing_info);
660
662
661
663
placement_inner_loop (t, rlim, placer_opts,
@@ -664,7 +666,7 @@ void try_place(const t_placer_opts& placer_opts,
664
666
&prev_inverse_costs,
665
667
&moves_since_cost_recompute,
666
668
netlist_pin_lookup,
667
- * place_delay_model,
669
+ place_delay_model,
668
670
*timing_info);
669
671
670
672
tot_iter += move_lim;
@@ -709,7 +711,7 @@ void try_place(const t_placer_opts& placer_opts,
709
711
crit_exponent,
710
712
&outer_crit_iter_count,
711
713
netlist_pin_lookup,
712
- * place_delay_model,
714
+ place_delay_model,
713
715
*timing_info);
714
716
715
717
t = 0 ; /* freeze out */
@@ -722,7 +724,7 @@ void try_place(const t_placer_opts& placer_opts,
722
724
&prev_inverse_costs,
723
725
&moves_since_cost_recompute,
724
726
netlist_pin_lookup,
725
- * place_delay_model,
727
+ place_delay_model,
726
728
*timing_info);
727
729
728
730
tot_iter += move_lim;
@@ -747,7 +749,7 @@ void try_place(const t_placer_opts& placer_opts,
747
749
}
748
750
#endif
749
751
750
- check_place (costs, * place_delay_model, placer_opts.place_algorithm );
752
+ check_place (costs, place_delay_model, placer_opts.place_algorithm );
751
753
752
754
// Some stats
753
755
VTR_LOG (" \n " );
@@ -761,7 +763,7 @@ void try_place(const t_placer_opts& placer_opts,
761
763
for (size_t ipin = 1 ; ipin < cluster_ctx.clb_nlist .net_pins (net_id).size (); ipin++)
762
764
set_timing_place_crit (net_id, ipin, 0 ); /* dummy crit values */
763
765
}
764
- comp_td_costs (* place_delay_model, &costs.timing_cost ); /* computes point_to_point_delay */
766
+ comp_td_costs (place_delay_model, &costs.timing_cost ); /* computes point_to_point_delay */
765
767
}
766
768
767
769
if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE
@@ -838,7 +840,7 @@ static void outer_loop_recompute_criticalities(const t_placer_opts& placer_opts,
838
840
float crit_exponent,
839
841
int * outer_crit_iter_count,
840
842
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
841
- const PlaceDelayModel& delay_model,
843
+ const PlaceDelayModel* delay_model,
842
844
SetupTimingInfo& timing_info) {
843
845
if (placer_opts.place_algorithm != PATH_TIMING_DRIVEN_PLACE)
844
846
return ;
@@ -882,7 +884,7 @@ static void placement_inner_loop(float t,
882
884
t_placer_prev_inverse_costs* prev_inverse_costs,
883
885
int * moves_since_cost_recompute,
884
886
const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
885
- const PlaceDelayModel& delay_model,
887
+ const PlaceDelayModel* delay_model,
886
888
SetupTimingInfo& timing_info) {
887
889
int inner_crit_iter_count, inner_iter;
888
890
@@ -960,7 +962,7 @@ static void placement_inner_loop(float t,
960
962
/* Inner loop ends */
961
963
}
962
964
963
- static void recompute_costs_from_scratch (const t_placer_opts& placer_opts, const PlaceDelayModel& delay_model, t_placer_costs* costs) {
965
+ static void recompute_costs_from_scratch (const t_placer_opts& placer_opts, const PlaceDelayModel* delay_model, t_placer_costs* costs) {
964
966
double new_bb_cost = recompute_bb_cost ();
965
967
if (fabs (new_bb_cost - costs->bb_cost ) > costs->bb_cost * ERROR_TOL) {
966
968
std::string msg = vtr::string_fmt (" in recompute_costs_from_scratch: new_bb_cost = %g, old bb_cost = %g\n " ,
@@ -1083,7 +1085,7 @@ static float starting_t(t_placer_costs* costs,
1083
1085
t_annealing_sched annealing_sched,
1084
1086
int max_moves,
1085
1087
float rlim,
1086
- const PlaceDelayModel& delay_model,
1088
+ const PlaceDelayModel* delay_model,
1087
1089
const t_placer_opts& placer_opts) {
1088
1090
/* Finds the starting temperature (hot condition). */
1089
1091
@@ -1699,7 +1701,7 @@ static e_swap_result try_swap(float t,
1699
1701
t_placer_costs* costs,
1700
1702
t_placer_prev_inverse_costs* prev_inverse_costs,
1701
1703
float rlim,
1702
- const PlaceDelayModel& delay_model,
1704
+ const PlaceDelayModel* delay_model,
1703
1705
float rlim_escape_fraction,
1704
1706
enum e_place_algorithm place_algorithm,
1705
1707
float timing_tradeoff) {
@@ -1875,7 +1877,7 @@ static ClusterBlockId pick_from_block() {
1875
1877
// and updates their bounding box.
1876
1878
//
1877
1879
// Returns the number of affected nets.
1878
- static int find_affected_nets_and_update_costs (e_place_algorithm place_algorithm, const PlaceDelayModel& delay_model, double & bb_delta_c, double & timing_delta_c) {
1880
+ static int find_affected_nets_and_update_costs (e_place_algorithm place_algorithm, const PlaceDelayModel* delay_model, double & bb_delta_c, double & timing_delta_c) {
1879
1881
VTR_ASSERT_SAFE (bb_delta_c == 0 .);
1880
1882
VTR_ASSERT_SAFE (timing_delta_c == 0 .);
1881
1883
auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -1962,7 +1964,7 @@ static void update_net_bb(const ClusterNetId net, int iblk, const ClusterBlockId
1962
1964
}
1963
1965
}
1964
1966
1965
- static void update_td_delta_costs (const PlaceDelayModel& delay_model, const ClusterNetId net, const ClusterPinId pin, double & delta_timing_cost) {
1967
+ static void update_td_delta_costs (const PlaceDelayModel* delay_model, const ClusterNetId net, const ClusterPinId pin, double & delta_timing_cost) {
1966
1968
auto & cluster_ctx = g_vpr_ctx.clustering ();
1967
1969
1968
1970
if (cluster_ctx.clb_nlist .pin_type (pin) == PinType::DRIVER) {
@@ -2168,7 +2170,7 @@ static double recompute_bb_cost() {
2168
2170
}
2169
2171
2170
2172
/* returns the delay of one point to point connection */
2171
- static float comp_td_point_to_point_delay (const PlaceDelayModel& delay_model, ClusterNetId net_id, int ipin) {
2173
+ static float comp_td_point_to_point_delay (const PlaceDelayModel* delay_model, ClusterNetId net_id, int ipin) {
2172
2174
auto & cluster_ctx = g_vpr_ctx.clustering ();
2173
2175
auto & place_ctx = g_vpr_ctx.placement ();
2174
2176
@@ -2198,12 +2200,12 @@ static float comp_td_point_to_point_delay(const PlaceDelayModel& delay_model, Cl
2198
2200
* In particular this aproach does not accurately capture the effect of fast
2199
2201
* carry-chain connections.
2200
2202
*/
2201
- delay_source_to_sink = delay_model. delay (source_x,
2202
- source_y,
2203
- source_block_ipin,
2204
- sink_x,
2205
- sink_y,
2206
- sink_block_ipin);
2203
+ delay_source_to_sink = delay_model-> delay (source_x,
2204
+ source_y,
2205
+ source_block_ipin,
2206
+ sink_x,
2207
+ sink_y,
2208
+ sink_block_ipin);
2207
2209
if (delay_source_to_sink < 0 ) {
2208
2210
VPR_ERROR (VPR_ERROR_PLACE,
2209
2211
" in comp_td_point_to_point_delay: Bad delay_source_to_sink value %g from %s (at %d,%d) to %s (at %d,%d)\n "
@@ -2220,7 +2222,7 @@ static float comp_td_point_to_point_delay(const PlaceDelayModel& delay_model, Cl
2220
2222
}
2221
2223
2222
2224
// Recompute all point to point delays, updating point_to_point_delay
2223
- static void comp_td_point_to_point_delays (const PlaceDelayModel& delay_model) {
2225
+ static void comp_td_point_to_point_delays (const PlaceDelayModel* delay_model) {
2224
2226
auto & cluster_ctx = g_vpr_ctx.clustering ();
2225
2227
2226
2228
for (auto net_id : cluster_ctx.clb_nlist .nets ()) {
@@ -2283,7 +2285,7 @@ static bool driven_by_moved_block(const ClusterNetId net) {
2283
2285
return false ;
2284
2286
}
2285
2287
2286
- static void comp_td_costs (const PlaceDelayModel& delay_model, double * timing_cost) {
2288
+ static void comp_td_costs (const PlaceDelayModel* delay_model, double * timing_cost) {
2287
2289
/* Computes the cost (from scratch) from the delays and criticalities *
2288
2290
* of all point to point connections, we define the timing cost of *
2289
2291
* each connection as criticality*delay. */
@@ -3461,7 +3463,7 @@ static void alloc_and_load_for_fast_cost_update(float place_cost_exp) {
3461
3463
}
3462
3464
3463
3465
static void check_place (const t_placer_costs& costs,
3464
- const PlaceDelayModel& delay_model,
3466
+ const PlaceDelayModel* delay_model,
3465
3467
enum e_place_algorithm place_algorithm) {
3466
3468
/* Checks that the placement has not confused our data structures. *
3467
3469
* i.e. the clb and block structures agree about the locations of *
@@ -3487,7 +3489,7 @@ static void check_place(const t_placer_costs& costs,
3487
3489
}
3488
3490
3489
3491
static int check_placement_costs (const t_placer_costs& costs,
3490
- const PlaceDelayModel& delay_model,
3492
+ const PlaceDelayModel* delay_model,
3491
3493
enum e_place_algorithm place_algorithm) {
3492
3494
int error = 0 ;
3493
3495
double bb_cost_check;
0 commit comments