Skip to content

Commit 946a235

Browse files
fix compilation errors
1 parent 56f6d8b commit 946a235

15 files changed

+72
-35
lines changed

vpr/src/place/analytic_placer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ constexpr int HEAP_STALLED_ITERATIONS_STOP = 15;
129129
* Placement & device info is accessed via g_vpr_ctx
130130
*/
131131

132-
AnalyticPlacer::AnalyticPlacer(const PlaceLocVars& place_loc_vars)
132+
AnalyticPlacer::AnalyticPlacer(PlaceLocVars& place_loc_vars)
133133
: placer_loc_vars_ref_(place_loc_vars) {
134134
//Eigen::initParallel();
135135

@@ -414,7 +414,7 @@ void AnalyticPlacer::setup_solve_blks(t_logical_block_type_ptr blkTypes) {
414414
void AnalyticPlacer::update_macros() {
415415
for (auto& macro : g_vpr_ctx.mutable_placement().pl_macros) {
416416
ClusterBlockId head_id = macro.members[0].blk_index;
417-
bool mac_can_be_placed = macro_can_be_placed(macro, blk_locs[head_id].loc, true);
417+
bool mac_can_be_placed = macro_can_be_placed(macro, blk_locs[head_id].loc, true, placer_loc_vars_ref_);
418418

419419
//if macro can not be placed in this head pos, change the head pos
420420
if (!mac_can_be_placed) {
@@ -423,7 +423,7 @@ void AnalyticPlacer::update_macros() {
423423
}
424424

425425
//macro should be placed successfully after changing the head position
426-
VTR_ASSERT(macro_can_be_placed(macro, blk_locs[head_id].loc, true));
426+
VTR_ASSERT(macro_can_be_placed(macro, blk_locs[head_id].loc, true, placer_loc_vars_ref_));
427427

428428
//update other member's location based on head pos
429429
for (auto member = ++macro.members.begin(); member != macro.members.end(); ++member) {

vpr/src/place/analytic_placer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class AnalyticPlacer {
123123
* To tune these parameters, change directly in constructor
124124
*/
125125
AnalyticPlacer() = delete;
126-
explicit AnalyticPlacer(const PlaceLocVars& place_loc_vars);
126+
explicit AnalyticPlacer(PlaceLocVars& place_loc_vars);
127127

128128
/*
129129
* @brief main function of analytic placement

vpr/src/place/centroid_move_generator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "globals.h"
44
#include "directed_moves_util.h"
55
#include "place_constraints.h"
6+
#include "placer_context.h"
67
#include "move_utils.h"
78

89
#include <queue>

vpr/src/place/critical_uniform_move_generator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "critical_uniform_move_generator.h"
22
#include "globals.h"
33
#include "place_constraints.h"
4+
#include "placer_context.h"
45
#include "move_utils.h"
56

67
CriticalUniformMoveGenerator::CriticalUniformMoveGenerator(PlacerContext& placer_ctx)

vpr/src/place/feasible_region_move_generator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "globals.h"
44
#include "place_constraints.h"
5+
#include "placer_context.h"
56
#include "move_utils.h"
67

78
#include <algorithm>

vpr/src/place/initial_placement.cpp

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,20 @@ static constexpr int SORT_WEIGHT_PER_TILES_OUTSIDE_OF_PR = 100;
3737
* @brief Set chosen grid locations to EMPTY block id before each placement iteration
3838
*
3939
* @param unplaced_blk_types_index Block types that their grid locations must be cleared.
40-
*
40+
* @param place_loc_vars Placement block location information. To be filled with the location
41+
* where pl_macro is placed.
4142
*/
4243
static void clear_block_type_grid_locs(const std::unordered_set<int>& unplaced_blk_types_index,
4344
PlaceLocVars& place_loc_vars);
4445

4546
/**
4647
* @brief Initializes the grid to empty. It also initialized the location for
4748
* all blocks to unplaced.
49+
*
50+
* @param place_loc_vars Placement block location information. To be filled with the location
51+
* where pl_macro is placed.
4852
*/
49-
static void clear_all_grid_locs(PlaceLocVars& place_loc_avrs);
53+
static void clear_all_grid_locs(PlaceLocVars& place_loc_vars);
5054

5155
/**
5256
* @brief Control routine for placing a macro.
@@ -63,6 +67,8 @@ static void clear_all_grid_locs(PlaceLocVars& place_loc_avrs);
6367
* @param pad_loc_type Used to check whether an io block needs to be marked as fixed.
6468
* @param blk_types_empty_locs_in_grid First location (lowest y) and number of remaining blocks in each column for the blk_id type.
6569
* @param block_scores The block_scores (ranking of what to place next) for unplaced blocks connected to this macro should be updated.
70+
* @param place_loc_vars Placement block location information. To be filled with the location
71+
* where pl_macro is placed.
6672
*
6773
* @return true if macro was placed, false if not.
6874
*/
@@ -71,7 +77,7 @@ static bool place_macro(int macros_max_num_tries,
7177
e_pad_loc_type pad_loc_type,
7278
std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid,
7379
vtr::vector<ClusterBlockId, t_block_score>& block_scores,
74-
PlaceLocVars& place_loc_avrs);
80+
PlaceLocVars& place_loc_vars);
7581

7682
/*
7783
* Assign scores to each block based on macro size and floorplanning constraints.
@@ -82,10 +88,11 @@ static vtr::vector<ClusterBlockId, t_block_score> assign_block_scores();
8288

8389
/**
8490
* @brief Tries to find y coordinate for macro head location based on macro direction
85-
*
8691
*
8792
* @param first_macro_loc The first available location that can place the macro blocks.
8893
* @param pl_macro The macro to be placed.
94+
* @param place_loc_vars Placement block location information. To be filled with the location
95+
* where pl_macro is placed.
8996
*
9097
* @return y coordinate of the location that macro head should be placed
9198
*/
@@ -132,6 +139,8 @@ static std::vector<t_grid_empty_locs_block_type> init_blk_types_empty_locations(
132139
* @param pl_macro The macro to be fixed.
133140
* @param loc The location at which the head of the macro is placed.
134141
* @param pad_loc_type Used to check whether an io block needs to be marked as fixed.
142+
* @param block_locs Clustered block locations used to mark the IO blocks that are to be placed
143+
* randomly as fixed.
135144
*/
136145
static inline void fix_IO_block_types(const t_pl_macro& pl_macro,
137146
t_pl_loc loc,
@@ -157,6 +166,8 @@ static bool is_loc_legal(const t_pl_loc& loc,
157166
*
158167
* @param pl_macro The macro to be placed.
159168
* @param centroid specified location (x,y,subtile) for the pl_macro head member.
169+
* @param place_loc_vars Placement block location information. To be filled with the location
170+
* where pl_macro is placed.
160171
*
161172
* @return a vector of blocks that are connected to this block but not yet placed so their scores can later be updated.
162173
*/
@@ -170,6 +181,8 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
170181
* @param centroid_loc Calculated location in try_centroid_placement function for the block.
171182
* @param block_type Logical block type of the macro blocks.
172183
* @param search_for_empty If set, the function tries to find an empty location.
184+
* @param place_loc_vars Placement block location information. To be filled with the location
185+
* where pl_macro is placed.
173186
*
174187
* @return true if the function can find any location near the centroid one, false otherwise.
175188
*/
@@ -186,7 +199,9 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
186199
* constrained.
187200
* @param block_type Logical block type of the macro blocks.
188201
* @param pad_loc_type Used to check whether an io block needs to be marked as fixed.
189-
* @param block_scores The block_scores (ranking of what to place next) for unplaced blocks connected to this macro are updated in this routine.
202+
* @param block_scores The block_scores (ranking of what to place next) for unplaced blocks connected to this macro are updated in this routine.
203+
* @param place_loc_vars Placement block location information. To be filled with the location
204+
* where pl_macro is placed.
190205
*
191206
* @return true if the macro gets placed, false if not.
192207
*/
@@ -195,7 +210,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
195210
t_logical_block_type_ptr block_type,
196211
e_pad_loc_type pad_loc_type,
197212
vtr::vector<ClusterBlockId, t_block_score>& block_scores,
198-
PlaceLocVars& place_loc_avrs);
213+
PlaceLocVars& place_loc_vars);
199214

200215
/**
201216
* @brief Looks for a valid placement location for macro in second iteration, tries to place as many macros as possible in one column
@@ -207,6 +222,8 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
207222
* @param block_type Logical block type of the macro blocks.
208223
* @param pad_loc_type Used to check whether an io block needs to be marked as fixed.
209224
* @param blk_types_empty_locs_in_grid first location (lowest y) and number of remaining blocks in each column for the blk_id type
225+
* @param place_loc_vars Placement block location information. To be filled with the location
226+
* where pl_macro is placed.
210227
*
211228
* @return true if the macro gets placed, false if not.
212229
*/
@@ -215,19 +232,21 @@ static bool try_dense_placement(const t_pl_macro& pl_macro,
215232
t_logical_block_type_ptr block_type,
216233
e_pad_loc_type pad_loc_type,
217234
std::vector<t_grid_empty_locs_block_type>* blk_types_empty_locs_in_grid,
218-
PlaceLocVars& place_loc_avrs);
235+
PlaceLocVars& place_loc_vars);
219236

220237
/**
221238
* @brief Tries for MAX_INIT_PLACE_ATTEMPTS times to place all blocks considering their floorplanning constraints and the device size
222239
*
223240
* @param pad_loc_type Used to check whether an io block needs to be marked as fixed.
224241
* @param constraints_file Used to read block locations if any constraints is available.
242+
* @param place_loc_vars Placement block location information. To be filled with the location
243+
* where pl_macro is placed.
225244
*/
226245
static void place_all_blocks(const t_placer_opts& placer_opts,
227246
vtr::vector<ClusterBlockId, t_block_score>& block_scores,
228247
e_pad_loc_type pad_loc_type,
229248
const char* constraints_file,
230-
PlaceLocVars& place_loc_avrs);
249+
PlaceLocVars& place_loc_vars);
231250

232251
/**
233252
* @brief If any blocks remain unplaced after all initial placement iterations, this routine
@@ -990,7 +1009,7 @@ static void place_all_blocks(const t_placer_opts& placer_opts,
9901009
vtr::vector<ClusterBlockId, t_block_score>& block_scores,
9911010
enum e_pad_loc_type pad_loc_type,
9921011
const char* constraints_file,
993-
PlaceLocVars& place_loc_avrs) {
1012+
PlaceLocVars& place_loc_vars) {
9941013
auto& cluster_ctx = g_vpr_ctx.clustering();
9951014
auto& place_ctx = g_vpr_ctx.placement();
9961015
auto& device_ctx = g_vpr_ctx.device();
@@ -1013,12 +1032,12 @@ static void place_all_blocks(const t_placer_opts& placer_opts,
10131032

10141033
for (auto iter_no = 0; iter_no < MAX_INIT_PLACE_ATTEMPTS; iter_no++) {
10151034
//clear grid for a new placement iteration
1016-
clear_block_type_grid_locs(unplaced_blk_type_in_curr_itr, place_loc_avrs);
1035+
clear_block_type_grid_locs(unplaced_blk_type_in_curr_itr, place_loc_vars);
10171036
unplaced_blk_type_in_curr_itr.clear();
10181037

10191038
// read the constraint file if the user has provided one and this is not the first attempt
10201039
if (strlen(constraints_file) != 0 && iter_no != 0) {
1021-
read_constraints(constraints_file, place_loc_avrs);
1040+
read_constraints(constraints_file, place_loc_vars);
10221041
}
10231042

10241043
//resize the vector to store unplaced block types empty locations
@@ -1050,7 +1069,7 @@ static void place_all_blocks(const t_placer_opts& placer_opts,
10501069

10511070
blocks_placed_since_heap_update++;
10521071

1053-
bool block_placed = place_one_block(blk_id, pad_loc_type, &blk_types_empty_locs_in_grid[blk_id_type->index], &block_scores, place_loc_avrs);
1072+
bool block_placed = place_one_block(blk_id, pad_loc_type, &blk_types_empty_locs_in_grid[blk_id_type->index], &block_scores, place_loc_vars);
10541073

10551074
//update heap based on update_heap_freq calculated above
10561075
if (blocks_placed_since_heap_update % (update_heap_freq) == 0) {
@@ -1214,14 +1233,14 @@ static void alloc_and_load_movable_blocks(const vtr::vector_map<ClusterBlockId,
12141233
void initial_placement(const t_placer_opts& placer_opts,
12151234
const char* constraints_file,
12161235
const t_noc_opts& noc_opts,
1217-
PlaceLocVars& place_loc_avrs) {
1236+
PlaceLocVars& place_loc_vars) {
12181237
vtr::ScopedStartFinishTimer timer("Initial Placement");
1219-
auto& block_locs = place_loc_avrs.mutable_block_locs();
1238+
auto& block_locs = place_loc_vars.mutable_block_locs();
12201239

12211240
/* Initialize the grid blocks to empty.
12221241
* Initialize all the blocks to unplaced.
12231242
*/
1224-
clear_all_grid_locs(place_loc_avrs);
1243+
clear_all_grid_locs(place_loc_vars);
12251244

12261245
/* Go through cluster blocks to calculate the tightest placement
12271246
* floorplan constraint for each constrained block
@@ -1230,28 +1249,28 @@ void initial_placement(const t_placer_opts& placer_opts,
12301249

12311250
/*Mark the blocks that have already been locked to one spot via floorplan constraints
12321251
* as fixed, so they do not get moved during initial placement or later during the simulated annealing stage of placement*/
1233-
mark_fixed_blocks(place_loc_avrs);
1252+
mark_fixed_blocks(place_loc_vars);
12341253

12351254
// Compute and store compressed floorplanning constraints
12361255
alloc_and_load_compressed_cluster_constraints();
12371256

12381257

12391258
// read the constraint file and place fixed blocks
12401259
if (strlen(constraints_file) != 0) {
1241-
read_constraints(constraints_file, place_loc_avrs);
1260+
read_constraints(constraints_file, place_loc_vars);
12421261
}
12431262

12441263
if (noc_opts.noc) {
12451264
// NoC routers are placed before other blocks
1246-
initial_noc_placement(noc_opts, placer_opts, place_loc_avrs);
1265+
initial_noc_placement(noc_opts, placer_opts, place_loc_vars);
12471266
propagate_place_constraints();
12481267
}
12491268

12501269
//Assign scores to blocks and placement macros according to how difficult they are to place
12511270
vtr::vector<ClusterBlockId, t_block_score> block_scores = assign_block_scores();
12521271

12531272
//Place all blocks
1254-
place_all_blocks(placer_opts, block_scores, placer_opts.pad_loc_type, constraints_file, place_loc_avrs);
1273+
place_all_blocks(placer_opts, block_scores, placer_opts.pad_loc_type, constraints_file, place_loc_vars);
12551274

12561275
alloc_and_load_movable_blocks(block_locs);
12571276

vpr/src/place/manual_move_generator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "manual_move_generator.h"
1414
#include "manual_moves.h"
15+
#include "placer_context.h"
1516

1617
#ifndef NO_GRAPHICS
1718
# include "draw.h"

vpr/src/place/median_move_generator.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#include "median_move_generator.h"
2+
23
#include "globals.h"
3-
#include <algorithm>
44
#include "place_constraints.h"
5+
#include "placer_context.h"
56
#include "move_utils.h"
67

8+
#include <algorithm>
9+
710
MedianMoveGenerator::MedianMoveGenerator(PlacerContext& placer_ctx)
811
: MoveGenerator(placer_ctx) {}
912

@@ -22,9 +25,9 @@ e_create_move MedianMoveGenerator::propose_move(t_pl_blocks_to_be_moved& blocks_
2225
//Find a movable block based on blk_type
2326
ClusterBlockId b_from = propose_block_to_move(placer_opts,
2427
proposed_action.logical_blk_type_index,
25-
false,
26-
nullptr,
27-
nullptr,
28+
/*highly_crit_block=*/false,
29+
/*net_from=*/nullptr,
30+
/*pin_from=*/nullptr,
2831
placer_ctx);
2932

3033
VTR_LOGV_DEBUG(g_vpr_ctx.placement().f_placer_debug, "Median Move Choose Block %d - rlim %f\n", size_t(b_from), rlim);

vpr/src/place/move_generator.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#ifndef VPR_MOVE_GENERATOR_H
22
#define VPR_MOVE_GENERATOR_H
3+
34
#include "vpr_types.h"
45
#include "move_utils.h"
56
#include "timing_place.h"
67
#include "directed_moves_util.h"
7-
#include "placer_context.h"
88

99
#include <limits>
1010

11+
class PlacerContext;
12+
1113
struct MoveOutcomeStats {
1214
float delta_cost_norm = std::numeric_limits<float>::quiet_NaN();
1315
float delta_bb_cost_norm = std::numeric_limits<float>::quiet_NaN();

vpr/src/place/move_utils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "draw.h"
1111

1212
#include "place_constraints.h"
13+
#include "placer_context.h"
1314

1415
//f_placer_breakpoint_reached is used to stop the placer when a breakpoint is reached. When this flag is true, it stops the placer after the current perturbation. Thus, when a breakpoint is reached, this flag is set to true.
1516
//Note: The flag is only effective if compiled with VTR_ENABLE_DEBUG_LOGGING

vpr/src/place/net_cost_handler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
* @date July 12, 2024
2525
*/
2626
#include "net_cost_handler.h"
27+
2728
#include "clustered_netlist_fwd.h"
2829
#include "globals.h"
2930
#include "physical_types.h"
31+
#include "placer_context.h"
3032
#include "move_utils.h"
3133
#include "place_timing_update.h"
3234
#include "noc_place_utils.h"
3335
#include "vtr_math.h"
3436

3537
#include <optional>
38+
#include <functional>
3639

3740
using std::max;
3841
using std::min;
@@ -209,9 +212,9 @@ static void record_affected_net(const ClusterNetId net);
209212
* @param place_algorithm Placement algorithm
210213
* @param delay_model Timing delay model used by placer
211214
* @param criticalities Connections timing criticalities
212-
* @param blk_id Block ID of that the moving pin blongs to.
215+
* @param blk_id Block ID of that the moving pin belongs to.
213216
* @param pin_id Pin ID of the moving pin
214-
* @param moving_blk_inf Data structure that holds information, e.g., old location and new locatoin, about all moving blocks
217+
* @param moving_blk_inf Data structure that holds information, e.g., old location and new location, about all moving blocks
215218
* @param affected_pins Netlist pins which are affected, in terms placement cost, by the proposed move.
216219
* @param timing_delta_c Timing cost change based on the proposed move
217220
* @param is_src_moving Is the moving pin the source of a net.

vpr/src/place/net_cost_handler.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
#include "timing_place.h"
44
#include "move_transactions.h"
55
#include "place_util.h"
6-
#include "placer_context.h"
7-
8-
#include <functional>
96

7+
class PlacerContext;
108

119
/**
1210
* @brief The error tolerance due to round off for the total cost computation.

vpr/src/place/uniform_move_generator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "uniform_move_generator.h"
2+
23
#include "globals.h"
34
#include "place_constraints.h"
5+
#include "placer_context.h"
46
#include "move_utils.h"
57

68
UniformMoveGenerator::UniformMoveGenerator(PlacerContext& placer_ctx)

vpr/src/place/weighted_centroid_move_generator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "weighted_centroid_move_generator.h"
2+
23
#include "globals.h"
34
#include "directed_moves_util.h"
45
#include "place_constraints.h"
6+
#include "placer_context.h"
57
#include "move_utils.h"
68

79
WeightedCentroidMoveGenerator::WeightedCentroidMoveGenerator(PlacerContext& placer_ctx)

0 commit comments

Comments
 (0)