Skip to content

Commit 09c90f2

Browse files
committed
[libs][rr_graph] mode bend_start/end out of t_rr_node_data
1 parent 5436025 commit 09c90f2

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

libs/librrgraph/src/base/rr_graph_storage.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,11 @@ void t_rr_graph_storage::set_node_coordinates(RRNodeId id, short x1, short y1, s
779779
}
780780

781781
void t_rr_graph_storage::set_node_bend_start(RRNodeId id, size_t bend_start) {
782-
auto& node = node_storage_[id];
783-
node.node_bend_start_ = bend_start;
782+
node_bend_start_[id] = bend_start;
784783
}
785784

786785
void t_rr_graph_storage::set_node_bend_end(RRNodeId id, size_t bend_end) {
787-
auto& node = node_storage_[id];
788-
node.node_bend_end_ = bend_end;
786+
node_bend_end_[id] = bend_end;
789787
}
790788

791789
void t_rr_graph_storage::set_node_cost_index(RRNodeId id, RRIndexedDataId new_cost_index) {
@@ -870,7 +868,9 @@ t_rr_graph_view t_rr_graph_storage::view() const {
870868
vtr::make_const_array_view_id(edge_src_node_),
871869
vtr::make_const_array_view_id(edge_dest_node_),
872870
vtr::make_const_array_view_id(edge_switch_),
873-
virtual_clock_network_root_idx_);
871+
virtual_clock_network_root_idx_,
872+
vtr::make_const_array_view_id(node_bend_start_),
873+
vtr::make_const_array_view_id(node_bend_end_));
874874
}
875875

876876
// Given `order`, a vector mapping each RRNodeId to a new one (old -> new),

libs/librrgraph/src/base/rr_graph_storage.h

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
* side: The side of a grid location where an IPIN or OPIN is located. *
5252
* This field is valid only for IPINs and OPINs and should be ignored *
5353
* otherwise. */
54-
struct alignas(32) t_rr_node_data {
54+
struct alignas(16) t_rr_node_data {
5555
int16_t cost_index_ = -1;
5656
int16_t rc_index_ = -1;
5757

@@ -60,9 +60,6 @@ struct alignas(32) t_rr_node_data {
6060
int16_t xhigh_ = -1;
6161
int16_t yhigh_ = -1;
6262

63-
int16_t node_bend_start_ = 0;
64-
int16_t node_bend_end_ = 0;
65-
6663
e_rr_type type_ = e_rr_type::NUM_RR_TYPES;
6764

6865
/* The character is a hex number which is a 4-bit truth table for node sides
@@ -86,8 +83,8 @@ struct alignas(32) t_rr_node_data {
8683
// t_rr_node_data is a key data structure, so fail at compile time if the
8784
// structure gets bigger than expected (16 bytes right now). Developers
8885
// should only expand it after careful consideration and measurement.
89-
static_assert(sizeof(t_rr_node_data) == 32, "Check t_rr_node_data size");
90-
static_assert(alignof(t_rr_node_data) == 32, "Check t_rr_node_data size");
86+
static_assert(sizeof(t_rr_node_data) == 16, "Check t_rr_node_data size");
87+
static_assert(alignof(t_rr_node_data) == 16, "Check t_rr_node_data size");
9188

9289
/* t_rr_node_ptc_data is cold data is therefore kept seperate from
9390
* t_rr_node_data.
@@ -188,10 +185,10 @@ class t_rr_graph_storage {
188185
}
189186

190187
short node_bend_start(RRNodeId id) const {
191-
return node_storage_[id].node_bend_start_;
188+
return node_bend_start_[id];
192189
}
193190
short node_bend_end(RRNodeId id) const {
194-
return node_storage_[id].node_bend_end_;
191+
return node_bend_end_[id];
195192
}
196193

197194
short node_capacity(RRNodeId id) const {
@@ -932,6 +929,14 @@ class t_rr_graph_storage {
932929
*/
933930
vtr::vector<RREdgeId, bool> edge_remapped_;
934931

932+
/** @brief
933+
* Bend start and end are used to store the bend information for each node.
934+
* Bend start and end are only used for CHANX and CHANY nodes.
935+
* Bend start and end are only used for tileable routing resource graph.
936+
*/
937+
vtr::vector<RRNodeId, int16_t> node_bend_start_;
938+
vtr::vector<RRNodeId, int16_t> node_bend_end_;
939+
935940
/***************
936941
* State flags *
937942
***************/
@@ -986,7 +991,9 @@ class t_rr_graph_view {
986991
const vtr::array_view_id<RREdgeId, const RRNodeId> edge_src_node,
987992
const vtr::array_view_id<RREdgeId, const RRNodeId> edge_dest_node,
988993
const vtr::array_view_id<RREdgeId, const short> edge_switch,
989-
const std::unordered_map<std::string, RRNodeId>& virtual_clock_network_root_idx)
994+
const std::unordered_map<std::string, RRNodeId>& virtual_clock_network_root_idx,
995+
const vtr::array_view_id<RRNodeId, const int16_t> node_bend_start,
996+
const vtr::array_view_id<RRNodeId, const int16_t> node_bend_end)
990997
: node_storage_(node_storage)
991998
, node_ptc_(node_ptc)
992999
, node_first_edge_(node_first_edge)
@@ -997,7 +1004,9 @@ class t_rr_graph_view {
9971004
, edge_src_node_(edge_src_node)
9981005
, edge_dest_node_(edge_dest_node)
9991006
, edge_switch_(edge_switch)
1000-
, virtual_clock_network_root_idx_(virtual_clock_network_root_idx) {}
1007+
, virtual_clock_network_root_idx_(virtual_clock_network_root_idx)
1008+
, node_bend_start_(node_bend_start)
1009+
, node_bend_end_(node_bend_end) {}
10011010

10021011
/****************
10031012
* Node methods *
@@ -1218,4 +1227,7 @@ class t_rr_graph_view {
12181227
vtr::array_view_id<RREdgeId, const short> edge_switch_;
12191228
const std::unordered_map<std::string, RRNodeId>& virtual_clock_network_root_idx_;
12201229

1230+
vtr::array_view_id<RRNodeId, const int16_t> node_bend_start_;
1231+
vtr::array_view_id<RRNodeId, const int16_t> node_bend_end_;
1232+
12211233
};

0 commit comments

Comments
 (0)