Skip to content

Commit 5f9d494

Browse files
committed
Merge branches 'symbiflow-badger', 'disable-check-route-option', 'connection_box_cleanup', 'avoid-criticality-issue' and 'add-issue-template' into master+wip
5 parents 76c8bfb + 21d1551 + 7857f12 + 144876b + e378d7f commit 5f9d494

23 files changed

+1167
-8
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
47

58
---
69

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
47

58
---
69

.github/ISSUE_TEMPLATE/vtr-change.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: VTR change
3+
about: Describe purpose and lifecycle of a local change we made to VTR
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Why did we need this? (what does this change enable us to do)
11+
<!--- i.e. what does this change enable us to do? -->
12+
13+
### What did it change?
14+
<!--- i.e. technical description what the change does -->
15+
16+
### Should it be merged upstream - if not, when can we delete it?
17+
18+
### What is needed to get this merged / deleted?
19+
20+
* [ ] is the implementation work to make suitable for merging / deletion completed?
21+
* [ ] Is there an associated test? <!--- i.e. how will we prevent it from regressing? -->
22+
* [ ] is this currently part of the Conda package?
23+
* [ ] is this properly cleaned up in our local repositories? <!--- add subtasks here if needed) -->
24+
25+
### Tracker / branch / PR & other useful links

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
347347
RouterOpts->max_convergence_count = Options.router_max_convergence_count;
348348
RouterOpts->reconvergence_cpd_threshold = Options.router_reconvergence_cpd_threshold;
349349
RouterOpts->first_iteration_timing_report_file = Options.router_first_iteration_timing_report_file;
350-
351350
RouterOpts->strict_checks = Options.strict_checks;
351+
RouterOpts->disable_check_route = Options.disable_check_route;
352352
}
353353

354354
static void SetupAnnealSched(const t_options& Options,

vpr/src/base/echo_files.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ void alloc_and_load_echo_file_info() {
112112
setEchoFileName(E_ECHO_CHAN_DETAILS, "chan_details.txt");
113113
setEchoFileName(E_ECHO_SBLOCK_PATTERN, "sblock_pattern.txt");
114114
setEchoFileName(E_ECHO_ENDPOINT_TIMING, "endpoint_timing.echo.json");
115+
116+
setEchoFileName(E_ECHO_LOOKAHEAD_MAP, "lookahead_map.echo");
115117
}
116118

117119
void free_echo_file_info() {

vpr/src/base/echo_files.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ enum e_echo_files {
4343
E_ECHO_CHAN_DETAILS,
4444
E_ECHO_SBLOCK_PATTERN,
4545
E_ECHO_ENDPOINT_TIMING,
46+
E_ECHO_LOOKAHEAD_MAP,
4647

4748
//Timing Graphs
4849
E_ECHO_PRE_PACKING_TIMING_GRAPH,

vpr/src/base/read_options.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ struct ParseRouterLookahead {
648648
conv_value.set_value(e_router_lookahead::CLASSIC);
649649
else if (str == "map")
650650
conv_value.set_value(e_router_lookahead::MAP);
651+
else if (str == "connection_box_map")
652+
conv_value.set_value(e_router_lookahead::CONNECTION_BOX_MAP);
651653
else {
652654
std::stringstream msg;
653655
msg << "Invalid conversion from '"
@@ -661,17 +663,22 @@ struct ParseRouterLookahead {
661663

662664
ConvertedValue<std::string> to_str(e_router_lookahead val) {
663665
ConvertedValue<std::string> conv_value;
664-
if (val == e_router_lookahead::CLASSIC)
666+
if (val == e_router_lookahead::CLASSIC) {
665667
conv_value.set_value("classic");
666-
else {
667-
VTR_ASSERT(val == e_router_lookahead::MAP);
668+
} else if (val == e_router_lookahead::MAP) {
668669
conv_value.set_value("map");
670+
} else if (val == e_router_lookahead::CONNECTION_BOX_MAP) {
671+
conv_value.set_value("connection_box_map");
672+
} else {
673+
std::stringstream msg;
674+
msg << "Unrecognized e_router_lookahead";
675+
conv_value.set_error(msg.str());
669676
}
670677
return conv_value;
671678
}
672679

673680
std::vector<std::string> default_choices() {
674-
return {"classic", "map"};
681+
return {"classic", "map", "connection_box_map"};
675682
}
676683
};
677684

@@ -1569,6 +1576,11 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
15691576
.default_value("")
15701577
.show_in(argparse::ShowIn::HELP_ONLY);
15711578

1579+
route_timing_grp.add_argument<bool, ParseOnOff>(args.disable_check_route, "--disable_check_route")
1580+
.help("Disables check_route once routing step has finished or when routing file is loaded")
1581+
.default_value("off")
1582+
.show_in(argparse::ShowIn::HELP_ONLY);
1583+
15721584
route_timing_grp.add_argument(args.router_debug_net, "--router_debug_net")
15731585
.help(
15741586
"Controls when router debugging is enabled.\n"

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ struct t_options {
123123
argparse::ArgValue<bool> verify_binary_search;
124124
argparse::ArgValue<e_router_algorithm> RouterAlgorithm;
125125
argparse::ArgValue<int> min_incremental_reroute_fanout;
126+
argparse::ArgValue<bool> disable_check_route;
126127

127128
/* Timing-driven router options only */
128129
argparse::ArgValue<float> astar_fac;

vpr/src/base/vpr_api.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,9 @@ RouteStatus vpr_route_flow(t_vpr_setup& vpr_setup, const t_arch& arch) {
676676
std::string graphics_msg;
677677
if (route_status.success()) {
678678
//Sanity check the routing
679-
check_route(router_opts.route_type);
679+
if (!router_opts.disable_check_route) {
680+
check_route(router_opts.route_type);
681+
}
680682
get_serial_num();
681683

682684
//Update status

vpr/src/base/vpr_context.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "clock_connection_builders.h"
2121
#include "route_traceback.h"
2222
#include "place_macro.h"
23+
#include "connection_box.h"
2324

2425
//A Context is collection of state relating to a particular part of VPR
2526
//
@@ -194,6 +195,8 @@ struct DeviceContext : public Context {
194195
* Clock Network
195196
********************************************************************/
196197
t_clock_arch* clock_arch;
198+
199+
ConnectionBoxes connection_boxes;
197200
};
198201

199202
//State relating to power analysis

vpr/src/base/vpr_types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ constexpr const char* EMPTY_BLOCK_NAME = "EMPTY";
103103
enum class e_router_lookahead {
104104
CLASSIC, //VPR's classic lookahead (assumes uniform wire types)
105105
MAP, //Lookahead considering different wire types (see Oleg Petelin's MASc Thesis)
106-
NO_OP //A no-operation lookahead which always returns zero
106+
NO_OP, //A no-operation lookahead which always returns zero
107+
CONNECTION_BOX_MAP,
108+
// Lookahead considering different wire types and IPIN
109+
// connection box.
107110
};
108111

109112
enum class e_route_bb_update {
@@ -951,6 +954,7 @@ struct t_router_opts {
951954
float reconvergence_cpd_threshold;
952955
std::string first_iteration_timing_report_file;
953956
bool strict_checks;
957+
bool disable_check_route;
954958
};
955959

956960
struct t_analysis_opts {

vpr/src/route/connection_box.cpp

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#include "connection_box.h"
2+
#include "vtr_assert.h"
3+
#include "globals.h"
4+
5+
ConnectionBoxes::ConnectionBoxes()
6+
: size_(std::make_pair(0, 0)) {
7+
}
8+
9+
size_t ConnectionBoxes::num_connection_box_types() const {
10+
return boxes_.size();
11+
}
12+
13+
std::pair<size_t, size_t> ConnectionBoxes::connection_box_grid_size() const {
14+
return size_;
15+
}
16+
17+
const ConnectionBox* ConnectionBoxes::get_connection_box(ConnectionBoxId box) const {
18+
if (bool(box)) {
19+
return nullptr;
20+
}
21+
22+
size_t index = size_t(box);
23+
if (index >= boxes_.size()) {
24+
return nullptr;
25+
}
26+
27+
return &boxes_.at(index);
28+
}
29+
30+
bool ConnectionBoxes::find_connection_box(int inode,
31+
ConnectionBoxId* box_id,
32+
std::pair<size_t, size_t>* box_location) const {
33+
VTR_ASSERT(box_id != nullptr);
34+
VTR_ASSERT(box_location != nullptr);
35+
36+
const auto& conn_box_loc = ipin_map_[inode];
37+
if (conn_box_loc.box_id == ConnectionBoxId::INVALID()) {
38+
return false;
39+
}
40+
41+
*box_id = conn_box_loc.box_id;
42+
*box_location = conn_box_loc.box_location;
43+
return true;
44+
}
45+
46+
// Clear IPIN map and set connection box grid size and box ids.
47+
void ConnectionBoxes::reset_boxes(std::pair<size_t, size_t> size,
48+
const std::vector<ConnectionBox> boxes) {
49+
clear();
50+
51+
size_ = size;
52+
boxes_ = boxes;
53+
}
54+
55+
void ConnectionBoxes::resize_nodes(size_t rr_node_size) {
56+
ipin_map_.resize(rr_node_size);
57+
canonical_loc_map_.resize(rr_node_size,
58+
std::make_pair(-1, -1));
59+
}
60+
61+
void ConnectionBoxes::clear() {
62+
ipin_map_.clear();
63+
size_ = std::make_pair(0, 0);
64+
boxes_.clear();
65+
canonical_loc_map_.clear();
66+
sink_to_ipin_.clear();
67+
}
68+
69+
void ConnectionBoxes::add_connection_box(int inode, ConnectionBoxId box_id, std::pair<size_t, size_t> box_location) {
70+
// Ensure that box location is in bounds
71+
VTR_ASSERT(box_location.first < size_.first);
72+
VTR_ASSERT(box_location.second < size_.second);
73+
74+
// Bounds check box_id
75+
VTR_ASSERT(bool(box_id));
76+
VTR_ASSERT(size_t(box_id) < boxes_.size());
77+
78+
// Make sure sink map will not be invalidated upon insertion.
79+
VTR_ASSERT(sink_to_ipin_.size() == 0);
80+
81+
ipin_map_[inode] = ConnBoxLoc(box_location, box_id);
82+
}
83+
84+
void ConnectionBoxes::add_canonical_loc(int inode, std::pair<size_t, size_t> loc) {
85+
VTR_ASSERT(loc.first < size_.first);
86+
VTR_ASSERT(loc.second < size_.second);
87+
canonical_loc_map_[inode] = loc;
88+
}
89+
90+
const std::pair<size_t, size_t>* ConnectionBoxes::find_canonical_loc(int inode) const {
91+
const auto& canon_loc = canonical_loc_map_[inode];
92+
if (canon_loc.first == size_t(-1)) {
93+
return nullptr;
94+
}
95+
96+
return &canon_loc;
97+
}
98+
99+
void ConnectionBoxes::create_sink_back_ref() {
100+
const auto& device_ctx = g_vpr_ctx.device();
101+
102+
sink_to_ipin_.resize(device_ctx.rr_nodes.size(), {{0, 0, 0, 0}, 0});
103+
104+
for (size_t i = 0; i < device_ctx.rr_nodes.size(); ++i) {
105+
const auto& ipin_node = device_ctx.rr_nodes[i];
106+
if (ipin_node.type() != IPIN) {
107+
continue;
108+
}
109+
110+
if (ipin_map_[i].box_id == ConnectionBoxId::INVALID()) {
111+
continue;
112+
}
113+
114+
for (auto edge : ipin_node.edges()) {
115+
int sink_inode = ipin_node.edge_sink_node(edge);
116+
VTR_ASSERT(device_ctx.rr_nodes[sink_inode].type() == SINK);
117+
VTR_ASSERT(sink_to_ipin_[sink_inode].ipin_count < 4);
118+
auto& sink_to_ipin = sink_to_ipin_[sink_inode];
119+
sink_to_ipin.ipin_nodes[sink_to_ipin.ipin_count++] = i;
120+
}
121+
}
122+
}
123+
124+
const SinkToIpin& ConnectionBoxes::find_sink_connection_boxes(
125+
int inode) const {
126+
return sink_to_ipin_[inode];
127+
}

vpr/src/route/connection_box.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#ifndef CONNECTION_BOX_H
2+
#define CONNECTION_BOX_H
3+
// Some routing graphs have connectivity driven by types of connection boxes.
4+
// This class relates IPIN rr nodes with connection box type and locations, used
5+
// for connection box driven map lookahead.
6+
7+
#include <tuple>
8+
#include "vtr_strong_id.h"
9+
#include "vtr_flat_map.h"
10+
#include "vtr_range.h"
11+
#include <map>
12+
13+
struct connection_box_tag {};
14+
typedef vtr::StrongId<connection_box_tag> ConnectionBoxId;
15+
16+
struct ConnectionBox {
17+
std::string name;
18+
};
19+
20+
struct ConnBoxLoc {
21+
ConnBoxLoc()
22+
: box_location(std::make_pair(-1, -1)) {}
23+
ConnBoxLoc(
24+
const std::pair<size_t, size_t>& a_box_location,
25+
ConnectionBoxId a_box_id)
26+
: box_location(a_box_location)
27+
, box_id(a_box_id) {}
28+
29+
std::pair<size_t, size_t> box_location;
30+
ConnectionBoxId box_id;
31+
};
32+
33+
struct SinkToIpin {
34+
int ipin_nodes[4];
35+
int ipin_count;
36+
};
37+
38+
class ConnectionBoxes {
39+
public:
40+
ConnectionBoxes();
41+
42+
size_t num_connection_box_types() const;
43+
std::pair<size_t, size_t> connection_box_grid_size() const;
44+
const ConnectionBox* get_connection_box(ConnectionBoxId box) const;
45+
46+
bool find_connection_box(int inode,
47+
ConnectionBoxId* box_id,
48+
std::pair<size_t, size_t>* box_location) const;
49+
const std::pair<size_t, size_t>* find_canonical_loc(int inode) const;
50+
51+
// Clear IPIN map and set connection box grid size and box ids.
52+
void clear();
53+
void reset_boxes(std::pair<size_t, size_t> size,
54+
const std::vector<ConnectionBox> boxes);
55+
void resize_nodes(size_t rr_node_size);
56+
57+
void add_connection_box(int inode, ConnectionBoxId box_id, std::pair<size_t, size_t> box_location);
58+
void add_canonical_loc(int inode, std::pair<size_t, size_t> loc);
59+
60+
// Create map from SINK's back to IPIN's
61+
//
62+
// This must be called after all connection boxes have been added.
63+
void create_sink_back_ref();
64+
const SinkToIpin& find_sink_connection_boxes(
65+
int inode) const;
66+
67+
private:
68+
std::pair<size_t, size_t> size_;
69+
std::vector<ConnectionBox> boxes_;
70+
std::vector<ConnBoxLoc> ipin_map_;
71+
std::vector<SinkToIpin> sink_to_ipin_;
72+
std::vector<std::pair<size_t, size_t>>
73+
canonical_loc_map_;
74+
};
75+
76+
#endif

0 commit comments

Comments
 (0)