-
Notifications
You must be signed in to change notification settings - Fork 415
Deploy RRGraphBuilder
in RRGraph Clock Builder to replace the use of rr_node_indices
#1801
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c37643c
[VPR] Deploy RRGraphBuilder to clock network builder
tangxifan e6e2a2f
[VPR] Deploy RRSpatialLookup to clock connection builder
tangxifan 8804edd
[VPR] Delete unused functions
tangxifan 3dfafbf
[VPR] Code format fix
tangxifan 1f3c410
[VPR] Fix compiler warning
tangxifan d4a76f6
[VPR] Remove the hard requirement on side option when adding a node; …
tangxifan ab9dc4e
[VPR] Reworked RRSpatialLookup: added a private API find_nodes() to a…
tangxifan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,19 +52,17 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_ | |
std::srand(seed); | ||
|
||
auto& device_ctx = g_vpr_ctx.device(); | ||
auto& rr_node_indices = device_ctx.rr_node_indices; | ||
const auto& node_lookup = device_ctx.rr_graph.node_lookup(); | ||
|
||
int virtual_clock_network_root_idx = create_virtual_clock_network_sink_node(switch_location.x, switch_location.y); | ||
RRNodeId virtual_clock_network_root_idx = create_virtual_clock_network_sink_node(switch_location.x, switch_location.y); | ||
{ | ||
auto& mut_device_ctx = g_vpr_ctx.mutable_device(); | ||
mut_device_ctx.virtual_clock_network_root_idx = virtual_clock_network_root_idx; | ||
mut_device_ctx.virtual_clock_network_root_idx = size_t(virtual_clock_network_root_idx); | ||
} | ||
|
||
// rr_node indices for x and y channel routing wires and clock wires to connect to | ||
auto x_wire_indices = get_rr_node_chan_wires_at_location( | ||
rr_node_indices, CHANX, switch_location.x, switch_location.y); | ||
auto y_wire_indices = get_rr_node_chan_wires_at_location( | ||
rr_node_indices, CHANY, switch_location.x, switch_location.y); | ||
auto x_wire_indices = node_lookup.find_channel_nodes(switch_location.x, switch_location.y, CHANX); | ||
auto y_wire_indices = node_lookup.find_channel_nodes(switch_location.x, switch_location.y, CHANY); | ||
auto clock_indices = clock_graph.get_rr_node_indices_at_switch_location( | ||
clock_to_connect_to, switch_point_name, switch_location.x, switch_location.y); | ||
|
||
|
@@ -76,52 +74,53 @@ void RoutingToClockConnection::create_switches(const ClockRRGraphBuilder& clock_ | |
// Connect to x-channel wires | ||
unsigned num_wires_x = x_wire_indices.size() * fc; | ||
for (size_t i = 0; i < num_wires_x; i++) { | ||
clock_graph.add_edge(rr_edges_to_create, x_wire_indices[i], clock_index, arch_switch_idx); | ||
clock_graph.add_edge(rr_edges_to_create, size_t(x_wire_indices[i]), clock_index, arch_switch_idx); | ||
} | ||
|
||
// Connect to y-channel wires | ||
unsigned num_wires_y = y_wire_indices.size() * fc; | ||
for (size_t i = 0; i < num_wires_y; i++) { | ||
clock_graph.add_edge(rr_edges_to_create, y_wire_indices[i], clock_index, arch_switch_idx); | ||
clock_graph.add_edge(rr_edges_to_create, size_t(y_wire_indices[i]), clock_index, arch_switch_idx); | ||
} | ||
|
||
// Connect to virtual clock sink node | ||
// used by the two stage router | ||
clock_graph.add_edge(rr_edges_to_create, clock_index, virtual_clock_network_root_idx, arch_switch_idx); | ||
clock_graph.add_edge(rr_edges_to_create, clock_index, size_t(virtual_clock_network_root_idx), arch_switch_idx); | ||
} | ||
} | ||
|
||
int RoutingToClockConnection::create_virtual_clock_network_sink_node( | ||
int x, | ||
int y) { | ||
RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x, int y) { | ||
auto& device_ctx = g_vpr_ctx.mutable_device(); | ||
auto& rr_nodes = device_ctx.rr_nodes; | ||
rr_nodes.emplace_back(); | ||
auto node_index = rr_nodes.size() - 1; | ||
auto& rr_graph = device_ctx.rr_nodes; | ||
auto& node_lookup = device_ctx.rr_graph_builder.node_lookup(); | ||
rr_graph.emplace_back(); | ||
RRNodeId node_index = RRNodeId(rr_graph.size() - 1); | ||
|
||
//Determine the a valid PTC | ||
std::vector<int> nodes_at_loc; | ||
get_rr_node_indices(device_ctx.rr_node_indices, | ||
x, y, | ||
SINK, | ||
&nodes_at_loc); | ||
std::vector<RRNodeId> nodes_at_loc = node_lookup.find_sink_nodes(x, y); | ||
|
||
int max_ptc = 0; | ||
for (int inode : nodes_at_loc) { | ||
max_ptc = std::max<int>(max_ptc, device_ctx.rr_nodes[inode].ptc_num()); | ||
for (RRNodeId inode : nodes_at_loc) { | ||
max_ptc = std::max<int>(max_ptc, rr_graph.node_ptc_num(inode)); | ||
} | ||
int ptc = max_ptc + 1; | ||
|
||
rr_nodes[node_index].set_ptc_num(ptc); | ||
rr_nodes[node_index].set_coordinates(x, y, x, y); | ||
rr_nodes[node_index].set_capacity(1); | ||
rr_nodes[node_index].set_cost_index(SINK_COST_INDEX); | ||
rr_nodes[node_index].set_type(SINK); | ||
rr_graph.set_node_ptc_num(node_index, ptc); | ||
rr_graph.set_node_coordinates(node_index, x, y, x, y); | ||
rr_graph.set_node_capacity(node_index, 1); | ||
rr_graph.set_node_cost_index(node_index, SINK_COST_INDEX); | ||
rr_graph.set_node_type(node_index, SINK); | ||
float R = 0.; | ||
float C = 0.; | ||
rr_nodes[node_index].set_rc_index(find_create_rr_rc_data(R, C)); | ||
rr_graph.set_node_rc_index(node_index, find_create_rr_rc_data(R, C)); | ||
|
||
add_to_rr_node_indices(device_ctx.rr_node_indices, rr_nodes, node_index); | ||
// Use a generic way when adding nodes to lookup. | ||
// However, since the SINK node has the same xhigh/xlow as well as yhigh/ylow, we can probably use a shortcut | ||
for (int ix = rr_graph.node_xlow(node_index); ix <= rr_graph.node_xhigh(node_index); ++ix) { | ||
for (int iy = rr_graph.node_ylow(node_index); iy <= rr_graph.node_yhigh(node_index); ++iy) { | ||
node_lookup.add_node(node_index, ix, iy, rr_graph.node_type(node_index), rr_graph.node_ptc_num(node_index)); | ||
} | ||
} | ||
|
||
return node_index; | ||
} | ||
|
@@ -243,7 +242,7 @@ size_t ClockToPinsConnection::estimate_additional_nodes() { | |
|
||
void ClockToPinsConnection::create_switches(const ClockRRGraphBuilder& clock_graph, t_rr_edge_info_set* rr_edges_to_create) { | ||
auto& device_ctx = g_vpr_ctx.device(); | ||
auto& rr_node_indices = device_ctx.rr_node_indices; | ||
const auto& node_lookup = device_ctx.rr_graph.node_lookup(); | ||
auto& grid = clock_graph.grid(); | ||
|
||
for (size_t x = 0; x < grid.width(); x++) { | ||
|
@@ -304,13 +303,11 @@ void ClockToPinsConnection::create_switches(const ClockRRGraphBuilder& clock_gra | |
clock_y_offset = -1; // pick the chanx below the block | ||
} | ||
|
||
auto clock_pin_node_idx = get_rr_node_index( | ||
rr_node_indices, | ||
x, | ||
y, | ||
IPIN, | ||
clock_pin_idx, | ||
side); | ||
auto clock_pin_node_idx = node_lookup.find_node(x, | ||
y, | ||
IPIN, | ||
clock_pin_idx, | ||
side); | ||
|
||
auto clock_network_indices = clock_graph.get_rr_node_indices_at_switch_location( | ||
clock_to_connect_from, | ||
|
@@ -320,7 +317,7 @@ void ClockToPinsConnection::create_switches(const ClockRRGraphBuilder& clock_gra | |
|
||
//Create edges depending on Fc | ||
for (size_t i = 0; i < clock_network_indices.size() * fc; i++) { | ||
clock_graph.add_edge(rr_edges_to_create, clock_network_indices[i], clock_pin_node_idx, arch_switch_idx); | ||
clock_graph.add_edge(rr_edges_to_create, clock_network_indices[i], size_t(clock_pin_node_idx), arch_switch_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. Can we change the function prototype to avoid the cast (send in an RRNodeId instead)? 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. See my reply in a previous comment on the |
||
} | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.