@@ -9,7 +9,7 @@ static vtr::vector<NocTrafficFlowId, TrafficFlowPlaceCost> traffic_flow_costs, p
9
9
static std::vector<NocTrafficFlowId> affected_traffic_flows;
10
10
11
11
/* Proposed and actual congestion cost of a NoC link used for each move assessment */
12
- static vtr::vector<NocLinkId , double > link_congestion_costs, proposed_link_congestion_costs;
12
+ static vtr::vector<NocLinkId, double > link_congestion_costs, proposed_link_congestion_costs;
13
13
14
14
/* Keeps track of NoC links whose bandwidth usage have been updated at each attempted placement move*/
15
15
static std::unordered_set<NocLinkId> affected_noc_links;
@@ -57,7 +57,7 @@ void initial_noc_routing(void) {
57
57
const t_noc_traffic_flow& curr_traffic_flow = noc_traffic_flows_storage.get_single_noc_traffic_flow (traffic_flow_id);
58
58
59
59
// update the traffic flow route based on where the router cluster blocks are placed
60
- std::vector<NocLinkId>& curr_traffic_flow_route = route_traffic_flow (traffic_flow_id, noc_ctx.noc_model ,noc_traffic_flows_storage, *noc_ctx.noc_flows_router );
60
+ std::vector<NocLinkId>& curr_traffic_flow_route = route_traffic_flow (traffic_flow_id, noc_ctx.noc_model , noc_traffic_flows_storage, *noc_ctx.noc_flows_router );
61
61
62
62
// update the links used in the found traffic flow route, links' bandwidth should be incremented since the traffic flow is routed
63
63
update_traffic_flow_link_usage (curr_traffic_flow_route, noc_ctx.noc_model , 1 , curr_traffic_flow.traffic_flow_bandwidth );
@@ -126,7 +126,8 @@ void find_affected_noc_routers_and_update_noc_costs(const t_pl_blocks_to_be_move
126
126
// calculate the new aggregate bandwidth and latency costs for the affected traffic flow
127
127
proposed_traffic_flow_costs[traffic_flow_id].aggregate_bandwidth = calculate_traffic_flow_aggregate_bandwidth_cost (traffic_flow_route, curr_traffic_flow);
128
128
std::tie (proposed_traffic_flow_costs[traffic_flow_id].latency ,
129
- proposed_traffic_flow_costs[traffic_flow_id].latency_overrun ) = calculate_traffic_flow_latency_cost (traffic_flow_route, noc_ctx.noc_model , curr_traffic_flow);
129
+ proposed_traffic_flow_costs[traffic_flow_id].latency_overrun )
130
+ = calculate_traffic_flow_latency_cost (traffic_flow_route, noc_ctx.noc_model , curr_traffic_flow);
130
131
131
132
// compute how much the aggregate bandwidth and latency costs change with this swap
132
133
delta_c.aggregate_bandwidth += proposed_traffic_flow_costs[traffic_flow_id].aggregate_bandwidth - traffic_flow_costs[traffic_flow_id].aggregate_bandwidth ;
@@ -163,7 +164,7 @@ void commit_noc_costs() {
163
164
}
164
165
165
166
// Iterate over all the NoC links whose bandwidth utilization was affected by the proposed move
166
- for (auto link_id : affected_noc_links) {
167
+ for (auto link_id : affected_noc_links) {
167
168
// get the affected link
168
169
const auto & link = noc_ctx.noc_model .get_single_noc_link (link_id);
169
170
@@ -458,7 +459,7 @@ int check_noc_placement_costs(const t_placer_costs& costs, double error_toleranc
458
459
vtr::vector<NocLinkId, NocLink> temp_noc_link_storage = noc_model.get_noc_links ();
459
460
460
461
// reset bandwidth utilization for all links
461
- std::for_each (temp_noc_link_storage.begin (), temp_noc_link_storage.end (), [](NocLink& link) {link.set_bandwidth_usage (0.0 ); });
462
+ std::for_each (temp_noc_link_storage.begin (), temp_noc_link_storage.end (), [](NocLink& link) { link.set_bandwidth_usage (0.0 ); });
462
463
463
464
// need to create a temporary noc routing algorithm
464
465
std::unique_ptr<NocRouting> temp_noc_routing_algorithm = NocRoutingAlgorithmCreator::create_routing_algorithm (noc_opts.noc_routing_algorithm );
@@ -503,7 +504,7 @@ int check_noc_placement_costs(const t_placer_costs& costs, double error_toleranc
503
504
}
504
505
505
506
// Iterate over all NoC links and accumulate congestion cost
506
- for (const auto & link : temp_noc_link_storage) {
507
+ for (const auto & link : temp_noc_link_storage) {
507
508
cost_check.congestion += calculate_link_congestion_cost (link);
508
509
}
509
510
@@ -590,10 +591,7 @@ double calculate_link_congestion_cost(const NocLink& link) {
590
591
}
591
592
592
593
void normalize_noc_cost_weighting_factor (t_noc_opts& noc_opts) {
593
-
594
- double weighting_factor_sum = noc_opts.noc_latency_weighting +
595
- noc_opts.noc_latency_constraints_weighting +
596
- noc_opts.noc_congestion_weighting ;
594
+ double weighting_factor_sum = noc_opts.noc_latency_weighting + noc_opts.noc_latency_constraints_weighting + noc_opts.noc_congestion_weighting ;
597
595
598
596
VTR_ASSERT (weighting_factor_sum <= 1.0 && weighting_factor_sum >= 0.0 );
599
597
@@ -617,11 +615,7 @@ double calculate_noc_cost(const NocCostTerms& cost_terms,
617
615
* is computed. Weighting factors determine the contribution of each
618
616
* normalized term to the sum.
619
617
*/
620
- cost = noc_opts.noc_placement_weighting * (
621
- cost_terms.aggregate_bandwidth * norm_factors.aggregate_bandwidth * noc_opts.noc_aggregate_bandwidth_weighting +
622
- cost_terms.latency * norm_factors.latency * noc_opts.noc_latency_weighting +
623
- cost_terms.latency_overrun * norm_factors.latency_overrun * noc_opts.noc_latency_constraints_weighting +
624
- cost_terms.congestion * norm_factors.congestion * noc_opts.noc_congestion_weighting );
618
+ cost = noc_opts.noc_placement_weighting * (cost_terms.aggregate_bandwidth * norm_factors.aggregate_bandwidth * noc_opts.noc_aggregate_bandwidth_weighting + cost_terms.latency * norm_factors.latency * noc_opts.noc_latency_weighting + cost_terms.latency_overrun * norm_factors.latency_overrun * noc_opts.noc_latency_constraints_weighting + cost_terms.congestion * norm_factors.congestion * noc_opts.noc_congestion_weighting );
625
619
626
620
return cost;
627
621
}
@@ -668,11 +662,11 @@ int get_number_of_congested_noc_links(void) {
668
662
669
663
// Iterate over all NoC links and count the congested ones
670
664
for (const auto & link : noc_links) {
671
- double congested_bw_ratio = link.get_congested_bandwidth_ratio ();
665
+ double congested_bw_ratio = link.get_congested_bandwidth_ratio ();
672
666
673
- if (congested_bw_ratio > MIN_EXPECTED_NOC_CONGESTION_COST) {
667
+ if (congested_bw_ratio > MIN_EXPECTED_NOC_CONGESTION_COST) {
674
668
num_congested_links++;
675
- }
669
+ }
676
670
}
677
671
678
672
return num_congested_links;
@@ -686,8 +680,8 @@ double get_total_congestion_bandwidth_ratio(void) {
686
680
687
681
// Iterate over all NoC links and count the congested ones
688
682
for (const auto & link : noc_links) {
689
- double congested_bw_ratio = link.get_congested_bandwidth_ratio ();
690
- accum_congestion_ratio += congested_bw_ratio;
683
+ double congested_bw_ratio = link.get_congested_bandwidth_ratio ();
684
+ accum_congestion_ratio += congested_bw_ratio;
691
685
}
692
686
693
687
return accum_congestion_ratio;
@@ -701,8 +695,8 @@ std::vector<NocLink> get_top_n_congested_links(int n) {
701
695
// stable_sort is used to make sure the order is the same across different machines/compilers
702
696
// Note that when the vector is sorted, indexing it with NocLinkId does return the corresponding link
703
697
std::stable_sort (noc_links.begin (), noc_links.end (), [](const NocLink& l1, const NocLink& l2) {
704
- return l1.get_congested_bandwidth_ratio () > l2.get_congested_bandwidth_ratio ();
705
- });
698
+ return l1.get_congested_bandwidth_ratio () > l2.get_congested_bandwidth_ratio ();
699
+ });
706
700
707
701
int pick_n = std::min ((int )noc_links.size (), n);
708
702
0 commit comments