Skip to content

Commit 2ca711e

Browse files
authored
Merge pull request #2311 from verilog-to-routing/placer_statistics
Placement move type and block type print information
2 parents 188cfb5 + 282418f commit 2ca711e

File tree

4 files changed

+4
-95
lines changed

4 files changed

+4
-95
lines changed

vpr/src/place/RL_agent_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#include "manual_move_generator.h"
33

44
void create_move_generators(std::unique_ptr<MoveGenerator>& move_generator, std::unique_ptr<MoveGenerator>& move_generator2, const t_placer_opts& placer_opts, int move_lim) {
5+
//extract available physical block types in the netlist
6+
determine_agent_block_types();
7+
58
if (placer_opts.RL_agent_placement == false) {
69
if (placer_opts.place_algorithm.is_timing_driven()) {
710
VTR_LOG("Using static probabilities for choosing each move type\n");
@@ -42,9 +45,6 @@ void create_move_generators(std::unique_ptr<MoveGenerator>& move_generator, std:
4245
* only move type. *
4346
* This state is activated late in the anneal and in the Quench */
4447

45-
//extract available physical block types in the netlist
46-
determine_agent_block_types();
47-
4848
auto& place_ctx = g_vpr_ctx.placement();
4949
int num_1st_state_avail_moves = placer_opts.place_algorithm.is_timing_driven() ? NUM_PL_1ST_STATE_MOVE_TYPES : NUM_PL_NONTIMING_MOVE_TYPES;
5050
int num_2nd_state_avail_moves = placer_opts.place_algorithm.is_timing_driven() ? NUM_PL_MOVE_TYPES : NUM_PL_NONTIMING_MOVE_TYPES;

vpr/src/place/noc_place_utils.cpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ static vtr::vector<NocTrafficFlowId, double> traffic_flow_aggregate_bandwidth_co
1010
static std::vector<NocTrafficFlowId> affected_traffic_flows;
1111
/*********************************************************** *****************************/
1212

13-
/*********** NoC Placement Stats ***********/
14-
static NocPlaceStats noc_place_stats;
15-
/*******************************************/
16-
1713
void initial_noc_placement(void) {
1814
// need to get placement information about where the router cluster blocks are palced on the device
1915
const auto& place_ctx = g_vpr_ctx.placement();
@@ -545,46 +541,6 @@ e_create_move propose_router_swap(t_pl_blocks_to_be_moved& blocks_affected, floa
545541
return create_move;
546542
}
547543

548-
/* Below are functions related to modifying and printing the NoC placement
549-
* statistical data */
550-
void initialize_noc_placement_stats(const t_placer_opts& placer_opts) {
551-
// initially there are no router blocks moved
552-
noc_place_stats.number_of_noc_router_moves = 0;
553-
554-
// allocate the space to keep track of how many of each move type caused a router block to move
555-
noc_place_stats.number_of_noc_router_moves_per_move_type.resize(placer_opts.place_static_move_prob.size() + 1, 0);
556-
557-
return;
558-
}
559-
560-
void update_noc_placement_stats(int move_type) {
561-
noc_place_stats.number_of_noc_router_moves++;
562-
noc_place_stats.number_of_noc_router_moves_per_move_type[move_type]++;
563-
564-
return;
565-
}
566-
567-
void print_noc_placement_stats(void) {
568-
float moves;
569-
std::string move_name;
570-
571-
VTR_LOG("\n\nTotal number of NoC router block moves: %d\n", noc_place_stats.number_of_noc_router_moves);
572-
VTR_LOG("\nPercentage of different move types that cause NoC router block moves:\n");
573-
574-
for (size_t i = 0; i < noc_place_stats.number_of_noc_router_moves_per_move_type.size(); i++) {
575-
moves = noc_place_stats.number_of_noc_router_moves_per_move_type[i];
576-
if (moves != 0) {
577-
move_name = move_type_to_string(e_move_type(i));
578-
VTR_LOG(
579-
"\t%.17s move: %2.2f %%\n",
580-
move_name.c_str(), 100 * moves / noc_place_stats.number_of_noc_router_moves);
581-
}
582-
}
583-
VTR_LOG("\n");
584-
585-
return;
586-
}
587-
588544
void write_noc_placement_file(std::string file_name) {
589545
// we need the clustered netlist to get the names of all the NoC router cluster blocks
590546
auto& cluster_ctx = g_vpr_ctx.clustering();

vpr/src/place/noc_place_utils.h

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ constexpr double MAX_INV_NOC_LATENCY_COST = 1.e12;
2424
// So this value represents the lowest possible latency cost.
2525
constexpr double MIN_EXPECTED_NOC_LATENCY_COST = 1.e-12;
2626

27-
/* Stores statistical data about how the NoC blocks were moved during placement
28-
*/
29-
struct NocPlaceStats {
30-
int number_of_noc_router_moves;
31-
std::vector<int> number_of_noc_router_moves_per_move_type;
32-
};
33-
3427
/* Defines how the links found in a traffic flow are updated in terms
3528
* of their bandwidth usage.
3629
*/
@@ -444,36 +437,6 @@ bool check_for_router_swap(int user_supplied_noc_router_swap_percentage);
444437
*/
445438
e_create_move propose_router_swap(t_pl_blocks_to_be_moved& blocks_affected, float rlim);
446439

447-
/* Below are functions related to modifying and retreiving the NoC placement stats dastructure*/
448-
449-
/**
450-
* @brief Initializes all the stat values to 0 and allocates space for the
451-
* number of possible move types offered by the placer. This is needed as
452-
* the stats datastructure for the NoC keeps track of which moves caused
453-
* a router block to move.
454-
*
455-
* @param placer_opts Contains information about all the possible move
456-
* types in the placer.
457-
*/
458-
void initialize_noc_placement_stats(const t_placer_opts& placer_opts);
459-
460-
/**
461-
* @brief Increments the count of total number of router block moves during
462-
* placement. Also increments the move type that caused the router block to
463-
* move. This function should be called whenever a noc router block is moved
464-
* during placement.
465-
*
466-
* @param move_type The type of move in the placer which caused a router block
467-
* to move.
468-
*/
469-
void update_noc_placement_stats(int move_type);
470-
471-
/**
472-
* @brief Displays the NoC placement statistical data.
473-
*
474-
*/
475-
void print_noc_placement_stats(void);
476-
477440
/**
478441
* @brief Writes out the locations of the router cluster blocks in the
479442
* final placement. This file contains only NoC routers and the

vpr/src/place/place.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,6 @@ void try_place(const Netlist<>& net_list,
753753
move_type_stat.accepted_moves.resize((get_num_agent_types()) * (placer_opts.place_static_move_prob.size()), 0);
754754
move_type_stat.rejected_moves.resize((get_num_agent_types()) * (placer_opts.place_static_move_prob.size()), 0);
755755

756-
// if the noc option was turned on then setup the noc placement stats datastructure
757-
if (noc_opts.noc) {
758-
initialize_noc_placement_stats(placer_opts);
759-
}
760-
761756
/* Get the first range limiter */
762757
first_rlim = (float)max(device_ctx.grid.width() - 1,
763758
device_ctx.grid.height() - 1);
@@ -1025,8 +1020,8 @@ void try_place(const Netlist<>& net_list,
10251020
print_placement_swaps_stats(state);
10261021

10271022
print_placement_move_types_stats(move_type_stat);
1023+
10281024
if (noc_opts.noc) {
1029-
print_noc_placement_stats();
10301025
write_noc_placement_file(noc_opts.noc_placement_file_name);
10311026
}
10321027

@@ -1621,11 +1616,6 @@ static e_move_result try_swap(const t_annealing_state* state,
16211616

16221617
costs->noc_aggregate_bandwidth_cost += noc_aggregate_bandwidth_delta_c;
16231618
costs->noc_latency_cost += noc_latency_delta_c;
1624-
1625-
// if a noc router block was moved, update the NoC related stats
1626-
if (number_of_affected_noc_traffic_flows != 0) {
1627-
update_noc_placement_stats((int)move_type);
1628-
}
16291619
}
16301620

16311621
//Highlights the new block when manual move is selected.

0 commit comments

Comments
 (0)