Skip to content

Commit a753290

Browse files
author
Muhammad Haris Zafar
authored
Merge branch 'master' into api_set_node_direction
2 parents 3d114d3 + 0010a73 commit a753290

36 files changed

+256
-231
lines changed

.github/kokoro/steps/hostsetup.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,32 @@ echo "----------------------------------------"
99
sudo apt-get remove -y cmake
1010
echo "----------------------------------------"
1111

12+
echo
13+
echo "========================================"
14+
echo "Update the CA certificates"
15+
echo "----------------------------------------"
16+
sudo apt-get install -y ca-certificates
17+
echo "----------------------------------------"
18+
sudo update-ca-certificates
19+
echo "----------------------------------------"
20+
21+
echo
22+
echo "========================================"
23+
echo "Remove the expired letsencrypt.org cert "
24+
echo "----------------------------------------"
25+
sudo rm /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt
26+
echo "----------------------------------------"
27+
sudo update-ca-certificates
28+
echo "----------------------------------------"
29+
wget https://helloworld.letsencrypt.org/ || true
30+
echo "----------------------------------------"
31+
32+
1233
echo
1334
echo "========================================"
1435
echo "Host adding PPAs"
1536
echo "----------------------------------------"
16-
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
37+
wget --no-check-certificate -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
1738
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
1839
echo "----------------------------------------"
1940

.github/workflows/test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ jobs:
137137
./.github/scripts/build.sh
138138
./run_reg_test.py ${{ matrix.suite }} -show_failures -j2
139139
140+
- name: Upload artifact
141+
uses: actions/upload-artifact@v2
142+
with:
143+
name: failed_${{matrix.name}}_regression_log
144+
path: |
145+
vtr_flow/**/*.log
146+
vtr_flow/**/*.out
147+
vtr_flow/**/*.blif
148+
vtr_flow/**/*.p
149+
vtr_flow/**/*.net
150+
vtr_flow/**/*.r
140151
141152
Sanitized:
142153
runs-on: ubuntu-18.04
@@ -185,7 +196,7 @@ jobs:
185196
./.github/scripts/build.sh
186197
./run_reg_test.py odin_reg_basic -show_failures -j2
187198
188-
199+
189200
VQM2BLIF:
190201
name: 'VQM2BLIF Basic Tests'
191202
runs-on: ubuntu-18.04

dev/check-format-py.sh

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
11
#!/usr/bin/env bash
22

3-
source $(dirname "$0")/../.github/scripts/common.sh
4-
5-
clean=$(git status -s -uno | wc -l) #Short ignore untracked
6-
7-
if [ $clean -ne 0 ]; then
8-
echo "Current working tree was not clean! This tool only works on clean checkouts"
9-
exit 2
10-
else
11-
echo "Code Formatting Check"
12-
echo "====================="
13-
make format-py > /dev/null 2>&1
14-
15-
valid_format=$(git diff | wc -l)
16-
17-
if [ $valid_format -ne 0 ]; then
18-
echo "FAILED"
19-
echo ""
20-
echo "You *must* make the following changes to match the formatting style"
21-
echo "-------------------------------------------------------------------"
22-
echo ""
23-
24-
git diff
25-
26-
echo ""
27-
echo "Run 'make format-py' to apply these changes"
28-
29-
git reset --hard > /dev/null
30-
exit 1
31-
else
32-
echo "OK"
33-
fi
34-
fi
35-
exit 0
3+
$(dirname "$0")/check-format.sh -py

dev/check-format.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bash
22

3-
source $(dirname "$0")/../.github/scripts/common.sh
4-
53
clean=$(git status -s -uno | wc -l) #Short ignore untracked
64

75
if [ $clean -ne 0 ]; then
@@ -10,7 +8,7 @@ if [ $clean -ne 0 ]; then
108
else
119
echo "Code Formatting Check"
1210
echo "====================="
13-
make format > /dev/null
11+
make format"$1" > /dev/null 2>&1
1412

1513
valid_format=$(git diff | wc -l)
1614

@@ -24,7 +22,7 @@ else
2422
git diff
2523

2624
echo ""
27-
echo "Run 'make format' to apply these changes"
25+
echo "Run 'make format$1' to apply these changes"
2826

2927
git reset --hard > /dev/null
3028
exit 1

vpr/src/base/vpr_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct DeviceContext : public Context {
149149
*/
150150
t_rr_graph_storage rr_nodes; // autogenerated in build_rr_graph
151151

152-
std::vector<t_rr_indexed_data> rr_indexed_data; // [0 .. num_rr_indexed_data-1]
152+
vtr::vector<RRIndexedDataId, t_rr_indexed_data> rr_indexed_data; // [0 .. num_rr_indexed_data-1]
153153

154154
///@brief Fly-weighted Resistance/Capacitance data for RR Nodes
155155
std::vector<t_rr_rc_data> rr_rc_data;

vpr/src/device/rr_graph_builder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class RRGraphBuilder {
3737
t_rr_graph_storage& node_storage();
3838
/** @brief Return a writable object for update the fast look-up of rr_node */
3939
RRSpatialLookup& node_lookup();
40+
/** @brief Set the type of a node with a given valid id */
41+
inline void set_node_type(RRNodeId id, t_rr_type type) {
42+
node_storage_.set_node_type(id, type);
43+
}
4044
/**
4145
* @brief Add an existing rr_node in the node storage to the node look-up
4246
*

vpr/src/device/rr_graph_fwd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ class RRGraph;
1515

1616
struct rr_node_id_tag;
1717
struct rr_edge_id_tag;
18+
struct rr_indexed_data_id_tag;
1819
struct rr_switch_id_tag;
1920
struct rr_segment_id_tag;
2021

2122
typedef vtr::StrongId<rr_node_id_tag, unsigned int> RRNodeId;
2223
typedef vtr::StrongId<rr_edge_id_tag, unsigned int> RREdgeId;
24+
typedef vtr::StrongId<rr_indexed_data_id_tag, unsigned int> RRIndexedDataId;
2325
typedef vtr::StrongId<rr_switch_id_tag, short> RRSwitchId;
2426
typedef vtr::StrongId<rr_segment_id_tag, short> RRSegmentId;
2527

vpr/src/device/rr_graph_obj.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ short RRGraph::node_class_num(const RRNodeId& node) const {
151151
return node_ptc_num(node);
152152
}
153153

154-
short RRGraph::node_cost_index(const RRNodeId& node) const {
154+
RRIndexedDataId RRGraph::node_cost_index(const RRNodeId& node) const {
155155
VTR_ASSERT_SAFE(valid_node_id(node));
156-
return node_cost_indices_[node];
156+
return RRIndexedDataId(node_cost_indices_[node]);
157157
}
158158

159159
Direction RRGraph::node_direction(const RRNodeId& node) const {
@@ -990,9 +990,9 @@ void RRGraph::set_node_class_num(const RRNodeId& node, const short& class_id) {
990990
set_node_ptc_num(node, class_id);
991991
}
992992

993-
void RRGraph::set_node_cost_index(const RRNodeId& node, const short& cost_index) {
993+
void RRGraph::set_node_cost_index(const RRNodeId& node, const RRIndexedDataId& cost_index) {
994994
VTR_ASSERT(valid_node_id(node));
995-
node_cost_indices_[node] = cost_index;
995+
node_cost_indices_[node] = (size_t)cost_index;
996996
}
997997

998998
void RRGraph::set_node_direction(const RRNodeId& node, const Direction& direction) {

vpr/src/device/rr_graph_obj.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ class RRGraph {
410410
* when used in evaluate different routing paths
411411
* See cross-reference section in this header file for more details
412412
*/
413-
short node_cost_index(const RRNodeId& node) const;
413+
RRIndexedDataId node_cost_index(const RRNodeId& node) const;
414414

415415
/* Get the directionality of a node
416416
* see node coordinate for details
@@ -669,7 +669,7 @@ class RRGraph {
669669

670670
/* Set the routing cost index for node, see node_cost_index() for details */
671671
/* TODO: the cost index should be changed to a StrongId!!! */
672-
void set_node_cost_index(const RRNodeId& node, const short& cost_index);
672+
void set_node_cost_index(const RRNodeId& node, const RRIndexedDataId& cost_index);
673673

674674
/* Set the directionality for a node, only applicable to CHANX and CHANY */
675675
void set_node_direction(const RRNodeId& node, const Direction& direction);

vpr/src/device/rr_graph_view.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "rr_node.h"
33
#include "physical_types.h"
44

5-
RRGraphView::RRGraphView(const t_rr_graph_storage& node_storage, const RRSpatialLookup& node_lookup, const std::vector<t_rr_indexed_data>& rr_indexed_data, const std::vector<t_segment_inf>& rr_segments)
5+
RRGraphView::RRGraphView(const t_rr_graph_storage& node_storage, const RRSpatialLookup& node_lookup, const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data, const std::vector<t_segment_inf>& rr_segments)
66
: node_storage_(node_storage)
77
, node_lookup_(node_lookup)
88
, rr_indexed_data_(rr_indexed_data)

vpr/src/device/rr_graph_view.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class RRGraphView {
3737
/* See detailed comments about the data structures in the internal data storage section of this file */
3838
RRGraphView(const t_rr_graph_storage& node_storage,
3939
const RRSpatialLookup& node_lookup,
40-
const std::vector<t_rr_indexed_data>& rr_indexed_data,
40+
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
4141
const std::vector<t_segment_inf>& rr_segments);
4242

4343
/* Disable copy constructors and copy assignment operator
@@ -207,7 +207,7 @@ class RRGraphView {
207207
arrow = "";
208208
}
209209
if (node_type(node) == CHANX || node_type(node) == CHANY) { //for channels, we would like to describe the component with segment specific information
210-
int cost_index = node_cost_index(node);
210+
RRIndexedDataId cost_index = node_cost_index(node);
211211
int seg_index = rr_indexed_data_[cost_index].seg_index;
212212
coordinate_string += rr_segments_[seg_index].name; //Write the segment name
213213
coordinate_string += " length:" + std::to_string(node_length(node)); //add the length of the segment
@@ -245,7 +245,7 @@ class RRGraphView {
245245
}
246246

247247
/** @brief Get the cost index of a routing resource node. This function is inlined for runtime optimization. */
248-
inline short node_cost_index(RRNodeId node) const {
248+
RRIndexedDataId node_cost_index(RRNodeId node) const {
249249
return node_storage_.node_cost_index(node);
250250
}
251251

@@ -263,7 +263,7 @@ class RRGraphView {
263263
const RRSpatialLookup& node_lookup_;
264264

265265
/* rr_indexed_data_ and rr_segments_ are needed to lookup the segment information in node_coordinate_to_string() */
266-
const std::vector<t_rr_indexed_data>& rr_indexed_data_;
266+
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data_;
267267

268268
/* Segment info for rr nodes */
269269
const std::vector<t_segment_inf>& rr_segments_;

vpr/src/power/power.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -858,16 +858,17 @@ static void power_usage_routing(t_power_usage* power_usage,
858858
for (size_t rr_node_idx = 0; rr_node_idx < device_ctx.rr_nodes.size(); rr_node_idx++) {
859859
t_power_usage sub_power_usage;
860860
auto node = device_ctx.rr_nodes[rr_node_idx];
861+
RRNodeId rr_node = RRNodeId(rr_node_idx);
861862
t_rr_node_power* node_power = &rr_node_power[rr_node_idx];
862863
float C_wire;
863864
float buffer_size;
864865
int connectionbox_fanout;
865866
int switchbox_fanout;
866867
//float C_per_seg_split;
867868
int wire_length;
868-
const t_edge_size node_fan_in = rr_graph.node_fan_in(RRNodeId(rr_node_idx));
869+
const t_edge_size node_fan_in = rr_graph.node_fan_in(rr_node);
869870

870-
switch (rr_graph.node_type(RRNodeId(rr_node_idx))) {
871+
switch (rr_graph.node_type(rr_node)) {
871872
case SOURCE:
872873
case SINK:
873874
case OPIN:
@@ -905,12 +906,12 @@ static void power_usage_routing(t_power_usage* power_usage,
905906
VTR_ASSERT(node_power->in_prob);
906907

907908
wire_length = 0;
908-
if (rr_graph.node_type(RRNodeId(rr_node_idx)) == CHANX) {
909-
wire_length = rr_graph.node_xhigh(node.id()) - rr_graph.node_xlow(node.id()) + 1;
910-
} else if (rr_graph.node_type(RRNodeId(rr_node_idx)) == CHANY) {
911-
wire_length = rr_graph.node_yhigh(node.id()) - rr_graph.node_ylow(node.id()) + 1;
909+
if (rr_graph.node_type(rr_node) == CHANX) {
910+
wire_length = rr_graph.node_xhigh(rr_node) - rr_graph.node_xlow(rr_node) + 1;
911+
} else if (rr_graph.node_type(rr_node) == CHANY) {
912+
wire_length = rr_graph.node_yhigh(rr_node) - rr_graph.node_ylow(rr_node) + 1;
912913
}
913-
int seg_index = device_ctx.rr_indexed_data[node.cost_index()].seg_index;
914+
int seg_index = device_ctx.rr_indexed_data[rr_graph.node_cost_index(rr_node)].seg_index;
914915
C_wire = wire_length * device_ctx.rr_segments[seg_index].Cmetal;
915916
//(double)power_ctx.commonly_used->tile_length);
916917
VTR_ASSERT(node_power->selected_input < node_fan_in);

vpr/src/route/check_rr_graph.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ void check_rr_node(int inode, enum e_route_type route_type, const DeviceContext&
295295
int xlow, ylow, xhigh, yhigh, ptc_num, capacity;
296296
t_rr_type rr_type;
297297
t_physical_tile_type_ptr type;
298-
int nodes_per_chan, tracks_per_node, num_edges, cost_index;
298+
int nodes_per_chan, tracks_per_node, num_edges;
299+
RRIndexedDataId cost_index;
299300
float C, R;
300301
const auto& rr_graph = device_ctx.rr_graph;
301302
RRNodeId rr_node = RRNodeId(inode);
@@ -307,7 +308,7 @@ void check_rr_node(int inode, enum e_route_type route_type, const DeviceContext&
307308
yhigh = rr_graph.node_yhigh(rr_node);
308309
ptc_num = device_ctx.rr_nodes[inode].ptc_num();
309310
capacity = rr_graph.node_capacity(rr_node);
310-
cost_index = device_ctx.rr_nodes[inode].cost_index();
311+
cost_index = rr_graph.node_cost_index(rr_node);
311312
type = nullptr;
312313

313314
const auto& grid = device_ctx.grid;
@@ -326,7 +327,7 @@ void check_rr_node(int inode, enum e_route_type route_type, const DeviceContext&
326327
"in check_rr_node: inode %d (type %d) had a ptc_num of %d.\n", inode, rr_type, ptc_num);
327328
}
328329

329-
if (cost_index < 0 || cost_index >= (int)device_ctx.rr_indexed_data.size()) {
330+
if (!cost_index || (size_t)cost_index >= (size_t)device_ctx.rr_indexed_data.size()) {
330331
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
331332
"in check_rr_node: node %d cost index (%d) is out of range.\n", inode, cost_index);
332333
}

vpr/src/route/clock_connection_builders.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
109109
rr_graph.set_node_ptc_num(node_index, ptc);
110110
rr_graph_builder.set_node_coordinates(node_index, x, y, x, y);
111111
rr_graph_builder.set_node_capacity(node_index, 1);
112-
rr_graph.set_node_cost_index(node_index, SINK_COST_INDEX);
113-
rr_graph.set_node_type(node_index, SINK);
112+
rr_graph.set_node_cost_index(node_index, RRIndexedDataId(SINK_COST_INDEX));
113+
rr_graph_builder.set_node_type(node_index, SINK);
114+
114115
float R = 0.;
115116
float C = 0.;
116117
rr_graph.set_node_rc_index(node_index, find_create_rr_rc_data(R, C));

vpr/src/route/clock_network_builders.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ int ClockRib::create_chanx_wire(int x_start,
319319
auto node = rr_nodes->back();
320320
RRNodeId chanx_node = RRNodeId(node_index);
321321

322+
rr_graph_builder.set_node_type(chanx_node, CHANX);
322323
rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y);
323-
node.set_type(CHANX);
324324
rr_graph_builder.set_node_capacity(chanx_node, 1);
325325
node.set_track_num(ptc_num);
326326
node.set_rc_index(find_create_rr_rc_data(
@@ -342,7 +342,7 @@ int ClockRib::create_chanx_wire(int x_start,
342342
VTR_ASSERT_MSG(false, "Unidentified direction type for clock rib");
343343
break;
344344
}
345-
node.set_cost_index(CHANX_COST_INDEX_START + seg_index); // Actual value set later
345+
node.set_cost_index(RRIndexedDataId(CHANX_COST_INDEX_START + seg_index)); // Actual value set later
346346

347347
/* Add the node to spatial lookup */
348348
auto& rr_graph = (*rr_nodes);
@@ -625,8 +625,8 @@ int ClockSpine::create_chany_wire(int y_start,
625625
auto node = rr_nodes->back();
626626
RRNodeId chany_node = RRNodeId(node_index);
627627

628+
rr_graph_builder.set_node_type(chany_node, CHANY);
628629
rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end);
629-
node.set_type(CHANY);
630630
rr_graph_builder.set_node_capacity(chany_node, 1);
631631
node.set_track_num(ptc_num);
632632
node.set_rc_index(find_create_rr_rc_data(
@@ -648,7 +648,7 @@ int ClockSpine::create_chany_wire(int y_start,
648648
VTR_ASSERT_MSG(false, "Unidentified direction type for clock rib");
649649
break;
650650
}
651-
node.set_cost_index(CHANX_COST_INDEX_START + num_segments + seg_index);
651+
node.set_cost_index(RRIndexedDataId(CHANX_COST_INDEX_START + num_segments + seg_index));
652652

653653
/* Add the node to spatial lookup */
654654
auto& rr_graph = (*rr_nodes);

vpr/src/route/route_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ float get_rr_cong_cost(int inode, float pres_fac);
3434
/* Returns the base cost of using this rr_node */
3535
inline float get_single_rr_cong_base_cost(int inode) {
3636
auto& device_ctx = g_vpr_ctx.device();
37-
auto cost_index = device_ctx.rr_nodes[inode].cost_index();
37+
auto cost_index = device_ctx.rr_graph.node_cost_index(RRNodeId(inode));
3838

3939
return device_ctx.rr_indexed_data[cost_index].base_cost;
4040
}
@@ -78,7 +78,7 @@ inline float get_single_rr_cong_cost(int inode, float pres_fac) {
7878
pres_cost = 1.;
7979
}
8080

81-
auto cost_index = device_ctx.rr_nodes[inode].cost_index();
81+
auto cost_index = rr_graph.node_cost_index(RRNodeId(inode));
8282

8383
float cost = device_ctx.rr_indexed_data[cost_index].base_cost * route_ctx.rr_node_route_inf[inode].acc_cost * pres_cost;
8484

vpr/src/route/route_timing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,10 +1550,10 @@ void update_rr_base_costs(int fanout) {
15501550
factor = sqrt(fanout);
15511551

15521552
for (index = CHANX_COST_INDEX_START; index < device_ctx.rr_indexed_data.size(); index++) {
1553-
if (device_ctx.rr_indexed_data[index].T_quadratic > 0.) { /* pass transistor */
1554-
device_ctx.rr_indexed_data[index].base_cost = device_ctx.rr_indexed_data[index].saved_base_cost * factor;
1553+
if (device_ctx.rr_indexed_data[RRIndexedDataId(index)].T_quadratic > 0.) { /* pass transistor */
1554+
device_ctx.rr_indexed_data[RRIndexedDataId(index)].base_cost = device_ctx.rr_indexed_data[RRIndexedDataId(index)].saved_base_cost * factor;
15551555
} else {
1556-
device_ctx.rr_indexed_data[index].base_cost = device_ctx.rr_indexed_data[index].saved_base_cost;
1556+
device_ctx.rr_indexed_data[RRIndexedDataId(index)].base_cost = device_ctx.rr_indexed_data[RRIndexedDataId(index)].saved_base_cost;
15571557
}
15581558
}
15591559
}

0 commit comments

Comments
 (0)