Skip to content

Commit 023ba47

Browse files
add comments
1 parent d5aef9a commit 023ba47

File tree

6 files changed

+93
-18
lines changed

6 files changed

+93
-18
lines changed

vpr/src/pack/cluster_util.h

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,44 @@ enum e_block_pack_status try_place_atom_block_rec(const t_pb_graph_node* pb_grap
280280
int verbosity,
281281
const int feasible_block_array_size);
282282

283+
284+
/**
285+
* @brief Checks whether an atom block can be added to a clustered block
286+
* without violating floorplanning constraints. It also updates the
287+
* clustered block's floorplanning region by taking the intersection of
288+
* its current region and the floorplanning region of the given atom block.
289+
*
290+
* @param blk_id A unique ID for the candidate atom block to be added to the growing cluster.
291+
* @param clb_index A unique ID for the clustered block that the atom block wants to be added to.
292+
* @param verbosity Controls the detail level of log information printed by this function.
293+
* @param temp_cluster_pr The floorplanning regions of the clustered block. This function may
294+
* update the given region.
295+
* @param cluster_pr_needs_update Indicates whether the floorplanning region of the clustered block
296+
* have updated.
297+
* @return True if adding the given atom block to the clustered block does not violated any
298+
* floorplanning constraints.
299+
*/
283300
bool atom_cluster_floorplanning_check(AtomBlockId blk_id,
284301
ClusterBlockId clb_index,
285302
int verbosity,
286303
PartitionRegion& temp_cluster_pr,
287304
bool& cluster_pr_needs_update);
288-
305+
/**
306+
* @brief Checks if an atom block can be added to a clustered block without
307+
* violating NoC group constraints. For passing this check, either both clustered
308+
* and atom blocks must belong to the same NoC group, or at least one of them should
309+
* not belong to any NoC group. If the atom block is associated with a NoC group while
310+
* the clustered block does not belong to any NoC groups, the NoC group ID of the atom block
311+
* is assigned to the clustered block when the atom is added to it.
312+
* block
313+
*
314+
* @param blk_id A unique ID for the candidate atom block to be added to the growing cluster.
315+
* @param clb_index A unique ID for the clustered block that the atom block wants to be added to.
316+
* @param verbosity Controls the detail level of log information printed by this function.
317+
* @param temp_cluster_noc_grp_id The NoC group ID of the clustered block. This function may update
318+
* this ID.
319+
* @return True if adding the atom block the cluster does not violate NoC group constraints.
320+
*/
289321
bool atom_cluster_noc_group_check(AtomBlockId blk_id,
290322
ClusterBlockId clb_index,
291323
int verbosity,

vpr/src/place/centroid_move_generator.h

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,41 @@
2020
*/
2121
class CentroidMoveGenerator : public MoveGenerator {
2222
public:
23+
/**
24+
* The move generator created by calling this constructor only consider
25+
* netlist connectivity for computing the centroid location.
26+
*/
2327
CentroidMoveGenerator();
28+
29+
/**
30+
* The move generator created by calling this constructor considers both
31+
* netlist connectivity and NoC reachability for computing the centroid.
32+
* The constructor also forms NoC groups by finding connected components
33+
* in the graph representing the clustered netlist. When finding connected
34+
* components, none of the nets whose fanout is larger than high_fanout_net
35+
* are traversed.
36+
* @param noc_attraction_weight Specifies how much the computed centroid
37+
* is adjusted towards the location of NoC routers in the same NoC group as
38+
* the clustered block to be moved.
39+
* @param high_fanout_net All nets with a fanout larger than this number are
40+
* ignored when forming NoC groups.
41+
*/
2442
CentroidMoveGenerator(float noc_attraction_weight, size_t high_fanout_net);
2543

2644

45+
/**
46+
* Returns all NoC routers that are in the NoC group with a given ID.
47+
* @param noc_grp_id The NoC group ID whose NoC routers are requested.
48+
* @return The clustered block ID of all NoC routers in the given NoC group.
49+
*/
2750
static const std::vector<ClusterBlockId>& get_noc_group_routers(NocGroupId noc_grp_id);
2851

52+
/**
53+
* Returns the NoC group ID of clustered block.
54+
* @param blk_id The clustered block whose NoC group ID is requested.
55+
* @return The NoC group ID of the given clustered block or INVALID if
56+
* the given clustered block does not belong to any NoC groups.
57+
*/
2958
static NocGroupId get_cluster_noc_group(ClusterBlockId blk_id);
3059

3160
private:
@@ -43,7 +72,7 @@ class CentroidMoveGenerator : public MoveGenerator {
4372
/** Indicates whether the centroid calculation is NoC-biased.*/
4473
bool noc_attraction_enabled_;
4574

46-
/** Stores all non-router blocks for each NoC group*/
75+
/** Stores the ids of all non-router clustered blocks for each NoC group*/
4776
static vtr::vector<NocGroupId, std::vector<ClusterBlockId>> noc_group_clusters_;
4877

4978
/** Stores NoC routers in each NoC group*/

vpr/src/place/directed_moves_util.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ void get_coordinate_of_pin(ClusterPinId pin, t_physical_tile_loc& tile_loc);
2525
* This function is very useful in centroid and weightedCentroid moves as it calculates
2626
* the centroid location. It returns the calculated location in centroid.
2727
*
28-
* @param b_from: The block Id of the moving block
29-
* @param timing_weights: Determines whether to calculate centroid or weighted centroid location. If true, use the timing weights (weighted centroid)
30-
* @param criticalities: A pointer to the placer criticalities which is used when calculating weighted centroid (send a NULL pointer in case of centroid)
28+
* When NoC attraction is enabled, the computed centroid is slightly adjusted towards the location
29+
* of NoC routers that are in the same NoC group b_from.
30+
*
31+
* @param b_from The block Id of the moving block
32+
* @param timing_weights Determines whether to calculate centroid or
33+
* weighted centroid location. If true, use the timing weights (weighted centroid).
34+
* @param criticalities A pointer to the placer criticalities which is used when
35+
* calculating weighted centroid (send a NULL pointer in case of centroid)
36+
* @param noc_attraction_enabled Indicates whether the computed centroid location
37+
* should be adjusted towards NoC routers in the NoC group of the given block.
38+
* @param noc_attraction_weight When NoC attraction is enabled, this weight
39+
* specifies to which extent the computed centroid should be adjusted. A value
40+
* in range [0, 1] is expected.
3141
*
32-
* @return The calculated location is returned in centroid parameter that is sent by reference
42+
* @return The calculated location is returned in centroid parameter that is sent by reference
3343
*/
3444
void calculate_centroid_loc(ClusterBlockId b_from,
3545
bool timing_weights,
@@ -42,7 +52,7 @@ inline void calculate_centroid_loc(ClusterBlockId b_from,
4252
bool timing_weights,
4353
t_pl_loc& centroid,
4454
const PlacerCriticalities* criticalities) {
45-
calculate_centroid_loc(b_from, timing_weights,centroid, criticalities,false, 0.0f);
55+
calculate_centroid_loc(b_from, timing_weights, centroid, criticalities, false, 0.0f);
4656
}
4757

4858
#endif

vpr/src/place/move_utils.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,13 @@ e_block_move_result record_macro_macro_swaps(t_pl_blocks_to_be_moved& blocks_aff
254254
//Continue walking along the overlapping parts of the from and to macros, recording
255255
//each block swap.
256256
//
257-
//At the momemnt we only support swapping the two macros if they have the same shape.
257+
//At the moment we only support swapping the two macros if they have the same shape.
258258
//This will be the case with the common cases we care about (i.e. carry-chains), so
259259
//we just abort in any other cases (if these types of macros become more common in
260260
//the future this could be updated).
261261
//
262-
//Unless the two macros have thier root blocks aligned (i.e. the mutual overlap starts
263-
//at imember_from == 0), then theree will be a fixed offset between the macros' relative
262+
//Unless the two macros have their root blocks aligned (i.e. the mutual overlap starts
263+
//at imember_from == 0), then there will be a fixed offset between the macros' relative
264264
//position. We record this as from_to_macro_*_offset which is used to verify the shape
265265
//of the macros is consistent.
266266
//
@@ -1036,7 +1036,8 @@ void compressed_grid_to_loc(t_logical_block_type_ptr blk_type,
10361036
to_loc = t_pl_loc(grid_loc.x, grid_loc.y, sub_tile, grid_loc.layer_num);
10371037
}
10381038

1039-
int has_empty_compatible_subtile(t_logical_block_type_ptr type, const t_physical_tile_loc& to_loc) {
1039+
int find_empty_compatible_subtile(t_logical_block_type_ptr type,
1040+
const t_physical_tile_loc& to_loc) {
10401041
auto& device_ctx = g_vpr_ctx.device();
10411042
auto& place_ctx = g_vpr_ctx.placement();
10421043

@@ -1148,7 +1149,7 @@ bool find_compatible_compressed_loc_in_range(t_logical_block_type_ptr type,
11481149
if (from_loc.x == to_loc.x && from_loc.y == to_loc.y && from_loc.layer_num == to_layer_num) {
11491150
continue; //Same from/to location -- try again for new y-position
11501151
} else if (search_for_empty) { // Check if the location has at least one empty sub-tile
1151-
legal = has_empty_compatible_subtile(type, to_loc) >= 0;
1152+
legal = find_empty_compatible_subtile(type, to_loc) >= 0;
11521153
} else {
11531154
legal = true;
11541155
}

vpr/src/place/move_utils.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,19 @@ void compressed_grid_to_loc(t_logical_block_type_ptr blk_type,
225225
t_pl_loc& to_loc);
226226

227227
/**
228-
* @brief Checks whether the given location has a compatible empty subtile with
229-
* the given type.
228+
* @brief Tries to find an compatible empty subtile with the given type at
229+
* the given location. If such a subtile could be found, the subtile number
230+
* is returned. Otherwise, -1 is returned to indicate that there are no
231+
* compatible subtiles at the given location.
230232
*
231233
* @param type logical block type
232234
* @param to_loc The location to be checked
233235
*
234-
* @return bool True if the given location has at least one empty compatible subtile.
236+
* @return int The subtile number if there is an empty compatible subtile, otherwise -1
237+
* is returned to indicate that there are no empty subtiles compatible with the given type..
235238
*/
236-
int has_empty_compatible_subtile(t_logical_block_type_ptr type,
237-
const t_physical_tile_loc& to_loc);
239+
int find_empty_compatible_subtile(t_logical_block_type_ptr type,
240+
const t_physical_tile_loc& to_loc);
238241

239242
/**
240243
* @brief find compressed location in a compressed range for a specific type in the given layer (to_layer_num)

vpr/src/util/vpr_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/* This defines the maximum string length that could be parsed by functions *
2525
* in vpr_utils. */
26-
static constexpr size_t MAX_STRING_LEN = 128;
26+
static constexpr size_t MAX_STRING_LEN = 512;
2727

2828
/******************** File-scope variables declarations **********************/
2929

0 commit comments

Comments
 (0)