Skip to content

Add a new API set_node_rc_index() to RRGraphBuilder #1887

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 7 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vpr/src/device/rr_graph_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ class RRGraphBuilder {
node_storage_.set_node_direction(id, new_direction);
}

/** @brief Set the rc_index of routing resource node. */
inline void set_node_rc_index(RRNodeId id, short new_rc_index) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hariszafar-lm I had a discussion with @vaughnbetz . We believe it is better to use a strong id here, e.g., NodeRcIndex, rather than an integer. Can you look into the implementation here:

struct rr_indexed_data_id_tag;

And then create a strong id for the RC index? For internal data of RRGraphBuilder, you can still use integer.
But for the API, we force the use of strong ids.

Let me know if this makes sense or not.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tangxifan, could you review it now. I had created and implemented strong id for it in this commit.

node_storage_.set_node_rc_index(id, new_rc_index);
}

/* -- Internal data storage -- */
private:
/* TODO: When the refactoring effort finishes,
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/clock_connection_builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,

float R = 0.;
float C = 0.;
rr_graph.set_node_rc_index(node_index, find_create_rr_rc_data(R, C));
rr_graph_builder.set_node_rc_index(node_index, find_create_rr_rc_data(R, C));

// 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
Expand Down
8 changes: 4 additions & 4 deletions vpr/src/route/clock_network_builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ int ClockRib::create_chanx_wire(int x_start,
rr_graph_builder.set_node_coordinates(chanx_node, x_start, y, x_end, y);
rr_graph_builder.set_node_capacity(chanx_node, 1);
rr_graph_builder.set_node_track_num(chanx_node, ptc_num);
node.set_rc_index(find_create_rr_rc_data(
x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal));
rr_graph_builder.set_node_rc_index(chanx_node, find_create_rr_rc_data(
x_chan_wire.layer.r_metal, x_chan_wire.layer.c_metal));
rr_graph_builder.set_node_direction(chanx_node, direction);

short seg_index = 0;
Expand Down Expand Up @@ -629,8 +629,8 @@ int ClockSpine::create_chany_wire(int y_start,
rr_graph_builder.set_node_coordinates(chany_node, x, y_start, x, y_end);
rr_graph_builder.set_node_capacity(chany_node, 1);
rr_graph_builder.set_node_track_num(chany_node, ptc_num);
node.set_rc_index(find_create_rr_rc_data(
y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal));
rr_graph_builder.set_node_rc_index(chany_node, find_create_rr_rc_data(
y_chan_wire.layer.r_metal, y_chan_wire.layer.c_metal));
rr_graph_builder.set_node_direction(chany_node, direction);

short seg_index = 0;
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/route/rr_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
rr_graph_builder.set_node_coordinates(inode, i, j, i + type->width - 1, j + type->height - 1);
float R = 0.;
float C = 0.;
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
rr_graph_builder.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hariszafar-lm If you see any functions in rr_graph.cpp and rr_graph2.cpp which no longer use the old data structure L_rr_node, please take a note. We can create a separated pull request where we rework the input argument list by using RRGraphBuilder and RRGraphView. Let me know what you think.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, I'll create a separate PR for this.

rr_graph_builder.set_node_class_num(inode, iclass);
}

Expand Down Expand Up @@ -1485,7 +1485,7 @@ static void build_rr_sinks_sources(RRGraphBuilder& rr_graph_builder,
rr_graph_builder.set_node_capacity(inode, 1);
float R = 0.;
float C = 0.;
L_rr_node.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
rr_graph_builder.set_node_rc_index(inode, find_create_rr_rc_data(R, C));
rr_graph_builder.set_node_pin_num(inode, ipin);

//Note that we store the grid tile location and side where the pin is located,
Expand Down Expand Up @@ -1674,7 +1674,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
int length = end - start + 1;
float R = length * seg_details[track].Rmetal();
float C = length * seg_details[track].Cmetal();
L_rr_node.set_node_rc_index(node, find_create_rr_rc_data(R, C));
rr_graph_builder.set_node_rc_index(node, find_create_rr_rc_data(R, C));

rr_graph_builder.set_node_type(node, chan_type);
rr_graph_builder.set_node_track_num(node, track);
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/route/rr_graph_timing_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void add_rr_graph_C_from_switches(float C_ipin_cblock) {

//Create the final flywieghted t_rr_rc_data
for (size_t inode = 0; inode < device_ctx.rr_nodes.size(); inode++) {
mutable_device_ctx.rr_nodes[inode].set_rc_index(find_create_rr_rc_data(rr_graph.node_R(RRNodeId(inode)), rr_node_C[inode]));
mutable_device_ctx.rr_graph_builder.set_node_rc_index(RRNodeId(inode), find_create_rr_rc_data(rr_graph.node_R(RRNodeId(inode)), rr_node_C[inode]));
}

free(Couts_to_add);
Expand Down
5 changes: 3 additions & 2 deletions vpr/src/route/rr_graph_uxsdcxx_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
*/
inline int init_node_timing(int& inode, float C, float R) final {
auto node = (*rr_nodes_)[inode];
node.set_rc_index(find_create_rr_rc_data(R, C));
RRNodeId node_id = node.id();
rr_graph_builder_->set_node_rc_index(node_id, find_create_rr_rc_data(R, C));
return inode;
}
inline void finish_node_timing(int& /*inode*/) final {}
Expand Down Expand Up @@ -789,7 +790,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
type);
}

node.set_rc_index(find_create_rr_rc_data(0, 0));
rr_graph_builder_->set_node_rc_index(node_id, find_create_rr_rc_data(0, 0));

return id;
}
Expand Down
4 changes: 0 additions & 4 deletions vpr/src/route/rr_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ void t_rr_node::set_cost_index(RRIndexedDataId new_cost_index) {
storage_->set_node_cost_index(id_, new_cost_index);
}

void t_rr_node::set_rc_index(short new_rc_index) {
storage_->set_node_rc_index(id_, new_rc_index);
}

void t_rr_node::add_side(e_side new_side) {
storage_->add_node_side(id_, new_side);
}
1 change: 0 additions & 1 deletion vpr/src/route/rr_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class t_rr_node {

public: //Mutators
void set_cost_index(RRIndexedDataId);
void set_rc_index(short);

void set_side(e_side);
void add_side(e_side);
Expand Down