Skip to content

Commit

Permalink
report NoC metrics after sat routing
Browse files Browse the repository at this point in the history
  • Loading branch information
soheilshahrouz committed Mar 15, 2024
1 parent 6ce5f78 commit 6d56791
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 88 deletions.
78 changes: 34 additions & 44 deletions vpr/src/place/initial_noc_placement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,6 @@ static void noc_routers_anneal(const t_noc_opts& noc_opts) {
if (checkpoint.get_cost() < costs.cost) {
checkpoint.restore_checkpoint(costs);
}

std::cout << "Initial NoC placement costs: "
<< " Agg BW: " << costs.noc_cost_terms.aggregate_bandwidth
<< " Latency: " << costs.noc_cost_terms.latency
<< " Latency Over: " << costs.noc_cost_terms.latency_overrun
<< " Congestion: " << costs.noc_cost_terms.congestion
<< " Congested Links: " << get_number_of_congested_noc_links() << std::endl;

}

void initial_noc_placement(const t_noc_opts& noc_opts, int seed) {
Expand Down Expand Up @@ -298,40 +290,38 @@ void initial_noc_placement(const t_noc_opts& noc_opts, int seed) {
"when packets wait on each other in a cycle.\n");
}



const auto& placement_ctx = g_vpr_ctx.placement();

vtr::vector<NocTrafficFlowId, std::vector<NocLinkId>> traffic_flow_routes;
std::map<ClusterBlockId, t_pl_loc> noc_router_locs;

noc_sat_place_and_route(traffic_flow_routes, noc_router_locs, 4);

t_placer_costs costs;
reinitialize_noc_routing(costs, traffic_flow_routes);

std::cout << "Initial NoC placement costs: "
<< " Agg BW: " << costs.noc_cost_terms.aggregate_bandwidth
<< " Latency: " << costs.noc_cost_terms.latency
<< " Latency Over: " << costs.noc_cost_terms.latency_overrun
<< " Congestion: " << costs.noc_cost_terms.congestion
<< " Congested Links: " << get_number_of_congested_noc_links() << std::endl;

for (auto& [router_blk_id, loc] : noc_router_locs) {
if (placement_ctx.block_locs[router_blk_id].is_fixed) {
continue;
}

// Create a macro with a single member
t_pl_macro_member macro_member;
macro_member.blk_index = router_blk_id;
macro_member.offset = t_pl_offset(0, 0, 0, 0);
t_pl_macro pl_macro;
pl_macro.members.push_back(macro_member);

bool legal = try_place_macro(pl_macro, loc);
if (!legal) {
VPR_FATAL_ERROR(VPR_ERROR_PLACE, "Could not place a router cluster into an empty physical router.");
}
}
// const auto& placement_ctx = g_vpr_ctx.placement();
//
// vtr::vector<NocTrafficFlowId, std::vector<NocLinkId>> traffic_flow_routes;
// std::map<ClusterBlockId, t_pl_loc> noc_router_locs;
//
// noc_sat_place_and_route(traffic_flow_routes, noc_router_locs, 4);
//
// t_placer_costs costs;
// reinitialize_noc_routing(costs, traffic_flow_routes);
//
// std::cout << "Initial NoC placement costs: "
// << " Agg BW: " << costs.noc_cost_terms.aggregate_bandwidth
// << " Latency: " << costs.noc_cost_terms.latency
// << " Latency Over: " << costs.noc_cost_terms.latency_overrun
// << " Congestion: " << costs.noc_cost_terms.congestion
// << " Congested Links: " << get_number_of_congested_noc_links() << std::endl;
//
// for (auto& [router_blk_id, loc] : noc_router_locs) {
// if (placement_ctx.block_locs[router_blk_id].is_fixed) {
// continue;
// }
//
// // Create a macro with a single member
// t_pl_macro_member macro_member;
// macro_member.blk_index = router_blk_id;
// macro_member.offset = t_pl_offset(0, 0, 0, 0);
// t_pl_macro pl_macro;
// pl_macro.members.push_back(macro_member);
//
// bool legal = try_place_macro(pl_macro, loc);
// if (!legal) {
// VPR_FATAL_ERROR(VPR_ERROR_PLACE, "Could not place a router cluster into an empty physical router.");
// }
// }
}
47 changes: 3 additions & 44 deletions vpr/src/place/place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,11 +823,11 @@ void try_place(const Netlist<>& net_list,
placer_opts.place_algorithm,
noc_opts);

//Initial pacement statistics
//Initial placement statistics
VTR_LOG("Initial placement cost: %g bb_cost: %g td_cost: %g\n", costs.cost,
costs.bb_cost, costs.timing_cost);
if (noc_opts.noc) {
VTR_LOG("NoC Placement Costs. "
VTR_LOG("Initial NoC Placement Costs. "
"cost: %g, "
"aggregate_bandwidth_cost: %g, "
"latency_cost: %g, "
Expand Down Expand Up @@ -875,29 +875,7 @@ void try_place(const Netlist<>& net_list,
sprintf(msg,
"Initial Placement. Cost: %g BB Cost: %g TD Cost %g \t Channel Factor: %d",
costs.cost, costs.bb_cost, costs.timing_cost, width_fac);
if (noc_opts.noc) {
sprintf(msg,
"\nInitial NoC Placement Costs. "
"cost: %g, "
"aggregate_bandwidth_cost: %g, "
"latency_cost: %g, "
"n_met_latency_constraints: %d, "
"latency_overrun_cost: %g, "
"congestion_cost: %g, "
"accum_congested_ratio: %g, "
"n_congested_links: %d \n",
calculate_noc_cost(costs.noc_cost_terms, costs.noc_cost_norm_factors, noc_opts),
costs.noc_cost_terms.aggregate_bandwidth,
costs.noc_cost_terms.latency,
get_number_of_traffic_flows_with_latency_cons_met(),
costs.noc_cost_terms.latency_overrun,
costs.noc_cost_terms.congestion,
get_total_congestion_bandwidth_ratio(),
get_number_of_congested_noc_links());



}
//Draw the initial placement
update_screen(ScreenUpdatePriority::MAJOR, msg, PLACEMENT, timing_info);

Expand Down Expand Up @@ -1206,25 +1184,6 @@ void try_place(const Netlist<>& net_list,
costs.bb_cost, costs.timing_cost);
// print the noc costs info
if (noc_opts.noc) {
sprintf(msg,
"\nNoC Placement Costs. "
"cost: %g, "
"aggregate_bandwidth_cost: %g, "
"latency_cost: %g, "
"n_met_latency_constraints: %d, "
"latency_overrun_cost: %g, "
"congestion_cost: %g, "
"accum_congested_ratio: %g, "
"n_congested_links: %d \n",
calculate_noc_cost(costs.noc_cost_terms, costs.noc_cost_norm_factors, noc_opts),
costs.noc_cost_terms.aggregate_bandwidth,
costs.noc_cost_terms.latency,
get_number_of_traffic_flows_with_latency_cons_met(),
costs.noc_cost_terms.latency_overrun,
costs.noc_cost_terms.congestion,
get_total_congestion_bandwidth_ratio(),
get_number_of_congested_noc_links());

VTR_LOG("\nNoC Placement Costs. "
"cost: %g, "
"aggregate_bandwidth_cost: %g, "
Expand Down Expand Up @@ -3392,7 +3351,7 @@ static void update_bb(ClusterNetId net_id,
bb_edge_new.xmax = curr_bb_edge->xmax - 1;
bb_coord_new.xmax = curr_bb_coord->xmax;
}
} else { /* Move to left, old postion was not at xmax. */
} else { /* Move to left, old position was not at xmax. */
bb_coord_new.xmax = curr_bb_coord->xmax;
bb_edge_new.xmax = curr_bb_edge->xmax;
}
Expand Down
8 changes: 8 additions & 0 deletions vtr_flow/parse/parse_config/vpr_noc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ NoC_latency_overrun;vpr.out;NoC Placement Costs. cost: .*, aggregate_bandwidth_c
NoC_congested_bw;vpr.out;NoC Placement Costs. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: (.*), accum_congested_ratio: .*, n_congested_links: .*
NoC_congestion_ratio;vpr.out;NoC Placement Costs. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: (.*), n_congested_links: .*
NoC_n_congested_links;vpr.out;NoC Placement Costs. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: .*, n_congested_links: (.*)
SAT_agg_bandwidth;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: (.*), latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: .*, n_congested_links: .*
SAT_latency;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: (.*), n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: .*, n_congested_links: .*
SAT_n_met_latency_constraints;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: (.*), latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: .*, n_congested_links: .*
SAT_latency_overrun;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: (.*), congestion_cost: .*, accum_congested_ratio: .*, n_congested_links: .*
SAT_congested_bw;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: (.*), accum_congested_ratio: .*, n_congested_links: .*
SAT_congestion_ratio;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: (.*), n_congested_links: .*
SAT_n_congested_links;vpr.out;NoC Placement Costs after SAT routing. cost: .*, aggregate_bandwidth_cost: .*, latency_cost: .*, n_met_latency_constraints: .*, latency_overrun_cost: .*, congestion_cost: .*, accum_congested_ratio: .*, n_congested_links: (.*)

0 comments on commit 6d56791

Please sign in to comment.