Skip to content

Commit 9978c70

Browse files
committed
Merge branch 'pres_fac_max' of https://github.com/verilog-to-routing/vtr-verilog-to-routing into pres_fac_max
2 parents c8a3e22 + 33ea049 commit 9978c70

25 files changed

+167
-163
lines changed

doc/src/vpr/command_line_usage.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,14 @@ VPR uses a negotiated congestion algorithm (based on Pathfinder) to perform rout
11631163

11641164
**Default:** ``1.3``
11651165

1166+
.. option:: --max_pres_fac <float>
1167+
1168+
Sets the maximum present overuse penalty factor that can ever result during routing. Should always be less than 1e25 or so to prevent overflow.
1169+
Smaller values may help prevent circuitous routing in difficult routing problems, but may increase
1170+
the number of routing iterations needed and hence runtime.
1171+
1172+
**Default:** ``1000.0``
1173+
11661174
.. option:: --acc_fac <float>
11671175

11681176
Specifies the accumulated overuse factor (historical congestion cost factor).

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/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
419419
RouterOpts->min_incremental_reroute_fanout = Options.min_incremental_reroute_fanout;
420420
RouterOpts->incr_reroute_delay_ripup = Options.incr_reroute_delay_ripup;
421421
RouterOpts->pres_fac_mult = Options.pres_fac_mult;
422+
RouterOpts->max_pres_fac = Options.max_pres_fac;
422423
RouterOpts->route_type = Options.RouteType;
423424

424425
RouterOpts->full_stats = Options.full_stats;

vpr/src/base/ShowSetup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
328328
VTR_LOG("RouterOpts.first_iter_pres_fac: %f\n", RouterOpts.first_iter_pres_fac);
329329
VTR_LOG("RouterOpts.initial_pres_fac: %f\n", RouterOpts.initial_pres_fac);
330330
VTR_LOG("RouterOpts.pres_fac_mult: %f\n", RouterOpts.pres_fac_mult);
331+
VTR_LOG("RouterOpts.max_pres_fac: %f\n", RouterOpts.max_pres_fac);
331332
VTR_LOG("RouterOpts.max_router_iterations: %d\n", RouterOpts.max_router_iterations);
332333
VTR_LOG("RouterOpts.min_incremental_reroute_fanout: %d\n", RouterOpts.min_incremental_reroute_fanout);
333334
VTR_LOG("RouterOpts.do_check_rr_graph: %s\n", RouterOpts.do_check_rr_graph ? "true" : "false");
@@ -473,6 +474,7 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
473474
VTR_LOG("RouterOpts.first_iter_pres_fac: %f\n", RouterOpts.first_iter_pres_fac);
474475
VTR_LOG("RouterOpts.initial_pres_fac: %f\n", RouterOpts.initial_pres_fac);
475476
VTR_LOG("RouterOpts.pres_fac_mult: %f\n", RouterOpts.pres_fac_mult);
477+
VTR_LOG("RouterOpts.max_pres_fac: %f\n", RouterOpts.max_pres_fac);
476478
VTR_LOG("RouterOpts.max_router_iterations: %d\n", RouterOpts.max_router_iterations);
477479
VTR_LOG("RouterOpts.min_incremental_reroute_fanout: %d\n", RouterOpts.min_incremental_reroute_fanout);
478480
VTR_LOG("RouterOpts.do_check_rr_graph: %s\n", RouterOpts.do_check_rr_graph ? "true" : "false");

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/base/read_options.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,6 +2333,11 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
23332333
.default_value("1.3")
23342334
.show_in(argparse::ShowIn::HELP_ONLY);
23352335

2336+
route_grp.add_argument(args.max_pres_fac, "-max_pres_fac")
2337+
.help("Sets the maximum present overuse penalty factor")
2338+
.default_value("1000.0")
2339+
.show_in(argparse::ShowIn::HELP_ONLY);
2340+
23362341
route_grp.add_argument(args.acc_fac, "--acc_fac")
23372342
.help("Specifies the accumulated overuse factor (historical congestion cost factor)")
23382343
.default_value("1.0")

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ struct t_options {
182182
argparse::ArgValue<float> first_iter_pres_fac;
183183
argparse::ArgValue<float> initial_pres_fac;
184184
argparse::ArgValue<float> pres_fac_mult;
185+
argparse::ArgValue<float> max_pres_fac;
185186
argparse::ArgValue<float> acc_fac;
186187
argparse::ArgValue<int> bb_factor;
187188
argparse::ArgValue<e_base_cost_type> base_cost_type;

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,7 @@ struct t_router_opts {
14031403
float first_iter_pres_fac;
14041404
float initial_pres_fac;
14051405
float pres_fac_mult;
1406+
float max_pres_fac;
14061407
float acc_fac;
14071408
float bend_cost;
14081409
int max_router_iterations;

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
@@ -188,7 +188,6 @@ static void noc_routers_anneal(const t_noc_opts& noc_opts) {
188188
const double starting_prob = 0.5;
189189
const double prob_step = starting_prob / N_MOVES;
190190

191-
192191
// The checkpoint stored the placement with the lowest cost.
193192
NoCPlacementCheckpoint checkpoint;
194193

0 commit comments

Comments
 (0)