@@ -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 ) {
@@ -4352,10 +4351,7 @@ static void print_placement_swaps_stats(const t_annealing_state& state) {
43524351 num_swap_aborted, 100 * abort_rate);
43534352}
43544353
4355- static void print_placement_move_types_stats (
4356- const MoveTypeStat& move_type_stat) {
4357- float moves, accepted, rejected, aborted;
4358-
4354+ static void print_placement_move_types_stats (const MoveTypeStat& move_type_stat) {
43594355 VTR_LOG (" \n\n Placement perturbation distribution by block and move type: \n " );
43604356
43614357 VTR_LOG (
@@ -4365,11 +4361,12 @@ static void print_placement_move_types_stats(
43654361 VTR_LOG (
43664362 " ------------------ ----------------- ---------------- ---------------- --------------- ------------ \n " );
43674363
4368- float total_moves = 0 ;
4369- for (int blk_type_move : move_type_stat.blk_type_moves ) {
4370- total_moves += blk_type_move ;
4364+ int total_moves = 0 ;
4365+ for (size_t i = 0 ; i < move_type_stat.blk_type_moves . size (); ++i ) {
4366+ total_moves += move_type_stat. blk_type_moves . get (i) ;
43714367 }
43724368
4369+
43734370 auto & device_ctx = g_vpr_ctx.device ();
43744371 auto & cluster_ctx = g_vpr_ctx.clustering ();
43754372 int count = 0 ;
@@ -4383,24 +4380,23 @@ static void print_placement_move_types_stats(
43834380 }
43844381
43854382 count = 0 ;
4386-
43874383 for (int imove = 0 ; imove < num_of_avail_moves; imove++) {
43884384 const auto & move_name = move_type_to_string (e_move_type (imove));
4389- moves = move_type_stat.blk_type_moves [itype.index * num_of_avail_moves + imove];
4385+ int moves = move_type_stat.blk_type_moves [itype.index ][ imove];
43904386 if (moves != 0 ) {
4391- accepted = move_type_stat.accepted_moves [itype.index * num_of_avail_moves + imove];
4392- rejected = move_type_stat.rejected_moves [itype.index * num_of_avail_moves + imove];
4393- aborted = moves - (accepted + rejected);
4387+ int accepted = move_type_stat.accepted_moves [itype.index ][ imove];
4388+ int rejected = move_type_stat.rejected_moves [itype.index ][ imove];
4389+ int aborted = moves - (accepted + rejected);
43944390 if (count == 0 ) {
43954391 VTR_LOG (" %-18.20s" , itype.name );
43964392 } else {
43974393 VTR_LOG (" " );
43984394 }
43994395 VTR_LOG (
44004396 " %-22.20s %-16.2f %-15.2f %-14.2f %-13.2f\n " ,
4401- move_name.c_str (), 100 * moves / total_moves,
4402- 100 * accepted / moves, 100 * rejected / moves,
4403- 100 * aborted / moves);
4397+ move_name.c_str (), 100 . 0f * ( float ) moves / ( float ) total_moves,
4398+ 100 . 0f * ( float ) accepted / ( float ) moves, 100 . 0f * ( float ) rejected / ( float ) moves,
4399+ 100 . 0f * ( float ) aborted / ( float ) moves);
44044400 }
44054401 count++;
44064402 }
0 commit comments