@@ -543,8 +543,7 @@ static void print_resources_utilization();
543
543
544
544
static void print_placement_swaps_stats (const t_annealing_state& state);
545
545
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);
548
547
549
548
/* ****************************************************************************/
550
549
void try_place (const Netlist<>& net_list,
@@ -936,9 +935,9 @@ void try_place(const Netlist<>& net_list,
936
935
937
936
// allocate move type statistics vectors
938
937
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 );
942
941
943
942
/* Get the first range limiter */
944
943
first_rlim = (float )max (device_ctx.grid .width () - 1 ,
@@ -1725,7 +1724,7 @@ static e_move_result try_swap(const t_annealing_state* state,
1725
1724
}
1726
1725
1727
1726
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 ];
1729
1728
}
1730
1729
LOG_MOVE_STATS_PROPOSED (t, blocks_affected);
1731
1730
@@ -1876,7 +1875,7 @@ static e_move_result try_swap(const t_annealing_state* state,
1876
1875
commit_move_blocks (blocks_affected);
1877
1876
1878
1877
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 ];
1880
1879
}
1881
1880
if (noc_opts.noc ) {
1882
1881
commit_noc_costs ();
@@ -1927,7 +1926,7 @@ static e_move_result try_swap(const t_annealing_state* state,
1927
1926
}
1928
1927
1929
1928
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 ];
1931
1930
}
1932
1931
/* Revert the traffic flow routes within the NoC*/
1933
1932
if (noc_opts.noc ) {
@@ -4350,10 +4349,7 @@ static void print_placement_swaps_stats(const t_annealing_state& state) {
4350
4349
num_swap_aborted, 100 * abort_rate);
4351
4350
}
4352
4351
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) {
4357
4353
VTR_LOG (" \n\n Placement perturbation distribution by block and move type: \n " );
4358
4354
4359
4355
VTR_LOG (
@@ -4363,11 +4359,12 @@ static void print_placement_move_types_stats(
4363
4359
VTR_LOG (
4364
4360
" ------------------ ----------------- ---------------- ---------------- --------------- ------------ \n " );
4365
4361
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) ;
4369
4365
}
4370
4366
4367
+
4371
4368
auto & device_ctx = g_vpr_ctx.device ();
4372
4369
auto & cluster_ctx = g_vpr_ctx.clustering ();
4373
4370
int count = 0 ;
@@ -4381,24 +4378,23 @@ static void print_placement_move_types_stats(
4381
4378
}
4382
4379
4383
4380
count = 0 ;
4384
-
4385
4381
for (int imove = 0 ; imove < num_of_avail_moves; imove++) {
4386
4382
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];
4388
4384
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);
4392
4388
if (count == 0 ) {
4393
4389
VTR_LOG (" %-18.20s" , itype.name );
4394
4390
} else {
4395
4391
VTR_LOG (" " );
4396
4392
}
4397
4393
VTR_LOG (
4398
4394
" %-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);
4402
4398
}
4403
4399
count++;
4404
4400
}
0 commit comments