Skip to content

Commit b5a4c81

Browse files
NoC cost weighting factors add up to 1
1 parent 4770634 commit b5a4c81

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,7 @@ struct t_noc_opts {
14961496
std::string noc_flows_file; ///<name of the file that contains all the traffic flow information to be sent over the NoC in this design
14971497
std::string noc_routing_algorithm; ///<controls the routing algorithm used to route packets within the NoC
14981498
double noc_placement_weighting; ///<controls the significance of the NoC placement cost relative to the total placement cost range:[0-inf)
1499+
double noc_aggregate_bandwidth_weighting;
14991500
double noc_latency_constraints_weighting; ///<controls the significance of meeting the traffic flow contraints range:[0-inf)
15001501
double noc_latency_weighting; ///<controls the significance of the traffic flow latencies relative to the other NoC placement costs range:[0-inf)
15011502
double noc_congestion_weighting; ///<controls the significance of the link congestions relative to the other NoC placement costs range:[0-inf)

vpr/src/place/noc_place_utils.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,17 @@ double calculate_link_congestion_cost(const NocLink& link) {
586586
return congested_bw_ratio;
587587
}
588588

589+
void normalize_noc_cost_weighting_factor(t_noc_opts& noc_opts) {
590+
591+
double weighting_factor_sum = noc_opts.noc_latency_weighting +
592+
noc_opts.noc_latency_constraints_weighting +
593+
noc_opts.noc_congestion_weighting;
594+
595+
VTR_ASSERT(weighting_factor_sum <= 1.0 && weighting_factor_sum >= 0.0);
596+
597+
noc_opts.noc_aggregate_bandwidth_weighting = 1.0 - weighting_factor_sum;
598+
}
599+
589600
double calculate_noc_cost(const NocCostTerms& cost_terms,
590601
const NocCostTerms& norm_factors,
591602
const t_noc_opts& noc_opts) {
@@ -597,8 +608,8 @@ double calculate_noc_cost(const NocCostTerms& cost_terms,
597608
* 3) Link congestion costs
598609
*/
599610
cost = noc_opts.noc_placement_weighting * (
600-
cost_terms.aggregate_bandwidth * norm_factors.aggregate_bandwidth +
601-
cost_terms.latency * norm_factors.latency * noc_opts.noc_latency_constraints_weighting +
611+
cost_terms.aggregate_bandwidth * norm_factors.aggregate_bandwidth * noc_opts.noc_aggregate_bandwidth_weighting +
612+
cost_terms.latency * norm_factors.latency * noc_opts.noc_latency_weighting +
602613
cost_terms.latency_overrun * norm_factors.latency_overrun * noc_opts.noc_latency_constraints_weighting +
603614
cost_terms.congestion * norm_factors.congestion * noc_opts.noc_congestion_weighting);
604615

vpr/src/place/noc_place_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ std::pair<double, double> calculate_traffic_flow_latency_cost(const std::vector<
395395
*/
396396
double calculate_link_congestion_cost(const NocLink& link);
397397

398+
void normalize_noc_cost_weighting_factor(t_noc_opts& noc_opts);
399+
398400
/**
399401
* @brief Computes a weighted average of NoC cost term to determine
400402
* NoC's contribution to the total placement cost.

vpr/src/place/place.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,10 @@ void try_place(const Netlist<>& net_list,
656656

657657
vtr::ScopedStartFinishTimer timer("Placement");
658658

659+
if (noc_opts.noc) {
660+
normalize_noc_cost_weighting_factor(const_cast<t_noc_opts&>(noc_opts));
661+
}
662+
659663
initial_placement(placer_opts,
660664
placer_opts.constraints_file.c_str(),
661665
noc_opts);

0 commit comments

Comments
 (0)