Skip to content

Commit a472c96

Browse files
committed
make format
1 parent 9855a8e commit a472c96

17 files changed

+145
-161
lines changed

libs/libarchfpga/src/read_fpga_interchange_arch.cpp

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,28 @@
55

66
#ifdef VTR_ENABLE_CAPNPROTO
77

8-
#include <algorithm>
9-
#include <kj/std/iostream.h>
10-
#include <limits>
11-
#include <map>
12-
#include <regex>
13-
#include <set>
14-
#include <stdlib.h>
15-
#include <string>
16-
#include <string.h>
17-
#include <zlib.h>
18-
#include <sstream>
19-
20-
#include "vtr_assert.h"
21-
#include "vtr_digest.h"
22-
#include "vtr_log.h"
23-
#include "vtr_memory.h"
24-
#include "vtr_util.h"
25-
26-
#include "arch_check.h"
27-
#include "arch_error.h"
28-
#include "arch_util.h"
29-
#include "arch_types.h"
30-
8+
# include <algorithm>
9+
# include <kj/std/iostream.h>
10+
# include <limits>
11+
# include <map>
12+
# include <regex>
13+
# include <set>
14+
# include <stdlib.h>
15+
# include <string>
16+
# include <string.h>
17+
# include <zlib.h>
18+
# include <sstream>
19+
20+
# include "vtr_assert.h"
21+
# include "vtr_digest.h"
22+
# include "vtr_log.h"
23+
# include "vtr_memory.h"
24+
# include "vtr_util.h"
25+
26+
# include "arch_check.h"
27+
# include "arch_error.h"
28+
# include "arch_util.h"
29+
# include "arch_types.h"
3130

3231
/*
3332
* FPGA Interchange Device frontend
@@ -2503,7 +2502,7 @@ struct ArchReader {
25032502
}
25042503
};
25052504

2506-
#endif // VTR_ENABLE_CAPNPROTO
2505+
#endif // VTR_ENABLE_CAPNPROTO
25072506

25082507
void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25092508
const bool /*timing_enabled*/,
@@ -2551,12 +2550,12 @@ void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25512550

25522551
ArchReader reader(arch, device_reader, FPGAInterchangeDeviceFile, PhysicalTileTypes, LogicalBlockTypes);
25532552
reader.read_arch();
2554-
#else // VTR_ENABLE_CAPNPROTO
2553+
#else // VTR_ENABLE_CAPNPROTO
25552554
// If CAPNPROTO is disabled, throw an error.
25562555
(void)FPGAInterchangeDeviceFile;
25572556
(void)arch;
25582557
(void)PhysicalTileTypes;
25592558
(void)LogicalBlockTypes;
25602559
throw vtr::VtrError("Unable to read FPGA interchange if CAPNPROTO is not enabled", __FILE__, __LINE__);
2561-
#endif // VTR_ENABLE_CAPNPROTO
2560+
#endif // VTR_ENABLE_CAPNPROTO
25622561
}

libs/libarchfpga/src/read_fpga_interchange_arch.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
#ifdef VTR_ENABLE_CAPNPROTO
77

8-
#include "DeviceResources.capnp.h"
9-
#include "LogicalNetlist.capnp.h"
10-
#include "capnp/serialize.h"
11-
#include "capnp/serialize-packed.h"
12-
#include <fcntl.h>
13-
#include <unistd.h>
14-
15-
#endif // VTR_ENABLE_CAPNPROTO
8+
# include "DeviceResources.capnp.h"
9+
# include "LogicalNetlist.capnp.h"
10+
# include "capnp/serialize.h"
11+
# include "capnp/serialize-packed.h"
12+
# include <fcntl.h>
13+
# include <unistd.h>
14+
15+
#endif // VTR_ENABLE_CAPNPROTO
1616

1717
#ifdef __cplusplus
1818
extern "C" {

vpr/src/base/read_interchange_netlist.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@
1313

1414
#ifdef VTR_ENABLE_CAPNPROTO
1515

16-
#include <cmath>
17-
#include <limits>
18-
#include <kj/std/iostream.h>
19-
#include <regex>
20-
#include <string>
21-
#include <unordered_map>
22-
#include <unordered_set>
23-
#include <zlib.h>
24-
#include <iostream>
25-
#include <sstream>
26-
27-
#include "LogicalNetlist.capnp.h"
28-
#include "capnp/serialize.h"
29-
#include "capnp/serialize-packed.h"
30-
31-
#include "vtr_assert.h"
32-
#include "vtr_hash.h"
33-
#include "vtr_util.h"
34-
#include "vtr_log.h"
35-
#include "vtr_logic.h"
36-
#include "vtr_time.h"
37-
#include "vtr_digest.h"
38-
39-
#include "vpr_types.h"
40-
#include "vpr_error.h"
41-
#include "globals.h"
42-
#include "arch_types.h"
16+
# include <cmath>
17+
# include <limits>
18+
# include <kj/std/iostream.h>
19+
# include <regex>
20+
# include <string>
21+
# include <unordered_map>
22+
# include <unordered_set>
23+
# include <zlib.h>
24+
# include <iostream>
25+
# include <sstream>
26+
27+
# include "LogicalNetlist.capnp.h"
28+
# include "capnp/serialize.h"
29+
# include "capnp/serialize-packed.h"
30+
31+
# include "vtr_assert.h"
32+
# include "vtr_hash.h"
33+
# include "vtr_util.h"
34+
# include "vtr_log.h"
35+
# include "vtr_logic.h"
36+
# include "vtr_time.h"
37+
# include "vtr_digest.h"
38+
39+
# include "vpr_types.h"
40+
# include "vpr_error.h"
41+
# include "globals.h"
42+
# include "arch_types.h"
4343

4444
struct NetlistReader {
4545
public:
@@ -524,7 +524,7 @@ struct NetlistReader {
524524
}
525525
};
526526

527-
#endif // VTR_ENABLE_CAPNPROTO
527+
#endif // VTR_ENABLE_CAPNPROTO
528528

529529
AtomNetlist read_interchange_netlist(const char* ic_netlist_file,
530530
t_arch& arch) {
@@ -572,12 +572,12 @@ AtomNetlist read_interchange_netlist(const char* ic_netlist_file,
572572

573573
return netlist;
574574

575-
#else // VTR_ENABLE_CAPNPROTO
575+
#else // VTR_ENABLE_CAPNPROTO
576576

577577
// If CAPNPROTO is not enabled, throw an error
578578
(void)ic_netlist_file;
579579
(void)arch;
580580
throw vtr::VtrError("Unable to read interchange netlist with CAPNPROTO disabled", __FILE__, __LINE__);
581581

582-
#endif // VTR_ENABLE_CAPNPROTO
582+
#endif // VTR_ENABLE_CAPNPROTO
583583
}

vpr/src/noc/noc_link.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ NocLink::NocLink(NocLinkId link_id, NocRouterId source, NocRouterId sink, double
66
, source_router(source)
77
, sink_router(sink)
88
, bandwidth_usage(0.0)
9-
, bandwidth(bw) { }
9+
, bandwidth(bw) {}
1010

1111
// getters
1212
NocRouterId NocLink::get_source_router(void) const {

vpr/src/noc/noc_link.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class NocLink {
5050
NocRouterId sink_router; /*!< The router which uses this link as an incoming edge*/
5151

5252
double bandwidth_usage; /*!< Represents the bandwidth of the data being transmitted on the link. Units in bits-per-second(bps)*/
53-
double bandwidth; /*!< Represents the maximum bits per second that can be transmitted over the link without causing congestion*/
53+
double bandwidth; /*!< Represents the maximum bits per second that can be transmitted over the link without causing congestion*/
5454

5555
public:
5656
NocLink(NocLinkId link_id, NocRouterId source_router, NocRouterId sink_router, double bw);
@@ -135,7 +135,6 @@ class NocLink {
135135
*/
136136
void set_bandwidth(double new_bandwidth);
137137

138-
139138
/**
140139
* @brief Returns the unique link ID. The ID can be used to index
141140
* vtr::vector<NoCLinkId, ...> instances.

vpr/src/noc/noc_storage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const NocLink& NocStorage::get_single_noc_link(NocLinkId id) const {
5656
return link_storage[id];
5757
}
5858

59-
NocLinkId NocStorage::get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const {
59+
NocLinkId NocStorage::get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const {
6060
NocLinkId link_id = NocLinkId::INVALID();
6161

6262
for (const auto& link : link_storage) {

vpr/src/noc/noc_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class NocStorage {
282282
* to the destination router. NocLinkId::INVALID() is such a link is not
283283
* found.
284284
*/
285-
NocLinkId get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const;
285+
NocLinkId get_single_noc_link_id(NocRouterId src_router, NocRouterId dst_router) const;
286286

287287
/**
288288
* @brief Given a unique link identifier, get the corresponding link

vpr/src/place/initial_noc_placement.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ static void noc_routers_anneal(const t_noc_opts& noc_opts) {
187187
const double starting_prob = 0.5;
188188
const double prob_step = starting_prob / N_MOVES;
189189

190-
191190
// The checkpoint stored the placement with the lowest cost.
192191
NoCPlacementCheckpoint checkpoint;
193192

vpr/src/place/noc_place_utils.cpp

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ static vtr::vector<NocTrafficFlowId, TrafficFlowPlaceCost> traffic_flow_costs, p
99
static std::vector<NocTrafficFlowId> affected_traffic_flows;
1010

1111
/* 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;
1313

1414
/* Keeps track of NoC links whose bandwidth usage have been updated at each attempted placement move*/
1515
static std::unordered_set<NocLinkId> affected_noc_links;
@@ -57,7 +57,7 @@ void initial_noc_routing(void) {
5757
const t_noc_traffic_flow& curr_traffic_flow = noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id);
5858

5959
// 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);
6161

6262
// update the links used in the found traffic flow route, links' bandwidth should be incremented since the traffic flow is routed
6363
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
126126
// calculate the new aggregate bandwidth and latency costs for the affected traffic flow
127127
proposed_traffic_flow_costs[traffic_flow_id].aggregate_bandwidth = calculate_traffic_flow_aggregate_bandwidth_cost(traffic_flow_route, curr_traffic_flow);
128128
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);
130131

131132
// compute how much the aggregate bandwidth and latency costs change with this swap
132133
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() {
163164
}
164165

165166
// 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) {
167168
// get the affected link
168169
const auto& link = noc_ctx.noc_model.get_single_noc_link(link_id);
169170

@@ -458,7 +459,7 @@ int check_noc_placement_costs(const t_placer_costs& costs, double error_toleranc
458459
vtr::vector<NocLinkId, NocLink> temp_noc_link_storage = noc_model.get_noc_links();
459460

460461
// 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); });
462463

463464
// need to create a temporary noc routing algorithm
464465
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
503504
}
504505

505506
// 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) {
507508
cost_check.congestion += calculate_link_congestion_cost(link);
508509
}
509510

@@ -590,10 +591,7 @@ double calculate_link_congestion_cost(const NocLink& link) {
590591
}
591592

592593
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;
597595

598596
VTR_ASSERT(weighting_factor_sum <= 1.0 && weighting_factor_sum >= 0.0);
599597

@@ -617,11 +615,7 @@ double calculate_noc_cost(const NocCostTerms& cost_terms,
617615
* is computed. Weighting factors determine the contribution of each
618616
* normalized term to the sum.
619617
*/
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);
625619

626620
return cost;
627621
}
@@ -668,11 +662,11 @@ int get_number_of_congested_noc_links(void) {
668662

669663
// Iterate over all NoC links and count the congested ones
670664
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();
672666

673-
if (congested_bw_ratio > MIN_EXPECTED_NOC_CONGESTION_COST) {
667+
if (congested_bw_ratio > MIN_EXPECTED_NOC_CONGESTION_COST) {
674668
num_congested_links++;
675-
}
669+
}
676670
}
677671

678672
return num_congested_links;
@@ -686,8 +680,8 @@ double get_total_congestion_bandwidth_ratio(void) {
686680

687681
// Iterate over all NoC links and count the congested ones
688682
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;
691685
}
692686

693687
return accum_congestion_ratio;
@@ -701,8 +695,8 @@ std::vector<NocLink> get_top_n_congested_links(int n) {
701695
// stable_sort is used to make sure the order is the same across different machines/compilers
702696
// Note that when the vector is sorted, indexing it with NocLinkId does return the corresponding link
703697
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+
});
706700

707701
int pick_n = std::min((int)noc_links.size(), n);
708702

vpr/src/place/noc_place_utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ void update_traffic_flow_link_usage(const std::vector<NocLinkId>& traffic_flow_r
210210
*/
211211
void re_route_associated_traffic_flows(ClusterBlockId moved_router_block_id,
212212
NocTrafficFlows& noc_traffic_flows_storage,
213-
NocStorage& noc_model, NocRouting& noc_flows_router,
213+
NocStorage& noc_model,
214+
NocRouting& noc_flows_router,
214215
std::unordered_set<NocTrafficFlowId>& updated_traffic_flows);
215216

216217
/**
@@ -462,7 +463,6 @@ double get_total_congestion_bandwidth_ratio(void);
462463
*/
463464
std::vector<NocLink> get_top_n_congested_links(int n);
464465

465-
466466
/**
467467
* @brief Goes through all NoC links and determines whether they
468468
* are congested or not. Then finds n links that are most congested.

0 commit comments

Comments
 (0)