@@ -106,34 +106,17 @@ struct PLNetCost {
106
106
107
107
/* The following arrays are used by the try_swap function for speed. */
108
108
109
- /* *
110
- * @brief The wire length estimation is based on the bounding box of the net. In the case of the 2D architecture,
111
- * we use a 3D BB with the z-dimension (layer) set to 1. In the case of 3D architecture, there 2 types of bounding box:
112
- * 3D and per-layer. The type is determined at the beginning of the placement and stored in the placement context.
113
- * If the bonding box is of the type 3D, ts_bb_coord_new and ts_bb_edge_new are used. Otherwise, layer_ts_bb_edge_new and
114
- * layer_ts_bb_coord_new are used.
115
- */
116
109
117
- struct TSInfo {
118
- /* [0...cluster_ctx.clb_nlist.nets().size()-1] -> 3D bounding box*/
119
- vtr::vector<ClusterNetId, t_bb> ts_bb_coord_new, ts_bb_edge_new;
120
- /* [0...cluster_ctx.clb_nlist.nets().size()-1][0...num_layers-1] -> 2D bonding box on a layer*/
121
- vtr::vector<ClusterNetId, std::vector<t_2D_bb>> layer_ts_bb_edge_new, layer_ts_bb_coord_new;
122
- /* [0...cluster_ctx.clb_nlist.nets().size()-1][0...num_layers-1] -> number of sink pins on a layer*/
123
- vtr::Matrix<int > ts_layer_sink_pin_count;
124
- /* [0...num_afftected_nets] -> net_id of the affected nets */
125
- std::vector<ClusterNetId> ts_nets_to_update;
126
- // TSInfo(const TSInfo&) = delete;
127
- // TSInfo(TSInfo&&) = delete;
128
- };
110
+
111
+ // struct TSInfo {
112
+ //
113
+ // };
129
114
130
115
131
116
} // namespace
132
117
133
118
static struct PLNetCost pl_net_cost;
134
119
135
- static struct TSInfo ts_info;
136
-
137
120
138
121
/* *
139
122
* @param net
@@ -143,17 +126,6 @@ static struct TSInfo ts_info;
143
126
static bool driven_by_moved_block (const ClusterNetId net,
144
127
const std::vector<t_pl_moved_block>& moved_blocks);
145
128
146
-
147
-
148
-
149
- /* *
150
- * @brief if "net" is not already stored as an affected net, add it in ts_nets_to_update.
151
- * @param net ID of a net affected by a move
152
- */
153
- static void record_affected_net (const ClusterNetId net);
154
-
155
-
156
-
157
129
/* *
158
130
* @brief Given the per-layer BB, calculate the wire-length cost of the net on each layer
159
131
* and return the sum of the costs
@@ -385,12 +357,12 @@ void NetCostHandler::update_td_delta_costs_(const PlaceDelayModel* delay_model,
385
357
}
386
358
387
359
// /@brief Record effected nets.
388
- static void record_affected_net (const ClusterNetId net) {
360
+ void NetCostHandler::record_affected_net_ (const ClusterNetId net) {
389
361
/* Record effected nets. */
390
362
if (pl_net_cost.proposed_net_cost [net] < 0 .) {
391
363
/* Net not marked yet. */
392
- VTR_ASSERT_SAFE (ts_info. ts_nets_to_update . size () < ts_info. ts_nets_to_update .capacity ());
393
- ts_info. ts_nets_to_update .push_back (net);
364
+ VTR_ASSERT_SAFE (ts_nets_to_update_. size () < ts_nets_to_update_ .capacity ());
365
+ ts_nets_to_update_ .push_back (net);
394
366
395
367
/* Flag to say we've marked this net. */
396
368
pl_net_cost.proposed_net_cost [net] = 1 .;
@@ -418,7 +390,7 @@ void NetCostHandler::update_net_info_on_pin_move_(const t_place_algorithm& place
418
390
}
419
391
420
392
/* Record effected nets */
421
- record_affected_net (net_id);
393
+ record_affected_net_ (net_id);
422
394
423
395
/* Update the net bounding boxes. */
424
396
update_net_bb_ (net_id, blk_id, pin_id, moving_blk_inf);
@@ -1557,7 +1529,7 @@ static double wirelength_crossing_count(size_t fanout) {
1557
1529
}
1558
1530
1559
1531
void NetCostHandler::set_bb_delta_cost_ (double & bb_delta_c) {
1560
- for (const ClusterNetId ts_net: ts_info. ts_nets_to_update ) {
1532
+ for (const ClusterNetId ts_net: ts_nets_to_update_ ) {
1561
1533
ClusterNetId net_id = ts_net;
1562
1534
1563
1535
pl_net_cost.proposed_net_cost [net_id] = get_net_cost_ (net_id);
@@ -1576,7 +1548,7 @@ void NetCostHandler::find_affected_nets_and_update_costs(const t_place_algorithm
1576
1548
VTR_ASSERT_SAFE (timing_delta_c == 0 .);
1577
1549
auto & clb_nlist = g_vpr_ctx.clustering ().clb_nlist ;
1578
1550
1579
- ts_info. ts_nets_to_update .resize (0 );
1551
+ ts_nets_to_update_ .resize (0 );
1580
1552
1581
1553
/* Go through all the blocks moved. */
1582
1554
for (const auto & block : blocks_affected.moved_blocks ) {
@@ -1693,13 +1665,13 @@ void NetCostHandler::update_move_nets() {
1693
1665
auto & cluster_ctx = g_vpr_ctx.clustering ();
1694
1666
auto & place_move_ctx = placer_ctx_.mutable_move ();
1695
1667
1696
- for (const ClusterNetId ts_net : ts_info. ts_nets_to_update ) {
1668
+ for (const ClusterNetId ts_net : ts_nets_to_update_ ) {
1697
1669
ClusterNetId net_id = ts_net;
1698
1670
1699
1671
set_ts_bb_coord_ (net_id);
1700
1672
1701
1673
for (int layer_num = 0 ; layer_num < g_vpr_ctx.device ().grid .get_num_layers (); layer_num++) {
1702
- place_move_ctx.num_sink_pin_layer [size_t (net_id)][layer_num] = ts_info. ts_layer_sink_pin_count [size_t (net_id)][layer_num];
1674
+ place_move_ctx.num_sink_pin_layer [size_t (net_id)][layer_num] = ts_layer_sink_pin_count_ [size_t (net_id)][layer_num];
1703
1675
}
1704
1676
1705
1677
if (cluster_ctx.clb_nlist .net_sinks (net_id).size () >= SMALL_NET) {
@@ -1716,7 +1688,7 @@ void NetCostHandler::update_move_nets() {
1716
1688
1717
1689
void NetCostHandler::reset_move_nets () {
1718
1690
/* Reset the net cost function flags first. */
1719
- for (const ClusterNetId ts_net : ts_info. ts_nets_to_update ) {
1691
+ for (const ClusterNetId ts_net : ts_nets_to_update_ ) {
1720
1692
ClusterNetId net_id = ts_net;
1721
1693
pl_net_cost.proposed_net_cost [net_id] = -1 ;
1722
1694
pl_net_cost.bb_update_status [net_id] = NetUpdateState::NOT_UPDATED_YET;
@@ -1897,12 +1869,12 @@ void NetCostHandler::free_place_move_structs() {
1897
1869
}
1898
1870
1899
1871
void NetCostHandler::free_try_swap_net_cost_structs () {
1900
- vtr::release_memory (ts_info. ts_bb_edge_new );
1901
- vtr::release_memory (ts_info. ts_bb_coord_new );
1902
- vtr::release_memory (ts_info. layer_ts_bb_edge_new );
1903
- vtr::release_memory (ts_info. layer_ts_bb_coord_new );
1904
- ts_info. ts_layer_sink_pin_count .clear ();
1905
- vtr::release_memory (ts_info. ts_nets_to_update );
1872
+ vtr::release_memory (ts_bb_edge_new_ );
1873
+ vtr::release_memory (ts_bb_coord_new_ );
1874
+ vtr::release_memory (layer_ts_bb_edge_new_ );
1875
+ vtr::release_memory (layer_ts_bb_coord_new_ );
1876
+ ts_layer_sink_pin_count_ .clear ();
1877
+ vtr::release_memory (ts_nets_to_update_ );
1906
1878
}
1907
1879
1908
1880
NetCostHandler::NetCostHandler (PlacerContext& placer_ctx, size_t num_nets, bool cube_bb, float place_cost_exp)
@@ -1912,19 +1884,19 @@ NetCostHandler::NetCostHandler(PlacerContext& placer_ctx, size_t num_nets, bool
1912
1884
1913
1885
// Either 3D BB or per layer BB data structure are used, not both.
1914
1886
if (cube_bb_) {
1915
- ts_info. ts_bb_edge_new .resize (num_nets, t_bb ());
1916
- ts_info. ts_bb_coord_new .resize (num_nets, t_bb ());
1887
+ ts_bb_edge_new_ .resize (num_nets, t_bb ());
1888
+ ts_bb_coord_new_ .resize (num_nets, t_bb ());
1917
1889
comp_bb_cost_functor_ = std::bind (&NetCostHandler::comp_3d_bb_cost_, this , std::placeholders::_1);
1918
1890
} else {
1919
- ts_info. layer_ts_bb_edge_new .resize (num_nets, std::vector<t_2D_bb>(num_layers, t_2D_bb ()));
1920
- ts_info. layer_ts_bb_coord_new .resize (num_nets, std::vector<t_2D_bb>(num_layers, t_2D_bb ()));
1891
+ layer_ts_bb_edge_new_ .resize (num_nets, std::vector<t_2D_bb>(num_layers, t_2D_bb ()));
1892
+ layer_ts_bb_coord_new_ .resize (num_nets, std::vector<t_2D_bb>(num_layers, t_2D_bb ()));
1921
1893
comp_bb_cost_functor_ = std::bind (&NetCostHandler::comp_per_layer_bb_cost_, this , std::placeholders::_1);
1922
1894
}
1923
1895
1924
1896
/* This initializes the whole matrix to OPEN which is an invalid value*/
1925
- ts_info. ts_layer_sink_pin_count .resize ({num_nets, size_t (num_layers)}, OPEN);
1897
+ ts_layer_sink_pin_count_ .resize ({num_nets, size_t (num_layers)}, OPEN);
1926
1898
1927
- ts_info. ts_nets_to_update .resize (num_nets, ClusterNetId::INVALID ());
1899
+ ts_nets_to_update_ .resize (num_nets, ClusterNetId::INVALID ());
1928
1900
1929
1901
pl_net_cost.net_cost .resize (num_nets, -1 .);
1930
1902
pl_net_cost.proposed_net_cost .resize (num_nets, -1 .);
@@ -1940,31 +1912,31 @@ NetCostHandler::NetCostHandler(PlacerContext& placer_ctx, size_t num_nets, bool
1940
1912
void NetCostHandler::get_non_updatable_bb_ (const ClusterNetId net) {
1941
1913
if (cube_bb_) {
1942
1914
get_non_updatable_bb_ (net,
1943
- ts_info. ts_bb_coord_new [net],
1944
- ts_info. ts_layer_sink_pin_count [size_t (net)]);
1915
+ ts_bb_coord_new_ [net],
1916
+ ts_layer_sink_pin_count_ [size_t (net)]);
1945
1917
}
1946
1918
else {
1947
1919
get_non_updatable_layer_bb_ (net,
1948
- ts_info. layer_ts_bb_coord_new [net],
1949
- ts_info. ts_layer_sink_pin_count [size_t (net)]);
1920
+ layer_ts_bb_coord_new_ [net],
1921
+ ts_layer_sink_pin_count_ [size_t (net)]);
1950
1922
}
1951
1923
}
1952
1924
1953
1925
void NetCostHandler::update_bb_ (ClusterNetId net_id, t_physical_tile_loc pin_old_loc, t_physical_tile_loc pin_new_loc, bool is_driver) {
1954
1926
if (cube_bb_) {
1955
1927
update_bb_ (net_id,
1956
- ts_info. ts_bb_edge_new [net_id],
1957
- ts_info. ts_bb_coord_new [net_id],
1958
- ts_info. ts_layer_sink_pin_count [size_t (net_id)],
1928
+ ts_bb_edge_new_ [net_id],
1929
+ ts_bb_coord_new_ [net_id],
1930
+ ts_layer_sink_pin_count_ [size_t (net_id)],
1959
1931
pin_old_loc,
1960
1932
pin_new_loc,
1961
1933
is_driver);
1962
1934
}
1963
1935
else {
1964
1936
update_layer_bb_ (net_id,
1965
- ts_info. layer_ts_bb_edge_new [net_id],
1966
- ts_info. layer_ts_bb_coord_new [net_id],
1967
- ts_info. ts_layer_sink_pin_count [size_t (net_id)],
1937
+ layer_ts_bb_edge_new_ [net_id],
1938
+ layer_ts_bb_coord_new_ [net_id],
1939
+ ts_layer_sink_pin_count_ [size_t (net_id)],
1968
1940
pin_old_loc,
1969
1941
pin_new_loc,
1970
1942
is_driver);
@@ -1973,27 +1945,27 @@ void NetCostHandler::update_bb_(ClusterNetId net_id, t_physical_tile_loc pin_old
1973
1945
1974
1946
double NetCostHandler::get_net_cost_ (const ClusterNetId net_id) {
1975
1947
if (cube_bb_) {
1976
- return ::get_net_cost (net_id, ts_info. ts_bb_coord_new [net_id]);
1948
+ return ::get_net_cost (net_id, ts_bb_coord_new_ [net_id]);
1977
1949
}
1978
1950
else {
1979
- return ::get_net_layer_bb_wire_cost (net_id, ts_info. layer_ts_bb_coord_new [net_id], ts_info. ts_layer_sink_pin_count [size_t (net_id)]);
1951
+ return ::get_net_layer_bb_wire_cost (net_id, layer_ts_bb_coord_new_ [net_id], ts_layer_sink_pin_count_ [size_t (net_id)]);
1980
1952
}
1981
1953
}
1982
1954
1983
1955
void NetCostHandler::set_ts_bb_coord_ (const ClusterNetId net_id) {
1984
1956
auto & place_move_ctx = placer_ctx_.mutable_move ();
1985
1957
if (cube_bb_) {
1986
- place_move_ctx.bb_coords [net_id] = ts_info. ts_bb_coord_new [net_id];
1958
+ place_move_ctx.bb_coords [net_id] = ts_bb_coord_new_ [net_id];
1987
1959
} else {
1988
- place_move_ctx.layer_bb_coords [net_id] = ts_info. layer_ts_bb_coord_new [net_id];
1960
+ place_move_ctx.layer_bb_coords [net_id] = layer_ts_bb_coord_new_ [net_id];
1989
1961
}
1990
1962
}
1991
1963
1992
1964
void NetCostHandler::set_ts_edge_ (const ClusterNetId net_id) {
1993
1965
auto & place_move_ctx = placer_ctx_.mutable_move ();
1994
1966
if (cube_bb_) {
1995
- place_move_ctx.bb_num_on_edges [net_id] = ts_info. ts_bb_edge_new [net_id];
1967
+ place_move_ctx.bb_num_on_edges [net_id] = ts_bb_edge_new_ [net_id];
1996
1968
} else {
1997
- place_move_ctx.layer_bb_num_on_edges [net_id] = ts_info. layer_ts_bb_edge_new [net_id];
1969
+ place_move_ctx.layer_bb_num_on_edges [net_id] = layer_ts_bb_edge_new_ [net_id];
1998
1970
}
1999
1971
}
0 commit comments