Skip to content

Commit 7ae2112

Browse files
committed
add more comments on net_cost_handler
1 parent e7a6032 commit 7ae2112

File tree

3 files changed

+76
-75
lines changed

3 files changed

+76
-75
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ static void update_net_layer_bb(const ClusterNetId& net,
126126
* @param criticalities
127127
* @param net
128128
* @param pin
129-
* @param affected_pins Store the sink pins which delays are changed due to moving the block
130-
* @param delta_timing_cost
129+
* @param affected_pins Updated by this routine to store the sink pins whose delays are changed due to moving the block
130+
* @param delta_timing_cost Computed by this routine and returned by reference.
131131
* @param is_src_moving True if "pin" is a sink pin and its driver is among the moving blocks
132132
*/
133133
static void update_td_delta_costs(const PlaceDelayModel* delay_model,
@@ -140,24 +140,24 @@ static void update_td_delta_costs(const PlaceDelayModel* delay_model,
140140

141141
/**
142142
* @brief if "net" is not already stored as an affected net, mark it in ts_nets_to_update and increment num_affected_nets
143-
* @param net
144-
* @param num_affected_nets
143+
* @param net ID of a net affected by a move
144+
* @param num_affected_nets Incremented if this is a new net affected, and returned via reference.
145145
*/
146146
static void record_affected_net(const ClusterNetId net, int& num_affected_nets);
147147

148148
/**
149149
* @brief Call suitable function based on the bounding box type to update the bounding box of the net connected to pin_id. Also,
150150
* call the function to update timing information if the placement algorithm is timing-driven.
151-
* @param place_algorithm
152-
* @param delay_model
153-
* @param criticalities
154-
* @param blk_id
155-
* @param pin_id
156-
* @param moving_blk_inf
157-
* @param affected_pins
158-
* @param timing_delta_c
159-
* @param num_affected_nets
160-
* @param is_src_moving
151+
* @param place_algorithm Placement algorithm
152+
* @param delay_model Timing delay model used by placer
153+
* @param criticalities Connections timing criticalities
154+
* @param blk_id Block ID of that the moving pin blongs to.
155+
* @param pin_id Pin ID of the moving pin
156+
* @param moving_blk_inf Data structure that holds information, e.g., old location and new locatoin, about all moving blocks
157+
* @param affected_pins Netlist pins which are affected, in terms placement cost, by the proposed move.
158+
* @param timing_delta_c Timing cost change based on the proposed move
159+
* @param num_affected_nets A pointer to the first free element of ts_nets_to_update. If a new net is added, the pointer should be increamented.
160+
* @param is_src_moving Is the moving pin the source of a net.
161161
*/
162162
static void update_net_info_on_pin_move(const t_place_algorithm& place_algorithm,
163163
const PlaceDelayModel* delay_model,
@@ -173,8 +173,8 @@ static void update_net_info_on_pin_move(const t_place_algorithm& place_algorithm
173173
/**
174174
* @brief Calculate the 3D bounding box of "net_id" from scratch (based on the block locations stored in place_ctx) and
175175
* store them in bb_coord_new
176-
* @param net_id
177-
* @param bb_coord_new
176+
* @param net_id ID of the net for which the bounding box is requested
177+
* @param bb_coord_new Computed by this function and returned by reference.
178178
* @param num_sink_pin_layer Store the number of sink pins of "net_id" on each layer
179179
*/
180180
static void get_non_updatable_bb(ClusterNetId net_id,
@@ -184,22 +184,22 @@ static void get_non_updatable_bb(ClusterNetId net_id,
184184
/**
185185
* @brief Calculate the per-layer bounding box of "net_id" from scratch (based on the block locations stored in place_ctx) and
186186
* store them in bb_coord_new
187-
* @param net_id
188-
* @param bb_coord_new
189-
* @param num_sink_layer
187+
* @param net_id ID of the net for which the bounding box is requested
188+
* @param bb_coord_new Computed by this function and returned by reference.
189+
* @param num_sink_layer Store the number of sink pins of "net_id" on each layer
190190
*/
191191
static void get_non_updatable_layer_bb(ClusterNetId net_id,
192192
std::vector<t_2D_bb>& bb_coord_new,
193193
vtr::NdMatrixProxy<int, 1> num_sink_layer);
194194

195195
/**
196-
* @brief Update the 3D bounding box of "net_id" incrementally based on the old and new locations of the pin
197-
* @param bb_edge_new
198-
* @param bb_coord_new
199-
* @param num_sink_pin_layer_new
200-
* @param pin_old_loc
201-
* @param pin_new_loc
202-
* @param src_pin
196+
* @brief Update the 3D bounding box of "net_id" incrementally based on the old and new locations of a pin on that net
197+
* @param bb_edge_new Number of blocks on the edges of the bounding box
198+
* @param bb_coord_new Coordinates of the bounding box
199+
* @param num_sink_pin_layer_new Number of sinks of the given net on each layer
200+
* @param pin_old_loc The old location of the moving pin
201+
* @param pin_new_loc The new location of the moving pin
202+
* @param src_pin Is the moving pin driving the net
203203
*/
204204
static void update_bb(ClusterNetId net_id,
205205
t_bb& bb_edge_new,
@@ -210,13 +210,13 @@ static void update_bb(ClusterNetId net_id,
210210
bool src_pin);
211211

212212
/**
213-
* @brief Update the per-layer bounding box of "net_id" incrementally based on the old and new locations of the pin
214-
* @param bb_edge_new
215-
* @param bb_coord_new
216-
* @param num_sink_pin_layer_new
217-
* @param pin_old_loc
218-
* @param pin_new_loc
219-
* @param src_pin
213+
* @brief Update the per-layer bounding box of "net_id" incrementally based on the old and new locations of a pin on that net
214+
* @param bb_edge_new Number of blocks on the edges of the bounding box
215+
* @param bb_coord_new Coordinates of the bounding box
216+
* @param num_sink_pin_layer_new Number of sinks of the given net on each layer
217+
* @param pin_old_loc The old location of the moving pin
218+
* @param pin_new_loc The new location of the moving pin
219+
* @param is_output_pin Is the moving pin of the type output
220220
*/
221221
static void update_layer_bb(ClusterNetId net_id,
222222
std::vector<t_2D_bb>& bb_edge_new,
@@ -229,14 +229,14 @@ static void update_layer_bb(ClusterNetId net_id,
229229
/**
230230
* @brief This function is called in update_layer_bb to update the net's bounding box incrementally if
231231
* the pin under consideration is not changing layer.
232-
* @param net_id
233-
* @param pin_old_loc
234-
* @param pin_new_loc
235-
* @param curr_bb_edge
236-
* @param curr_bb_coord
237-
* @param bb_pin_sink_count_new
238-
* @param bb_edge_new
239-
* @param bb_coord_new
232+
* @param net_id ID of the net which the moving pin belongs to
233+
* @param pin_old_loc Old location of the moving pin
234+
* @param pin_new_loc New location of the moving pin
235+
* @param curr_bb_edge The current known number of blocks of the net on bounding box edges
236+
* @param curr_bb_coord The current known boudning box of the net
237+
* @param bb_pin_sink_count_new The updated number of net's sinks on each layer
238+
* @param bb_edge_new The new bb edge calculated by this function
239+
* @param bb_coord_new The new bb calculated by this function
240240
*/
241241
static inline void update_bb_same_layer(ClusterNetId net_id,
242242
const t_physical_tile_loc& pin_old_loc,
@@ -250,14 +250,14 @@ static inline void update_bb_same_layer(ClusterNetId net_id,
250250
/**
251251
* @brief This function is called in update_layer_bb to update the net's bounding box incrementally if
252252
* the pin under consideration change layer.
253-
* @param net_id
254-
* @param pin_old_loc
255-
* @param pin_new_loc
256-
* @param curr_bb_edge
257-
* @param curr_bb_coord
258-
* @param bb_pin_sink_count_new
259-
* @param bb_edge_new
260-
* @param bb_coord_new
253+
* @param net_id ID of the net which the moving pin belongs to
254+
* @param pin_old_loc Old location of the moving pin
255+
* @param pin_new_loc New location of the moving pin
256+
* @param curr_bb_edge The current known number of blocks of the net on bounding box edges
257+
* @param curr_bb_coord The current known boudning box of the net
258+
* @param bb_pin_sink_count_new The updated number of net's sinks on each layer
259+
* @param bb_edge_new The new bb edge calculated by this function
260+
* @param bb_coord_new The new bb calculated by this function
261261
*/
262262
static inline void update_bb_layer_changed(ClusterNetId net_id,
263263
const t_physical_tile_loc& pin_old_loc,
@@ -269,12 +269,12 @@ static inline void update_bb_layer_changed(ClusterNetId net_id,
269269
std::vector<t_2D_bb>& bb_coord_new);
270270
/**
271271
* @brief If the moving pin is of type type SINK, update bb_pin_sink_count_new which stores the number of sink pins on each layer of "net_id"
272-
* @param net_id
273-
* @param pin_old_loc
274-
* @param pin_new_loc
275-
* @param curr_layer_pin_sink_count
276-
* @param bb_pin_sink_count_new
277-
* @param is_output_pin
272+
* @param net_id ID of the net which the moving pin belongs to
273+
* @param pin_old_loc Old location of the moving pin
274+
* @param pin_new_loc New location of the moving pin
275+
* @param curr_layer_pin_sink_count Updated number of sinks of the net on each layer
276+
* @param bb_pin_sink_count_new The updated number of net's sinks on each layer
277+
* @param is_output_pin Is the moving pin of the type output
278278
*/
279279
static void update_bb_pin_sink_count(ClusterNetId net_id,
280280
const t_physical_tile_loc& pin_old_loc,
@@ -286,14 +286,15 @@ static void update_bb_pin_sink_count(ClusterNetId net_id,
286286
/**
287287
* @brief Update the data structure for large nets that keep track of
288288
* the number of blocks on each edge of the bounding box.
289-
* @param net_id
290-
* @param bb_edge_new
291-
* @param bb_coord_new
292-
* @param bb_layer_pin_sink_count
293-
* @param old_num_block_on_edge
294-
* @param old_edge_coord
295-
* @param new_num_block_on_edge
296-
* @param new_edge_coord
289+
* @param net_id ID of the net which the moving pin belongs to
290+
* @param bb_edge_new The new bb edge calculated by this function
291+
* @param bb_coord_new The new bb calculated by this function
292+
* @param bb_layer_pin_sink_count The updated number of net's sinks on each layer
293+
* @param old_num_block_on_edge The current known number of blocks of the net on bounding box edges
294+
* @param old_edge_coord The current known boudning box of the net
295+
* @param new_num_block_on_edge The new bb calculated by this function
296+
* @param new_edge_coord The new bb edge calculated by this function
297+
*
297298
*/
298299
static inline void update_bb_edge(ClusterNetId net_id,
299300
std::vector<t_2D_bb>& bb_edge_new,
@@ -307,11 +308,11 @@ static inline void update_bb_edge(ClusterNetId net_id,
307308
/**
308309
* @brief When BB is being updated incrementally, the pin is moving to a new layer, and the BB is of the type "per-layer,
309310
* use this function to update the BB on the new layer.
310-
* @param new_pin_loc
311-
* @param bb_edge_old
312-
* @param bb_coord_old
313-
* @param bb_edge_new
314-
* @param bb_coord_new
311+
* @param new_pin_loc New location of the pin
312+
* @param bb_edge_old bb_edge prior to moving the pin
313+
* @param bb_coord_old bb_coord prior to moving the pin
314+
* @param bb_edge_new New bb edge calculated by this function
315+
* @param bb_coord_new new bb coord calculated by this function
315316
*/
316317
static void add_block_to_bb(const t_physical_tile_loc& new_pin_loc,
317318
const t_2D_bb& bb_edge_old,
@@ -395,7 +396,7 @@ static double recompute_bb_cost();
395396
static double wirelength_crossing_count(size_t fanout);
396397

397398
/**
398-
* @breif Calculate the wire-length cost of nets affected by moving the blocks and set bb_delta_c to the total cost change.
399+
* @brief Calculates and returns the total bb (wirelength) cost change that would result from moving the blocks indicated in the blocks_affected data structure.
399400
*/
400401
static void set_bb_delta_cost(const int num_affected_nets, double& bb_delta_c);
401402

@@ -2098,7 +2099,7 @@ void recompute_costs_from_scratch(const t_placer_opts& placer_opts,
20982099
}
20992100
}
21002101

2101-
void alloc_and_load_for_fast_cost_update(float place_cost_exp) {
2102+
void alloc_and_load_chan_w_factors_for_place_cost(float place_cost_exp) {
21022103
/* Allocates and loads the chanx_place_cost_fac and chany_place_cost_fac *
21032104
* arrays with the inverse of the average number of tracks per channel *
21042105
* between [subhigh] and [sublow]. This is only useful for the cost *
@@ -2204,7 +2205,7 @@ void alloc_and_load_for_fast_cost_update(float place_cost_exp) {
22042205
}
22052206
}
22062207

2207-
void free_fast_cost_update() {
2208+
void free_chan_w_factors_for_place_cost () {
22082209
chanx_place_cost_fac.clear();
22092210
chany_place_cost_fac.clear();
22102211
}

vpr/src/place/net_cost_handler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ void recompute_costs_from_scratch(const t_placer_opts& placer_opts,
114114
* @param place_cost_exp It is an exponent to which you take the average inverse channel
115115
* capacity; a higher value would favour wider channels more over narrower channels during placement (usually we use 1).
116116
*/
117-
void alloc_and_load_for_fast_cost_update(float place_cost_exp);
117+
void alloc_and_load_chan_w_factors_for_place_cost(float place_cost_exp);
118118

119119
/**
120120
* @brief Frees the chanx_place_cost_fac and chany_place_cost_fac arrays.
121121
*/
122-
void free_fast_cost_update();
122+
void free_chan_w_factors_for_place_cost ();
123123

124124
/**
125125
* @brief Resize net_cost, proposed_net_cost, and bb_updated_before data structures to accommodate all nets.

vpr/src/place/place.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ static void alloc_and_load_placement_structs(float place_cost_exp,
19221922
elem = OPEN;
19231923
}
19241924

1925-
alloc_and_load_for_fast_cost_update(place_cost_exp);
1925+
alloc_and_load_chan_w_factors_for_place_cost (place_cost_exp);
19261926

19271927
alloc_and_load_try_swap_structs(cube_bb);
19281928

@@ -1962,7 +1962,7 @@ static void free_placement_structs(const t_placer_opts& placer_opts, const t_noc
19621962

19631963
place_move_ctx.num_sink_pin_layer.clear();
19641964

1965-
free_fast_cost_update();
1965+
free_chan_w_factors_for_place_cost ();
19661966

19671967
free_try_swap_structs();
19681968

0 commit comments

Comments
 (0)