Merge pull request #130 from antmicro/rr_graph_load_fix
Fix for rr graph loading by VPR
This commit is contained in:
commit
6ba02f35ca
|
@ -70,7 +70,7 @@ static bool check_rr_graph_dangling_nodes(const RRGraph& rr_graph) {
|
||||||
if ((0 == rr_graph.node_fan_in(node))
|
if ((0 == rr_graph.node_fan_in(node))
|
||||||
&& (0 == rr_graph.node_fan_out(node))) {
|
&& (0 == rr_graph.node_fan_out(node))) {
|
||||||
/* Print a warning! */
|
/* Print a warning! */
|
||||||
VTR_LOG_WARN("Node %s is dangling (zero fan-in and zero fan-out)!\n",
|
VTR_LOG_WARN("Node %d is dangling (zero fan-in and zero fan-out)!\n",
|
||||||
node);
|
node);
|
||||||
VTR_LOG_WARN("Node details for debugging:\n");
|
VTR_LOG_WARN("Node details for debugging:\n");
|
||||||
rr_graph.print_node(node);
|
rr_graph.print_node(node);
|
||||||
|
|
|
@ -449,6 +449,10 @@ void RRGraph::print_node(const RRNodeId& node) const {
|
||||||
VTR_LOG("Node ptc: %d\n", node_ptc_num(node));
|
VTR_LOG("Node ptc: %d\n", node_ptc_num(node));
|
||||||
VTR_LOG("Node num in_edges: %d\n", node_in_edges(node).size());
|
VTR_LOG("Node num in_edges: %d\n", node_in_edges(node).size());
|
||||||
VTR_LOG("Node num out_edges: %d\n", node_out_edges(node).size());
|
VTR_LOG("Node num out_edges: %d\n", node_out_edges(node).size());
|
||||||
|
|
||||||
|
if (node_type(node) == CHANX || node_type(node) == CHANY) {
|
||||||
|
VTR_LOG("Node segment id: %d\n", node_segment(node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the segment id of a node is in range */
|
/* Check if the segment id of a node is in range */
|
||||||
|
|
|
@ -129,6 +129,11 @@ void load_rr_file(const t_graph_type graph_type,
|
||||||
|
|
||||||
VTR_LOG("Starting build routing resource graph...\n");
|
VTR_LOG("Starting build routing resource graph...\n");
|
||||||
|
|
||||||
|
/* Add segments */
|
||||||
|
for (const auto& inf : segment_inf) {
|
||||||
|
device_ctx.rr_graph.create_segment(inf);
|
||||||
|
}
|
||||||
|
|
||||||
next_component = get_first_child(rr_graph, "channels", loc_data);
|
next_component = get_first_child(rr_graph, "channels", loc_data);
|
||||||
t_chan_width nodes_per_chan;
|
t_chan_width nodes_per_chan;
|
||||||
process_channels(nodes_per_chan, grid, next_component, loc_data);
|
process_channels(nodes_per_chan, grid, next_component, loc_data);
|
||||||
|
@ -163,6 +168,15 @@ void load_rr_file(const t_graph_type graph_type,
|
||||||
//edge subsets. Must be done after RR switches have been allocated
|
//edge subsets. Must be done after RR switches have been allocated
|
||||||
device_ctx.rr_graph.rebuild_node_edges();
|
device_ctx.rr_graph.rebuild_node_edges();
|
||||||
|
|
||||||
|
//sets the cost index and seg id information
|
||||||
|
next_component = get_single_child(rr_graph, "rr_nodes", loc_data);
|
||||||
|
set_cost_indices(next_component, loc_data, is_global_graph, segment_inf.size());
|
||||||
|
|
||||||
|
alloc_and_load_rr_indexed_data(segment_inf, device_ctx.rr_graph,
|
||||||
|
max_chan_width, *wire_to_rr_ipin_switch, base_cost_type);
|
||||||
|
|
||||||
|
process_seg_id(next_component, loc_data);
|
||||||
|
|
||||||
/* Essential check for rr_graph, build look-up */
|
/* Essential check for rr_graph, build look-up */
|
||||||
if (false == device_ctx.rr_graph.validate()) {
|
if (false == device_ctx.rr_graph.validate()) {
|
||||||
/* Error out if built-in validator of rr_graph fails */
|
/* Error out if built-in validator of rr_graph fails */
|
||||||
|
@ -172,14 +186,6 @@ void load_rr_file(const t_graph_type graph_type,
|
||||||
"Fundamental errors occurred when validating rr_graph object!\n");
|
"Fundamental errors occurred when validating rr_graph object!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//sets the cost index and seg id information
|
|
||||||
next_component = get_single_child(rr_graph, "rr_nodes", loc_data);
|
|
||||||
set_cost_indices(next_component, loc_data, is_global_graph, segment_inf.size());
|
|
||||||
|
|
||||||
alloc_and_load_rr_indexed_data(segment_inf, device_ctx.rr_graph,
|
|
||||||
max_chan_width, *wire_to_rr_ipin_switch, base_cost_type);
|
|
||||||
|
|
||||||
process_seg_id(next_component, loc_data);
|
|
||||||
|
|
||||||
device_ctx.chan_width = nodes_per_chan;
|
device_ctx.chan_width = nodes_per_chan;
|
||||||
device_ctx.read_rr_graph_filename = std::string(read_rr_graph_name);
|
device_ctx.read_rr_graph_filename = std::string(read_rr_graph_name);
|
||||||
|
@ -292,6 +298,10 @@ void process_seg_id(pugi::xml_node parent, const pugiutil::loc_data& loc_data) {
|
||||||
if (attribute) {
|
if (attribute) {
|
||||||
int seg_id = get_attribute(segmentSubnode, "segment_id", loc_data).as_int(0);
|
int seg_id = get_attribute(segmentSubnode, "segment_id", loc_data).as_int(0);
|
||||||
device_ctx.rr_indexed_data[device_ctx.rr_graph.node_cost_index(node)].seg_index = seg_id;
|
device_ctx.rr_indexed_data[device_ctx.rr_graph.node_cost_index(node)].seg_index = seg_id;
|
||||||
|
|
||||||
|
// Assign node to a segment
|
||||||
|
device_ctx.rr_graph.set_node_segment(node, RRSegmentId(seg_id));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//-1 for non chanx or chany nodes
|
//-1 for non chanx or chany nodes
|
||||||
device_ctx.rr_indexed_data[device_ctx.rr_graph.node_cost_index(node)].seg_index = -1;
|
device_ctx.rr_indexed_data[device_ctx.rr_graph.node_cost_index(node)].seg_index = -1;
|
||||||
|
|
Loading…
Reference in New Issue