Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e99a5ee

Browse files
committedApr 21, 2025·
[AP] General Fixed/Unfixed Blocks Cleanup
Fixed a couple of small known issues around the AP flow related to how we handle fixed blocks. Offset the fixed block locations by 0.5 such that they are no longer on the edge. Previously, fixed blocks were placed at the root location of tiles. This was a problem since atoms would want to be generally close to the fixed block and may be biased to the bottom/left tiles to the fixed-block tile. This does not handle large tiles, but will help in general. If no fixed blocks are provided, the AP solver will always produce the trivial solution (all blocks placed on top of one another anywhere on the device). We were wasting time running bound2bound to solve this and the solution was probably being put on the bottom-left corner (0,0) which is not ideal. Instead of running bound2bound during the first iteration in this case, just placed all blocks in the center of the device. This greatly speeds up the first iteration when no fixed blocks are provided.
1 parent c881146 commit e99a5ee

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed
 

‎vpr/src/analytical_place/analytical_solver.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,25 @@ void B2BSolver::solve(unsigned iteration, PartialPlacement& p_placement) {
446446
// Store an initial placement into the p_placement object as a starting point
447447
// for the B2B solver.
448448
if (iteration == 0) {
449+
// If there are no fixed blocks, running bound2bound will always yield
450+
// the trivial solution (all blocks on top of each other anywhere on the
451+
// device). Skip having to solve for this by just putting all the blocks
452+
// at the center of the device.
453+
// TODO: This can be further improved by using the average compatible
454+
// tile location for each AP block. The center is just an
455+
// approximation.
456+
if (num_fixed_blocks_ == 0) {
457+
for (size_t row_id_idx = 0; row_id_idx < num_moveable_blocks_; row_id_idx++) {
458+
APRowId row_id = APRowId(row_id_idx);
459+
APBlockId blk_id = row_id_to_blk_id_[row_id];
460+
p_placement.block_x_locs[blk_id] = device_grid_width_ / 2.0;
461+
p_placement.block_y_locs[blk_id] = device_grid_height_ / 2.0;
462+
}
463+
block_x_locs_solved = p_placement.block_x_locs;
464+
block_y_locs_solved = p_placement.block_y_locs;
465+
return;
466+
}
467+
449468
// In the first iteration, we have no prior information.
450469
// Run the intial placer to get a first guess.
451470
switch (initial_placement_ty_) {

‎vpr/src/analytical_place/ap_netlist.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
*/
3636
struct APFixedBlockLoc {
3737
// Value that represents an unfixed dimension.
38-
static constexpr int UNFIXED_DIM = -1;
38+
static constexpr float UNFIXED_DIM = -1;
3939
// The dimensions to fix.
40-
int x = UNFIXED_DIM;
41-
int y = UNFIXED_DIM;
40+
float x = UNFIXED_DIM;
41+
float y = UNFIXED_DIM;
4242
int layer_num = UNFIXED_DIM;
4343
int sub_tile = UNFIXED_DIM;
4444
};

‎vpr/src/analytical_place/gen_ap_netlist_from_atoms.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ APNetlist gen_ap_netlist_from_atoms(const AtomNetlist& atom_netlist,
8989
const vtr::Rect<int>& region_rect = region.get_rect();
9090
VTR_ASSERT(region_rect.xmin() == region_rect.xmax() && "AP: Expect each region to be a single point in x!");
9191
VTR_ASSERT(region_rect.ymin() == region_rect.ymax() && "AP: Expect each region to be a single point in y!");
92-
int blk_x_loc = region_rect.xmin();
93-
int blk_y_loc = region_rect.ymin();
92+
// Here we offset by 0.5 to put the fixed point in the center of the
93+
// tile (assuming the tile is 1x1).
94+
// TODO: Think about what to do when the user fixes blocks to large
95+
// tiles. However, this solution will at least keep the atoms
96+
// away from the edge of tiles.
97+
float blk_x_loc = region_rect.xmin() + 0.5f;
98+
float blk_y_loc = region_rect.ymin() + 0.5f;
9499
// Get the layer.
95100
VTR_ASSERT(region.get_layer_range().first == region.get_layer_range().second && "AP: Expect each region to be a single point in layer!");
96101
int blk_layer_num = region.get_layer_range().first;

‎vtr_flow/parse/qor_config/qor_ap_fixed_chan_width.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ vpr_status;output.txt;vpr_status=(.*)
55
crit_path_delay;vpr.out;Critical path: (.*) ns
66
post_gp_hpwl;vpr.out;\s*Placement HPWL: (.*)
77
post_fl_hpwl;vpr.out;Initial placement BB estimate of wirelength: (.*)
8+
post_dp_hpwl;vpr.out;BB estimate of min-dist \(placement\) wire length: (.*)
89
total_wirelength;vpr.out;\s*Total wirelength: (\d+)
910
post_gp_overfilled_bins;vpr.out;\s*Number of overfilled bins: (\d+)
1011
post_gp_avg_overfill;vpr.out;\s*Average overfill magnitude: (.*)

0 commit comments

Comments
 (0)
Please sign in to comment.