-
Notifications
You must be signed in to change notification settings - Fork 423
FlatRecon: Flat Placement Reconstruction Full Legalizer #3193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c27bacc
1535d9a
ef8c354
3d26bfb
cdff896
c67da89
db36eff
e737efa
2c04563
41229b5
924073f
5dfc554
8cbcc2c
72760c0
240eb24
37a42fa
5761983
b77e6c2
4edcbb2
01ee52a
c02d48c
2ab31c2
942274a
d7a95b9
a2efbe3
1183393
28b5836
3590016
5ba4a95
5ad9f8d
0cf1c0b
c1c1aa2
df4a7b5
b6de778
7ddbe24
7e74147
928a8c7
a876dbc
b0bd933
e18740f
4b7dfc8
60dec3d
f27a326
33e49f0
2562453
cbdf2ae
de7118b
4d7ed37
4063332
3ea0a28
45866e8
5dc57c6
ae6d86a
6d483c6
94fa495
99d7f16
66afc7a
11f95dd
8a60996
06a72ec
b954164
0e4e928
419aaf7
de6285a
21555fd
0285f59
11fcc17
f1d1f97
95b8974
40b7786
41beb52
70d9e92
0471d36
b708d33
8936f3d
ebb73b4
1994250
fdbb13c
876e6b2
2e2299f
c94043a
d414ab6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1286,6 +1286,12 @@ Analytical Placement is generally split into three stages: | |
|
||
* ``appack`` Use APPack, which takes the Packer in VPR and uses the flat atom placement to create better clusters. | ||
|
||
* ``flat-recon`` Use the Flat Placement Reconstruction Full Legalizer which tries to reconstruct a clustered placement | ||
that is as close to the incoming flat placement as possible. It can be used to read flat placement from an '.fplace' file | ||
or with Global Placement output. In both cases, it expects the given solution to be close to legal. If used with | ||
an '.fplace' file, each atom of a molecule should share same location information. If none of the atoms in a molecule | ||
have a specified location in the file, the molecule will be assigned to the center of the device. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have to explain what this means. You won't really leave it in the center of the device. I suggest just saying it is legal to leave some molecules unconstrained; the reconstruction phase will choose where to place them but does not attempt to optimize those locations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need a link to the file format (which has to be described somewhere). |
||
|
||
**Default:** ``appack`` | ||
|
||
.. option:: --ap_detailed_placer {none | annealer} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
#include "gen_ap_netlist_from_atoms.h" | ||
#include "global_placer.h" | ||
#include "globals.h" | ||
#include "load_flat_place.h" | ||
#include "netlist_fwd.h" | ||
#include "partial_legalizer.h" | ||
#include "partial_placement.h" | ||
|
@@ -105,20 +106,38 @@ static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_plac | |
current_loc_x, current_loc_y, current_loc_layer, current_loc_sub_tile, | ||
atom_loc_x, atom_loc_y, atom_loc_layer, atom_loc_sub_tile); | ||
} else { | ||
atom_loc_x = current_loc_x; | ||
atom_loc_y = current_loc_y; | ||
atom_loc_layer = current_loc_layer; | ||
atom_loc_sub_tile = current_loc_sub_tile; | ||
found_valid_atom = true; | ||
if (current_loc_x != -1 && current_loc_y != -1 && current_loc_layer != -1 && current_loc_sub_tile != -1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line concerns me a little. Here, -1 means that the user has left that part of the location unspecified. For example, it is common for people to leave the layer or sub_tile unspecified instead of forcing it to 0. I think that there should be special handling for that. If not, this code will put a lot of blocks in the center of the device! |
||
atom_loc_x = current_loc_x; | ||
atom_loc_y = current_loc_y; | ||
atom_loc_layer = current_loc_layer; | ||
atom_loc_sub_tile = current_loc_sub_tile; | ||
found_valid_atom = true; | ||
} | ||
} | ||
} | ||
// Ensure that there is a valid atom in the molecule to pass its location. | ||
VTR_ASSERT_MSG(found_valid_atom, "Each molecule must contain at least one valid atom"); | ||
// Pass the placement information | ||
p_placement.block_x_locs[ap_blk_id] = atom_loc_x; | ||
p_placement.block_y_locs[ap_blk_id] = atom_loc_y; | ||
p_placement.block_layer_nums[ap_blk_id] = atom_loc_layer; | ||
p_placement.block_sub_tiles[ap_blk_id] = atom_loc_sub_tile; | ||
// If any atom in the molecule has a location assigned, use that location | ||
// for the entire AP block. Otherwise, assign the AP block to the center | ||
// of the device grid and update the flat placement info for all its atoms accordingly. | ||
if (!found_valid_atom) { | ||
VTR_LOG_WARN("No atoms of molecule ID %zu provided in the flat placement. Assigning it to the device center.\n", mol_id); | ||
p_placement.block_x_locs[ap_blk_id] = g_vpr_ctx.device().grid.width() / 2.0f; | ||
p_placement.block_y_locs[ap_blk_id] = g_vpr_ctx.device().grid.height() / 2.0f; | ||
p_placement.block_layer_nums[ap_blk_id] = 0; | ||
p_placement.block_sub_tiles[ap_blk_id] = 0; | ||
// Update flat placement for atoms of that molecule accordingly | ||
for (AtomBlockId atom_blk_id : mol.atom_block_ids) { | ||
g_vpr_ctx.mutable_atom().mutable_flat_placement_info().blk_x_pos[atom_blk_id] = g_vpr_ctx.device().grid.width() / 2.0f; | ||
g_vpr_ctx.mutable_atom().mutable_flat_placement_info().blk_y_pos[atom_blk_id] = g_vpr_ctx.device().grid.height() / 2.0f; | ||
g_vpr_ctx.mutable_atom().mutable_flat_placement_info().blk_layer[atom_blk_id] = 0; | ||
g_vpr_ctx.mutable_atom().mutable_flat_placement_info().blk_sub_tile[atom_blk_id] = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mutating the global flat placement info here is odd to me. Why does it need to be updated? Can we not modify the flat placement object coming in? Or even better leave the flat placement object as it is and only use the partial placement object? |
||
} | ||
} else { | ||
// Pass the placement information | ||
p_placement.block_x_locs[ap_blk_id] = atom_loc_x; | ||
p_placement.block_y_locs[ap_blk_id] = atom_loc_y; | ||
p_placement.block_layer_nums[ap_blk_id] = atom_loc_layer; | ||
p_placement.block_sub_tiles[ap_blk_id] = atom_loc_sub_tile; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -245,6 +264,15 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) { | |
// Print the device utilization | ||
print_device_utilization(target_device_utilization); | ||
|
||
// Write out a flat placement file at the end of Full Legalization if the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By moving this to here, you have changed the meaning of the write_flat_place option: I am ok with this change; in the future, if we want the post-placement flat placement, we can create another option. You should update the documentation for this option accordingly. Since this has become AP-specific though, you should probably change this option to something like "--ap_write_post_fl_flat_place" or something to make this more clear. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems strange to not be able to write out the final placement; maybe we need another command line option to specify this. |
||
// option is specified. | ||
if (!vpr_setup.FileNameOpts.write_flat_place_file.empty()) { | ||
write_flat_placement(vpr_setup.FileNameOpts.write_flat_place_file.c_str(), | ||
g_vpr_ctx.clustering().clb_nlist, | ||
g_vpr_ctx.placement().block_locs(), | ||
g_vpr_ctx.clustering().atoms_lookup); | ||
} | ||
|
||
// Run the Detailed Placer. | ||
std::unique_ptr<DetailedPlacer> detailed_placer = make_detailed_placer(ap_opts.detailed_placer_type, | ||
g_vpr_ctx.placement().blk_loc_registry(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read flat -> read a flat
from an '.fplace' -> from a '.fplace'