vpr/src/place/place.cpp
/* Function which contains the inner loop of the simulated annealing */
Function which contains the inner loop of the simulated annealing
Function which contains the inner loop of the simulated annealing
static void placement_inner_loop(float t,
                                 float rlim,
                                 const t_placer_opts& placer_opts,
                                 int move_lim,
                                 float crit_exponent,
                                 int inner_recompute_limit,
                                 t_placer_statistics* stats,
                                 t_placer_costs* costs,
                                 t_placer_prev_inverse_costs* prev_inverse_costs,
                                 int* moves_since_cost_recompute,
                                 const ClusteredPinAtomPinsLookup& netlist_pin_lookup,
                                 const PlaceDelayModel* delay_model,
                                 MoveGenerator& move_generator,
                                 t_pl_blocks_to_be_moved& blocks_affected,
                                 SetupTimingInfo& timing_info) {
    int inner_crit_iter_count, inner_iter;
    stats->av_cost = 0.;
    stats->av_bb_cost = 0.;
    stats->av_timing_cost = 0.;
    stats->sum_of_squares = 0.;
    stats->success_sum = 0;
    inner_crit_iter_count = 1;
    for (inner_iter = 0; inner_iter < move_lim; inner_iter++) {
        e_move_result swap_result = try_swap(t, costs, prev_inverse_costs, rlim,
                                             move_generator,
                                             blocks_affected,
                                             delay_model,
                                             placer_opts.rlim_escape_fraction,
                                             placer_opts.place_algorithm,
                                             placer_opts.timing_tradeoff);
        if (swap_result == ACCEPTED) {
            stats->success_sum++;
            stats->av_cost += costs->cost;
            stats->av_bb_cost += costs->bb_cost;
            stats->av_timing_cost += costs->timing_cost;
            stats->sum_of_squares += (costs->cost) * (costs->cost);
            num_swap_accepted++;
        } else if (swap_result == ABORTED) {
            num_swap_aborted++;
        } else { 
            num_swap_rejected++;
        }
        if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE) {
            if (inner_crit_iter_count >= inner_recompute_limit
                && inner_iter != move_lim - 1) { 
                inner_crit_iter_count = 0;
#ifdef VERBOSE
                VTR_LOG("Inner loop recompute criticalities\n");
#endif
                timing_info.update();
                load_criticalities(timing_info, crit_exponent, netlist_pin_lookup);
                comp_td_costs(delay_model, &costs->timing_cost);
            }
            inner_crit_iter_count++;
        }
#ifdef VERBOSE
        VTR_LOG("t = %g  cost = %g   bb_cost = %g timing_cost = %g move = %d\n",
                t, costs->cost, costs->bb_cost, costs->timing_cost, inner_iter);
        if (fabs((costs->bb_cost) - comp_bb_cost(CHECK)) > (costs->bb_cost) * ERROR_TOL)
            VPR_ERROR(VPR_ERROR_PLACE,
                      "fabs((*bb_cost) - comp_bb_cost(CHECK)) > (*bb_cost) * ERROR_TOL");
#endif
        ++(*moves_since_cost_recompute);
        if (*moves_since_cost_recompute > MAX_MOVES_BEFORE_RECOMPUTE) {
            recompute_costs_from_scratch(placer_opts, delay_model, costs);
            *moves_since_cost_recompute = 0;
        }
    }
}
static void placement_inner_loop ( float t , float rlim , const t_placer_opts & placer_opts , int move_lim , float crit_exponent , int inner_recompute_limit , t_placer_statistics * stats , t_placer_costs * costs , t_placer_prev_inverse_costs * prev_inverse_costs , int * moves_since_cost_recompute , const ClusteredPinAtomPinsLookup & netlist_pin_lookup , const PlaceDelayModel * delay_model , MoveGenerator & move_generator , t_pl_blocks_to_be_moved & blocks_affected , SetupTimingInfo & timing_info ) { int inner_crit_iter_count , inner_iter ; stats -> av_cost = 0. ; stats -> av_bb_cost = 0. ; stats -> av_timing_cost = 0. ; stats -> sum_of_squares = 0. ; stats -> success_sum = 0 ; inner_crit_iter_count = 1 ; for ( inner_iter = 0 ; inner_iter < move_lim ; inner_iter ++ ) { e_move_result swap_result = try_swap ( t , costs , prev_inverse_costs , rlim , move_generator , blocks_affected , delay_model , placer_opts . rlim_escape_fraction , placer_opts . place_algorithm , placer_opts . timing_tradeoff ) ; if ( swap_result == ACCEPTED ) { stats -> success_sum ++ ; stats -> av_cost += costs -> cost ; stats -> av_bb_cost += costs -> bb_cost ; stats -> av_timing_cost += costs -> timing_cost ; stats -> sum_of_squares += ( costs -> cost ) * ( costs -> cost ) ; num_swap_accepted ++ ; } else if ( swap_result == ABORTED ) { num_swap_aborted ++ ; } else { num_swap_rejected ++ ; } if ( placer_opts . place_algorithm == PATH_TIMING_DRIVEN_PLACE ) { if ( inner_crit_iter_count >= inner_recompute_limit && inner_iter != move_lim - 1 ) { inner_crit_iter_count = 0 ; #ifdef VERBOSE VTR_LOG ( " \n " ) ; #endif timing_info . update ( ) ; load_criticalities ( timing_info , crit_exponent , netlist_pin_lookup ) ; comp_td_costs ( delay_model , & costs -> timing_cost ) ; } inner_crit_iter_count ++ ; } #ifdef VERBOSE VTR_LOG ( " \n " , t , costs -> cost , costs -> bb_cost , costs -> timing_cost , inner_iter ) ; if ( fabs ( ( costs -> bb_cost ) - comp_bb_cost ( CHECK ) ) > ( costs -> bb_cost ) * ERROR_TOL ) VPR_ERROR ( VPR_ERROR_PLACE , " " ) ; #endif ++ ( * moves_since_cost_recompute ) ; if ( * moves_since_cost_recompute > MAX_MOVES_BEFORE_RECOMPUTE ) { recompute_costs_from_scratch ( placer_opts , delay_model , costs ) ; * moves_since_cost_recompute = 0 ; } } }
Function which contains the inner loop of the simulated annealing
Function which contains the inner loop of the simulated annealing
/* Inner loop begins */ /* Move was accepted.  Update statistics that are useful for the annealing schedule. */ // swap_result == REJECTED /* Do we want to re-timing analyze the circuit to get updated slack and criticality values?
             * We do this only once in a while, since it is expensive.
             */ /*on last iteration don't recompute */ /* Using the delays in net_delay, do a timing analysis to update slacks and
                 * criticalities; then update the timing cost since it will change.
                 */ //Inner loop timing update /* Lines below prevent too much round-off error from accumulating
         * in the cost over many iterations (due to incremental updates).
         * This round-off can lead to  error checks failing because the cost
         * is different from what you get when you recompute from scratch.
         */ /* Inner loop ends */