@@ -327,19 +327,19 @@ static e_swap_result try_swap(float t,
327327 t_placer_costs* costs,
328328 t_placer_prev_inverse_costs* prev_inverse_costs,
329329 float rlim,
330- const PlaceDelayModel& delay_model,
330+ const PlaceDelayModel* delay_model,
331331 float rlim_escape_fraction,
332332 enum e_place_algorithm place_algorithm,
333333 float timing_tradeoff);
334334
335335static ClusterBlockId pick_from_block ();
336336
337337static void check_place (const t_placer_costs& costs,
338- const PlaceDelayModel& delay_model,
338+ const PlaceDelayModel* delay_model,
339339 enum e_place_algorithm place_algorithm);
340340
341341static int check_placement_costs (const t_placer_costs& costs,
342- const PlaceDelayModel& delay_model,
342+ const PlaceDelayModel* delay_model,
343343 enum e_place_algorithm place_algorithm);
344344static int check_placement_consistency ();
345345static int check_block_placement_consistency ();
@@ -350,7 +350,7 @@ static float starting_t(t_placer_costs* costs,
350350 t_annealing_sched annealing_sched,
351351 int max_moves,
352352 float rlim,
353- const PlaceDelayModel& delay_model,
353+ const PlaceDelayModel* delay_model,
354354 const t_placer_opts& placer_opts);
355355
356356static 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);
365365
366366static double recompute_bb_cost ();
367367
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);
369369
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);
371371
372372static void update_td_cost ();
373373
374374static bool driven_by_moved_block (const ClusterNetId net);
375375
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);
377377
378378static e_swap_result assess_swap (double delta_c, double t);
379379
@@ -383,12 +383,12 @@ static void get_non_updateable_bb(ClusterNetId net_id, t_bb* bb_coord_new);
383383
384384static void update_bb (ClusterNetId net_id, t_bb* bb_coord_new, t_bb* bb_edge_new, int xold, int yold, int xnew, int ynew);
385385
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);
387387
388388static void record_affected_net (const ClusterNetId net, int & num_affected_nets);
389389
390390static 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);
392392
393393static double get_net_cost (ClusterNetId net_id, t_bb* bb_ptr);
394394
@@ -405,7 +405,7 @@ static void outer_loop_recompute_criticalities(const t_placer_opts& placer_opts,
405405 float crit_exponent,
406406 int * outer_crit_iter_count,
407407 const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
408- const PlaceDelayModel& delay_model,
408+ const PlaceDelayModel* delay_model,
409409 SetupTimingInfo& timing_info);
410410
411411static void placement_inner_loop (float t,
@@ -419,10 +419,10 @@ static void placement_inner_loop(float t,
419419 t_placer_prev_inverse_costs* prev_inverse_costs,
420420 int * moves_since_cost_recompute,
421421 const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
422- const PlaceDelayModel& delay_model,
422+ const PlaceDelayModel* delay_model,
423423 SetupTimingInfo& timing_info);
424424
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);
426426
427427static void calc_placer_stats (t_placer_statistics& stats, float & success_rat, double & std_dev, const t_placer_costs& costs, const int move_lim);
428428
@@ -485,7 +485,8 @@ void try_place(const t_placer_opts& placer_opts,
485485
486486 std::shared_ptr<SetupTimingInfo> timing_info;
487487 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 ;
489490
490491 /* Allocated here because it goes into timing critical code where each memory allocation is expensive */
491492 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,
499500 if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE
500501 || placer_opts.enable_timing_computations ) {
501502 /* 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 ();
503505
504506 if (isEchoFileEnabled (E_ECHO_PLACEMENT_DELTA_DELAY_MODEL)) {
505507 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,
532534 VTR_LOG (" \n " );
533535
534536 // 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);
536538
537539 /*
538540 * Initialize timing analysis
@@ -560,7 +562,7 @@ void try_place(const t_placer_opts& placer_opts,
560562 }
561563
562564 /* 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 */
564566
565567 outer_crit_iter_count = 1 ;
566568
@@ -581,7 +583,7 @@ void try_place(const t_placer_opts& placer_opts,
581583 }
582584
583585 // 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 );
585587
586588 // Initial pacement statistics
587589 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,
638640
639641 t = starting_t (&costs, &prev_inverse_costs,
640642 annealing_sched, move_lim, rlim,
641- * place_delay_model,
643+ place_delay_model,
642644 placer_opts);
643645
644646 tot_iter = 0 ;
@@ -655,7 +657,7 @@ void try_place(const t_placer_opts& placer_opts,
655657 crit_exponent,
656658 &outer_crit_iter_count,
657659 netlist_pin_lookup,
658- * place_delay_model,
660+ place_delay_model,
659661 *timing_info);
660662
661663 placement_inner_loop (t, rlim, placer_opts,
@@ -664,7 +666,7 @@ void try_place(const t_placer_opts& placer_opts,
664666 &prev_inverse_costs,
665667 &moves_since_cost_recompute,
666668 netlist_pin_lookup,
667- * place_delay_model,
669+ place_delay_model,
668670 *timing_info);
669671
670672 tot_iter += move_lim;
@@ -709,7 +711,7 @@ void try_place(const t_placer_opts& placer_opts,
709711 crit_exponent,
710712 &outer_crit_iter_count,
711713 netlist_pin_lookup,
712- * place_delay_model,
714+ place_delay_model,
713715 *timing_info);
714716
715717 t = 0 ; /* freeze out */
@@ -722,7 +724,7 @@ void try_place(const t_placer_opts& placer_opts,
722724 &prev_inverse_costs,
723725 &moves_since_cost_recompute,
724726 netlist_pin_lookup,
725- * place_delay_model,
727+ place_delay_model,
726728 *timing_info);
727729
728730 tot_iter += move_lim;
@@ -747,7 +749,7 @@ void try_place(const t_placer_opts& placer_opts,
747749 }
748750#endif
749751
750- check_place (costs, * place_delay_model, placer_opts.place_algorithm );
752+ check_place (costs, place_delay_model, placer_opts.place_algorithm );
751753
752754 // Some stats
753755 VTR_LOG (" \n " );
@@ -761,7 +763,7 @@ void try_place(const t_placer_opts& placer_opts,
761763 for (size_t ipin = 1 ; ipin < cluster_ctx.clb_nlist .net_pins (net_id).size (); ipin++)
762764 set_timing_place_crit (net_id, ipin, 0 ); /* dummy crit values */
763765 }
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 */
765767 }
766768
767769 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,
838840 float crit_exponent,
839841 int * outer_crit_iter_count,
840842 const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
841- const PlaceDelayModel& delay_model,
843+ const PlaceDelayModel* delay_model,
842844 SetupTimingInfo& timing_info) {
843845 if (placer_opts.place_algorithm != PATH_TIMING_DRIVEN_PLACE)
844846 return ;
@@ -882,7 +884,7 @@ static void placement_inner_loop(float t,
882884 t_placer_prev_inverse_costs* prev_inverse_costs,
883885 int * moves_since_cost_recompute,
884886 const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
885- const PlaceDelayModel& delay_model,
887+ const PlaceDelayModel* delay_model,
886888 SetupTimingInfo& timing_info) {
887889 int inner_crit_iter_count, inner_iter;
888890
@@ -960,7 +962,7 @@ static void placement_inner_loop(float t,
960962 /* Inner loop ends */
961963}
962964
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) {
964966 double new_bb_cost = recompute_bb_cost ();
965967 if (fabs (new_bb_cost - costs->bb_cost ) > costs->bb_cost * ERROR_TOL) {
966968 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,
10831085 t_annealing_sched annealing_sched,
10841086 int max_moves,
10851087 float rlim,
1086- const PlaceDelayModel& delay_model,
1088+ const PlaceDelayModel* delay_model,
10871089 const t_placer_opts& placer_opts) {
10881090 /* Finds the starting temperature (hot condition). */
10891091
@@ -1699,7 +1701,7 @@ static e_swap_result try_swap(float t,
16991701 t_placer_costs* costs,
17001702 t_placer_prev_inverse_costs* prev_inverse_costs,
17011703 float rlim,
1702- const PlaceDelayModel& delay_model,
1704+ const PlaceDelayModel* delay_model,
17031705 float rlim_escape_fraction,
17041706 enum e_place_algorithm place_algorithm,
17051707 float timing_tradeoff) {
@@ -1875,7 +1877,7 @@ static ClusterBlockId pick_from_block() {
18751877// and updates their bounding box.
18761878//
18771879// 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) {
18791881 VTR_ASSERT_SAFE (bb_delta_c == 0 .);
18801882 VTR_ASSERT_SAFE (timing_delta_c == 0 .);
18811883 auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -1962,7 +1964,7 @@ static void update_net_bb(const ClusterNetId net, int iblk, const ClusterBlockId
19621964 }
19631965}
19641966
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) {
19661968 auto & cluster_ctx = g_vpr_ctx.clustering ();
19671969
19681970 if (cluster_ctx.clb_nlist .pin_type (pin) == PinType::DRIVER) {
@@ -2168,7 +2170,7 @@ static double recompute_bb_cost() {
21682170}
21692171
21702172/* 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) {
21722174 auto & cluster_ctx = g_vpr_ctx.clustering ();
21732175 auto & place_ctx = g_vpr_ctx.placement ();
21742176
@@ -2198,12 +2200,12 @@ static float comp_td_point_to_point_delay(const PlaceDelayModel& delay_model, Cl
21982200 * In particular this aproach does not accurately capture the effect of fast
21992201 * carry-chain connections.
22002202 */
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);
22072209 if (delay_source_to_sink < 0 ) {
22082210 VPR_ERROR (VPR_ERROR_PLACE,
22092211 " 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
22202222}
22212223
22222224// 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) {
22242226 auto & cluster_ctx = g_vpr_ctx.clustering ();
22252227
22262228 for (auto net_id : cluster_ctx.clb_nlist .nets ()) {
@@ -2283,7 +2285,7 @@ static bool driven_by_moved_block(const ClusterNetId net) {
22832285 return false ;
22842286}
22852287
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) {
22872289 /* Computes the cost (from scratch) from the delays and criticalities *
22882290 * of all point to point connections, we define the timing cost of *
22892291 * each connection as criticality*delay. */
@@ -3461,7 +3463,7 @@ static void alloc_and_load_for_fast_cost_update(float place_cost_exp) {
34613463}
34623464
34633465static void check_place (const t_placer_costs& costs,
3464- const PlaceDelayModel& delay_model,
3466+ const PlaceDelayModel* delay_model,
34653467 enum e_place_algorithm place_algorithm) {
34663468 /* Checks that the placement has not confused our data structures. *
34673469 * 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,
34873489}
34883490
34893491static int check_placement_costs (const t_placer_costs& costs,
3490- const PlaceDelayModel& delay_model,
3492+ const PlaceDelayModel* delay_model,
34913493 enum e_place_algorithm place_algorithm) {
34923494 int error = 0 ;
34933495 double bb_cost_check;
0 commit comments