-
Notifications
You must be signed in to change notification settings - Fork 414
RRGraphView edge_sink_node()/edge_switch() Implementation #1930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
975e37d
1f27d87
2203367
6d73d49
f28874f
8a3abba
e76f49c
ddaf9b1
026c13c
272d531
5fda3ee
3d8c9e9
e3c30e0
b73359f
61e0a9b
ae49c2c
353a0c4
d2de2b0
c4beebe
bccca16
52a60bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1689,7 +1689,7 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) { | |||
from_ptc_num = rr_graph.node_ptc_num(RRNodeId(inode)); | ||||
|
||||
for (t_edge_size iedge = 0, l = device_ctx.rr_nodes[inode].num_edges(); iedge < l; iedge++) { | ||||
umariqbal-rs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
to_node = device_ctx.rr_nodes[inode].edge_sink_node(iedge); | ||||
to_node = size_t(rr_graph.edge_sink_node(RRNodeId(inode), iedge)); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just read the codes of this function. It seems that we can eliminate the use of type casting Then in the rest of this function, you just replace
We can do it in a follow-up PR. Let me know what you think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But if we see at vtr-verilog-to-routing/vpr/src/draw/draw.cpp Line 1725 in 026c13c
here in this function argument to_node is as int type. Still RRNodeId(to_node) -> to_node Can be done ?We can do this by defining a new variable like auto to_node_temp=RRNodeId(inode) So we should by this way ?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @umariqbal-rs You can try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @umariqbal-rs Can you let me know how many times we have to do the type casting? If it is too much, we can stay with what we have. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tangxifan There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can stay with what we have now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So should I go on running QoR tests? |
||||
to_type = rr_graph.node_type(RRNodeId(to_node)); | ||||
to_ptc_num = rr_graph.node_ptc_num(RRNodeId(to_node)); | ||||
bool edge_configurable = device_ctx.rr_nodes[inode].edge_is_configurable(iedge); | ||||
|
@@ -1772,7 +1772,7 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) { | |||
} else { | ||||
g->set_color(blk_DARKGREEN); | ||||
} | ||||
switch_type = device_ctx.rr_nodes[inode].edge_switch(iedge); | ||||
switch_type = rr_graph.edge_switch(RRNodeId(inode), iedge); | ||||
umariqbal-rs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
draw_chanx_to_chanx_edge(RRNodeId(inode), RRNodeId(to_node), | ||||
to_ptc_num, switch_type, g); | ||||
break; | ||||
|
@@ -1789,7 +1789,7 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) { | |||
} else { | ||||
g->set_color(blk_DARKGREEN); | ||||
} | ||||
switch_type = device_ctx.rr_nodes[inode].edge_switch(iedge); | ||||
switch_type = rr_graph.edge_switch(RRNodeId(inode), iedge); | ||||
draw_chanx_to_chany_edge(inode, from_ptc_num, to_node, | ||||
to_ptc_num, FROM_X_TO_Y, switch_type, g); | ||||
break; | ||||
|
@@ -1842,7 +1842,7 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) { | |||
} else { | ||||
g->set_color(blk_DARKGREEN); | ||||
} | ||||
switch_type = device_ctx.rr_nodes[inode].edge_switch(iedge); | ||||
switch_type = rr_graph.edge_switch(RRNodeId(inode), iedge); | ||||
draw_chanx_to_chany_edge(to_node, to_ptc_num, inode, | ||||
from_ptc_num, FROM_Y_TO_X, switch_type, g); | ||||
break; | ||||
|
@@ -1860,7 +1860,7 @@ static void draw_rr_edges(int inode, ezgl::renderer* g) { | |||
} else { | ||||
g->set_color(blk_DARKGREEN); | ||||
} | ||||
switch_type = device_ctx.rr_nodes[inode].edge_switch(iedge); | ||||
switch_type = rr_graph.edge_switch(RRNodeId(inode), iedge); | ||||
draw_chany_to_chany_edge(RRNodeId(inode), RRNodeId(to_node), | ||||
to_ptc_num, switch_type, g); | ||||
break; | ||||
|
@@ -2519,7 +2519,7 @@ void draw_partial_route(const std::vector<int>& rr_nodes_to_draw, ezgl::renderer | |||
auto prev_type = rr_graph.node_type(RRNodeId(prev_node)); | ||||
|
||||
auto iedge = find_edge(prev_node, inode); | ||||
auto switch_type = device_ctx.rr_nodes[prev_node].edge_switch(iedge); | ||||
auto switch_type = rr_graph.edge_switch(RRNodeId(prev_node), iedge); | ||||
|
||||
switch (rr_type) { | ||||
case OPIN: { | ||||
|
@@ -2697,12 +2697,12 @@ void highlight_nets(char* message, int hit_node) { | |||
void draw_highlight_fan_in_fan_out(const std::set<int>& nodes) { | ||||
t_draw_state* draw_state = get_draw_state_vars(); | ||||
auto& device_ctx = g_vpr_ctx.device(); | ||||
|
||||
const auto& rr_graph = device_ctx.rr_graph; | ||||
for (auto node : nodes) { | ||||
/* Highlight the fanout nodes in red. */ | ||||
for (t_edge_size iedge = 0, l = device_ctx.rr_nodes[node].num_edges(); | ||||
iedge < l; iedge++) { | ||||
int fanout_node = device_ctx.rr_nodes[node].edge_sink_node(iedge); | ||||
int fanout_node = size_t(rr_graph.edge_sink_node(RRNodeId(node), iedge)); | ||||
|
||||
if (draw_state->draw_rr_node[node].color == ezgl::MAGENTA | ||||
&& draw_state->draw_rr_node[fanout_node].color | ||||
|
@@ -2721,8 +2721,7 @@ void draw_highlight_fan_in_fan_out(const std::set<int>& nodes) { | |||
for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) { | ||||
for (t_edge_size iedge = 0, l = device_ctx.rr_nodes[inode].num_edges(); iedge < l; | ||||
iedge++) { | ||||
int fanout_node = device_ctx.rr_nodes[inode].edge_sink_node( | ||||
iedge); | ||||
int fanout_node = size_t(rr_graph.edge_sink_node(RRNodeId(node), iedge)); | ||||
if (fanout_node == node) { | ||||
if (draw_state->draw_rr_node[node].color == ezgl::MAGENTA | ||||
&& draw_state->draw_rr_node[inode].color | ||||
|
@@ -2823,13 +2822,13 @@ std::set<int> draw_expand_non_configurable_rr_nodes(int from_node) { | |||
void draw_expand_non_configurable_rr_nodes_recurr(int from_node, | ||||
std::set<int>& expanded_nodes) { | ||||
auto& device_ctx = g_vpr_ctx.device(); | ||||
|
||||
const auto& rr_graph = device_ctx.rr_graph; | ||||
expanded_nodes.insert(from_node); | ||||
|
||||
for (t_edge_size iedge = 0; | ||||
iedge < device_ctx.rr_nodes[from_node].num_edges(); ++iedge) { | ||||
bool edge_configurable = device_ctx.rr_nodes[from_node].edge_is_configurable(iedge); | ||||
int to_node = device_ctx.rr_nodes[from_node].edge_sink_node(iedge); | ||||
int to_node = size_t(rr_graph.edge_sink_node(RRNodeId(from_node), iedge)); | ||||
|
||||
if (!edge_configurable && !expanded_nodes.count(to_node)) { | ||||
draw_expand_non_configurable_rr_nodes_recurr(to_node, | ||||
|
@@ -3783,9 +3782,10 @@ bool trace_routed_connection_rr_nodes_recurr(const t_rt_node* rt_node, | |||
//Find the edge between two rr nodes | ||||
static t_edge_size find_edge(int prev_inode, int inode) { | ||||
auto& device_ctx = g_vpr_ctx.device(); | ||||
const auto& rr_graph = device_ctx.rr_graph; | ||||
for (t_edge_size iedge = 0; | ||||
iedge < device_ctx.rr_nodes[prev_inode].num_edges(); ++iedge) { | ||||
umariqbal-rs marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
if (device_ctx.rr_nodes[prev_inode].edge_sink_node(iedge) == inode) { | ||||
if (size_t(rr_graph.edge_sink_node(RRNodeId(prev_inode), iedge)) == size_t(inode)) { | ||||
return iedge; | ||||
} | ||||
} | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1167,16 +1167,16 @@ bool directconnect_exists(int src_rr_node, int sink_rr_node) { | |
|
||
//TODO: This is a constant depth search, but still may be too slow | ||
for (t_edge_size i_src_edge = 0; i_src_edge < rr_nodes[src_rr_node].num_edges(); ++i_src_edge) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
int opin_rr_node = rr_nodes[src_rr_node].edge_sink_node(i_src_edge); | ||
int opin_rr_node = size_t(rr_graph.edge_sink_node(RRNodeId(src_rr_node), i_src_edge)); | ||
|
||
if (rr_graph.node_type(RRNodeId(opin_rr_node)) != OPIN) continue; | ||
|
||
for (t_edge_size i_opin_edge = 0; i_opin_edge < rr_nodes[opin_rr_node].num_edges(); ++i_opin_edge) { | ||
int ipin_rr_node = rr_nodes[opin_rr_node].edge_sink_node(i_opin_edge); | ||
int ipin_rr_node = size_t(rr_graph.edge_sink_node(RRNodeId(opin_rr_node), i_opin_edge)); | ||
if (rr_graph.node_type(RRNodeId(ipin_rr_node)) != IPIN) continue; | ||
|
||
for (t_edge_size i_ipin_edge = 0; i_ipin_edge < rr_nodes[ipin_rr_node].num_edges(); ++i_ipin_edge) { | ||
if (sink_rr_node == rr_nodes[ipin_rr_node].edge_sink_node(i_ipin_edge)) { | ||
if (size_t(sink_rr_node) == size_t(rr_graph.edge_sink_node(RRNodeId(ipin_rr_node), i_ipin_edge))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the for loop (starting from LINE 1169), we can change the data type of
I see in LINE 1174, the |
||
return true; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -822,8 +822,8 @@ static void power_usage_routing(t_power_usage* power_usage, | |
} | ||
|
||
for (t_edge_size edge_idx = 0; edge_idx < node.num_edges(); edge_idx++) { | ||
umariqbal-rs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const auto& next_node_id = node.edge_sink_node(edge_idx); | ||
if (next_node_id != OPEN) { | ||
const auto& next_node_id = size_t(rr_graph.edge_sink_node(RRNodeId(trace->index), edge_idx)); | ||
if (next_node_id != size_t(OPEN)) { | ||
t_rr_node_power* next_node_power = &rr_node_power[next_node_id]; | ||
|
||
switch (rr_graph.node_type(RRNodeId(next_node_id))) { | ||
|
@@ -982,9 +982,9 @@ static void power_usage_routing(t_power_usage* power_usage, | |
connectionbox_fanout = 0; | ||
switchbox_fanout = 0; | ||
for (t_edge_size iedge = 0; iedge < node.num_edges(); iedge++) { | ||
if (node.edge_switch(iedge) == routing_arch->wire_to_rr_ipin_switch) { | ||
if (rr_graph.edge_switch(RRNodeId(rr_node_idx), iedge) == routing_arch->wire_to_rr_ipin_switch) { | ||
umariqbal-rs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
connectionbox_fanout++; | ||
} else if (node.edge_switch(iedge) == routing_arch->delayless_switch) { | ||
} else if (rr_graph.edge_switch(RRNodeId(rr_node_idx), iedge) == routing_arch->delayless_switch) { | ||
/* Do nothing */ | ||
} else { | ||
switchbox_fanout++; | ||
|
@@ -1226,9 +1226,9 @@ void power_routing_init(const t_det_routing_arch* routing_arch) { | |
case CHANX: | ||
case CHANY: | ||
for (t_edge_size iedge = 0; iedge < node.num_edges(); iedge++) { | ||
umariqbal-rs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (node.edge_switch(iedge) == routing_arch->wire_to_rr_ipin_switch) { | ||
if (rr_graph.edge_switch(RRNodeId(rr_node_idx), iedge) == routing_arch->wire_to_rr_ipin_switch) { | ||
fanout_to_IPIN++; | ||
} else if (node.edge_switch(iedge) != routing_arch->delayless_switch) { | ||
} else if (rr_graph.edge_switch(RRNodeId(rr_node_idx), iedge) != routing_arch->delayless_switch) { | ||
fanout_to_seg++; | ||
} | ||
} | ||
|
@@ -1261,11 +1261,11 @@ void power_routing_init(const t_det_routing_arch* routing_arch) { | |
auto node = device_ctx.rr_nodes[rr_node_idx]; | ||
|
||
for (t_edge_size edge_idx = 0; edge_idx < node.num_edges(); edge_idx++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. |
||
if (node.edge_sink_node(edge_idx) != OPEN) { | ||
if (rr_node_power[node.edge_sink_node(edge_idx)].driver_switch_type == OPEN) { | ||
rr_node_power[node.edge_sink_node(edge_idx)].driver_switch_type = node.edge_switch(edge_idx); | ||
if (size_t(rr_graph.edge_sink_node(RRNodeId(rr_node_idx), edge_idx)) != size_t(OPEN)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the new API, you do not need the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I will do that on Monday. |
||
if (rr_node_power[size_t(rr_graph.edge_sink_node(RRNodeId(rr_node_idx), edge_idx))].driver_switch_type == OPEN) { | ||
rr_node_power[size_t(rr_graph.edge_sink_node(RRNodeId(rr_node_idx), edge_idx))].driver_switch_type = rr_graph.edge_switch(RRNodeId(rr_node_idx), edge_idx); | ||
} else { | ||
VTR_ASSERT(rr_node_power[node.edge_sink_node(edge_idx)].driver_switch_type == node.edge_switch(edge_idx)); | ||
VTR_ASSERT(rr_node_power[size_t(rr_graph.edge_sink_node(RRNodeId(rr_node_idx), edge_idx))].driver_switch_type == rr_graph.edge_switch(RRNodeId(rr_node_idx), edge_idx)); | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,7 +310,7 @@ static bool check_adjacent(int from_node, int to_node) { | |
reached = false; | ||
|
||
for (t_edge_size iconn = 0; iconn < device_ctx.rr_nodes[from_node].num_edges(); iconn++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
if (device_ctx.rr_nodes[from_node].edge_sink_node(iconn) == to_node) { | ||
if (size_t(rr_graph.edge_sink_node(RRNodeId(from_node), iconn)) == size_t(to_node)) { | ||
reached = true; | ||
break; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.