Skip to content

Commit 09bbfab

Browse files
A cached version of RRGraphView added in rr_graph_uxsdcxx_serializer.h.
1 parent 88c5785 commit 09bbfab

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vpr/src/route/rr_graph_uxsdcxx_serializer.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,17 @@ class t_metadata_dict_iterator {
145145

146146
class EdgeWalker {
147147
public:
148-
void initialize(const t_rr_graph_storage* nodes) {
148+
void initialize(const t_rr_graph_storage* nodes, RRGraphView* rr_graph) {
149149
nodes_ = nodes;
150+
rr_graph_ = rr_graph;
150151
num_edges_ = 0;
151152
current_src_inode_ = 0;
152153
current_edge_ = 0;
153154
current_idx_ = 0;
154155

156+
// TODO: Once rr_graph_storage is fully shadowed by RRGraphView, the cached nodes_ will be removed.
155157
for (const auto& node : *nodes) {
156-
num_edges_ += nodes_->num_edges(node.id());
158+
num_edges_ += rr_graph_->num_edges(node.id());
157159
}
158160
}
159161

@@ -181,7 +183,7 @@ class EdgeWalker {
181183
current_edge_ += 1;
182184
}
183185

184-
if (current_edge_ >= nodes_->num_edges(RRNodeId(current_src_inode_))) {
186+
if (current_edge_ >= rr_graph_->num_edges(RRNodeId(current_src_inode_))) {
185187
// Done with current_src_inode_, advance to the end of the
186188
// node list, or the next node with at least 1 edge.
187189
current_edge_ = 0;
@@ -194,7 +196,7 @@ class EdgeWalker {
194196
VTR_ASSERT(current_idx_ + 1 == num_edges_);
195197
return current_idx_++;
196198
}
197-
} while (nodes_->num_edges(RRNodeId(current_src_inode_)) < 1);
199+
} while (rr_graph_->num_edges(RRNodeId(current_src_inode_)) < 1);
198200
}
199201

200202
VTR_ASSERT(current_src_inode_ < nodes_->size());
@@ -204,6 +206,7 @@ class EdgeWalker {
204206

205207
private:
206208
const t_rr_graph_storage* nodes_;
209+
RRGraphView* rr_graph_;
207210
size_t num_edges_;
208211
size_t current_src_inode_;
209212
size_t current_edge_;
@@ -999,7 +1002,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
9991002

10001003
inline EdgeWalker get_rr_graph_rr_edges(void*& /*ctx*/) final {
10011004
EdgeWalker walker;
1002-
walker.initialize(rr_nodes_);
1005+
walker.initialize(rr_nodes_,rr_graph_);
10031006
return walker;
10041007
}
10051008

0 commit comments

Comments
 (0)