@@ -543,8 +543,7 @@ static void print_resources_utilization();
543543
544544static void print_placement_swaps_stats (const t_annealing_state& state);
545545
546- static void print_placement_move_types_stats (
547- const MoveTypeStat& move_type_stat);
546+ static void print_placement_move_types_stats (const MoveTypeStat& move_type_stat);
548547
549548/* ****************************************************************************/
550549void try_place (const Netlist<>& net_list,
@@ -936,9 +935,9 @@ void try_place(const Netlist<>& net_list,
936935
937936 // allocate move type statistics vectors
938937 MoveTypeStat move_type_stat;
939- move_type_stat.blk_type_moves .resize (device_ctx.logical_block_types .size () * (int )e_move_type::NUMBER_OF_AUTO_MOVES, 0 );
940- move_type_stat.accepted_moves .resize (device_ctx.logical_block_types .size () * (int )e_move_type::NUMBER_OF_AUTO_MOVES, 0 );
941- move_type_stat.rejected_moves .resize (device_ctx.logical_block_types .size () * (int )e_move_type::NUMBER_OF_AUTO_MOVES, 0 );
938+ move_type_stat.blk_type_moves .resize ({ device_ctx.logical_block_types .size (), (int )e_move_type::NUMBER_OF_AUTO_MOVES} , 0 );
939+ move_type_stat.accepted_moves .resize ({ device_ctx.logical_block_types .size (), (int )e_move_type::NUMBER_OF_AUTO_MOVES} , 0 );
940+ move_type_stat.rejected_moves .resize ({ device_ctx.logical_block_types .size (), (int )e_move_type::NUMBER_OF_AUTO_MOVES} , 0 );
942941
943942 /* Get the first range limiter */
944943 first_rlim = (float )max (device_ctx.grid .width () - 1 ,
@@ -1725,7 +1724,7 @@ static e_move_result try_swap(const t_annealing_state* state,
17251724 }
17261725
17271726 if (proposed_action.logical_blk_type_index != -1 ) { // if the agent proposed the block type, then collect the block type stat
1728- ++move_type_stat.blk_type_moves [( proposed_action.logical_blk_type_index * ( int )e_move_type::NUMBER_OF_AUTO_MOVES) + (int )proposed_action.move_type ];
1727+ ++move_type_stat.blk_type_moves [proposed_action.logical_blk_type_index ][ (int )proposed_action.move_type ];
17291728 }
17301729 LOG_MOVE_STATS_PROPOSED (t, blocks_affected);
17311730
@@ -1876,7 +1875,7 @@ static e_move_result try_swap(const t_annealing_state* state,
18761875 commit_move_blocks (blocks_affected);
18771876
18781877 if (proposed_action.logical_blk_type_index != -1 ) { // if the agent proposed the block type, then collect the block type stat
1879- ++move_type_stat.accepted_moves [( proposed_action.logical_blk_type_index * ( int )e_move_type::NUMBER_OF_AUTO_MOVES) + (int )proposed_action.move_type ];
1878+ ++move_type_stat.accepted_moves [proposed_action.logical_blk_type_index ][ (int )proposed_action.move_type ];
18801879 }
18811880 if (noc_opts.noc ) {
18821881 commit_noc_costs ();
@@ -1927,7 +1926,7 @@ static e_move_result try_swap(const t_annealing_state* state,
19271926 }
19281927
19291928 if (proposed_action.logical_blk_type_index != -1 ) { // if the agent proposed the block type, then collect the block type stat
1930- ++move_type_stat.rejected_moves [( proposed_action.logical_blk_type_index * ( int )e_move_type::NUMBER_OF_AUTO_MOVES) + (int )proposed_action.move_type ];
1929+ ++move_type_stat.rejected_moves [proposed_action.logical_blk_type_index ][ (int )proposed_action.move_type ];
19311930 }
19321931 /* Revert the traffic flow routes within the NoC*/
19331932 if (noc_opts.noc ) {
@@ -4350,10 +4349,7 @@ static void print_placement_swaps_stats(const t_annealing_state& state) {
43504349 num_swap_aborted, 100 * abort_rate);
43514350}
43524351
4353- static void print_placement_move_types_stats (
4354- const MoveTypeStat& move_type_stat) {
4355- float moves, accepted, rejected, aborted;
4356-
4352+ static void print_placement_move_types_stats (const MoveTypeStat& move_type_stat) {
43574353 VTR_LOG (" \n\n Placement perturbation distribution by block and move type: \n " );
43584354
43594355 VTR_LOG (
@@ -4363,11 +4359,12 @@ static void print_placement_move_types_stats(
43634359 VTR_LOG (
43644360 " ------------------ ----------------- ---------------- ---------------- --------------- ------------ \n " );
43654361
4366- float total_moves = 0 ;
4367- for (int blk_type_move : move_type_stat.blk_type_moves ) {
4368- total_moves += blk_type_move ;
4362+ int total_moves = 0 ;
4363+ for (size_t i = 0 ; i < move_type_stat.blk_type_moves . size (); ++i ) {
4364+ total_moves += move_type_stat. blk_type_moves . get (i) ;
43694365 }
43704366
4367+
43714368 auto & device_ctx = g_vpr_ctx.device ();
43724369 auto & cluster_ctx = g_vpr_ctx.clustering ();
43734370 int count = 0 ;
@@ -4381,24 +4378,23 @@ static void print_placement_move_types_stats(
43814378 }
43824379
43834380 count = 0 ;
4384-
43854381 for (int imove = 0 ; imove < num_of_avail_moves; imove++) {
43864382 const auto & move_name = move_type_to_string (e_move_type (imove));
4387- moves = move_type_stat.blk_type_moves [itype.index * num_of_avail_moves + imove];
4383+ int moves = move_type_stat.blk_type_moves [itype.index ][ imove];
43884384 if (moves != 0 ) {
4389- accepted = move_type_stat.accepted_moves [itype.index * num_of_avail_moves + imove];
4390- rejected = move_type_stat.rejected_moves [itype.index * num_of_avail_moves + imove];
4391- aborted = moves - (accepted + rejected);
4385+ int accepted = move_type_stat.accepted_moves [itype.index ][ imove];
4386+ int rejected = move_type_stat.rejected_moves [itype.index ][ imove];
4387+ int aborted = moves - (accepted + rejected);
43924388 if (count == 0 ) {
43934389 VTR_LOG (" %-18.20s" , itype.name );
43944390 } else {
43954391 VTR_LOG (" " );
43964392 }
43974393 VTR_LOG (
43984394 " %-22.20s %-16.2f %-15.2f %-14.2f %-13.2f\n " ,
4399- move_name.c_str (), 100 * moves / total_moves,
4400- 100 * accepted / moves, 100 * rejected / moves,
4401- 100 * aborted / moves);
4395+ move_name.c_str (), 100 . 0f * ( float ) moves / ( float ) total_moves,
4396+ 100 . 0f * ( float ) accepted / ( float ) moves, 100 . 0f * ( float ) rejected / ( float ) moves,
4397+ 100 . 0f * ( float ) aborted / ( float ) moves);
44024398 }
44034399 count++;
44044400 }
0 commit comments