Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
c27bacc
pass 1st, 2nd, 3rd with a rough implementation of grids
haydar-c Mar 28, 2025
1535d9a
tile compability with destroying incompatible ones
haydar-c Mar 29, 2025
ef8c354
tile compability with checking before creating cluster
haydar-c Mar 31, 2025
3d26bfb
instepting speed with simple pass
haydar-c Apr 6, 2025
cdff896
simplified first pass and search grids in manhattan
haydar-c Apr 13, 2025
c67da89
sorting before processing
haydar-c Apr 13, 2025
db36eff
added placement step
haydar-c Apr 14, 2025
e737efa
reporting total clusters
haydar-c Apr 15, 2025
2c04563
corrected reporting
haydar-c Apr 15, 2025
41229b5
added neigbour search for cluster creation as well
haydar-c Apr 22, 2025
924073f
added neighbour search for orphan clusters as well
haydar-c Apr 25, 2025
5dfc554
[Faster Reconstruction]
haydar-c Apr 26, 2025
8cbcc2c
[Converting to full strategy after first neighbour pass]
haydar-c Apr 28, 2025
72760c0
just added parsin max_rss for FL and whole run
haydar-c Apr 29, 2025
240eb24
[Reducing memory usage]
haydar-c May 1, 2025
37a42fa
Merged master into this branch, solved conflict in qor parsin for ap
haydar-c May 1, 2025
5761983
Makes my changes compilable after master merge
haydar-c May 2, 2025
b77e6c2
[AP] Illegal Cluster Handling and Partial Placement Verification
haydar-c May 2, 2025
4edcbb2
[AP] Calling initial_placement after my packing
haydar-c May 4, 2025
01ee52a
[AP] Reconstruction Stat Reporting Fix
haydar-c May 5, 2025
c02d48c
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c May 5, 2025
2ab31c2
[AP] Flat Placement Reconstruction: Convert to Full strategy mid
haydar-c May 6, 2025
942274a
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c May 6, 2025
d7a95b9
[AP][FL] Added Stats for debugging block num increase
haydar-c May 16, 2025
a2efbe3
Stat reporting for reconstruction
haydar-c May 17, 2025
1183393
[AP][FL] Corrected displacement tile and atom reporting
haydar-c May 20, 2025
28b5836
Debugging the discrepancy between initial_placement and first pass
haydar-c May 20, 2025
3590016
[AP] Reconstruction Full Legalizer
haydar-c May 22, 2025
5ba4a95
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c May 22, 2025
5ad9f8d
[AP] Reconstruction Legalizer
haydar-c May 25, 2025
0cf1c0b
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c May 27, 2025
c1c1aa2
Reconstruction FL
haydar-c May 29, 2025
df4a7b5
Reconstruction FL
haydar-c May 30, 2025
b6de778
Reconstruction FL
haydar-c May 30, 2025
7ddbe24
Reconstruction FL
haydar-c May 30, 2025
7e74147
Reconstruction FL
haydar-c May 31, 2025
928a8c7
Reconstruction FL
haydar-c May 31, 2025
a876dbc
Reconstruction FL
haydar-c May 31, 2025
b0bd933
Reconstruction FL
haydar-c Jun 1, 2025
e18740f
Reconstruction FL
haydar-c Jun 2, 2025
4b7dfc8
Reconstruction FL
haydar-c Jun 3, 2025
60dec3d
Reconstruction FL
haydar-c Jun 3, 2025
f27a326
Reconstruction FL
haydar-c Jun 5, 2025
33e49f0
Reconstruction FL
haydar-c Jun 8, 2025
2562453
Reconstruction FL
haydar-c Jun 8, 2025
cbdf2ae
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jun 8, 2025
de7118b
Reconstruction FL
haydar-c Jun 10, 2025
4d7ed37
Merge master into reconstruction
haydar-c Jun 14, 2025
4063332
Reconstruction FL: parser update
haydar-c Jun 15, 2025
3ea0a28
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jun 16, 2025
45866e8
Try version: Fallback to Greedy for orphan molecules
haydar-c Jun 17, 2025
5dc57c6
Try version fix (not passing -r value): Fallback to Greedy for orphan…
haydar-c Jun 18, 2025
ae6d86a
Try version: Fallback to Greedy for orphan clusters with being able t…
haydar-c Jun 19, 2025
6d483c6
Re-apply the neigbor search before trying greedy clustering
haydar-c Jun 20, 2025
94fa495
Reconstruction Legalizer: Set radius to 8, add handling flat
haydar-c Jun 21, 2025
99d7f16
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jun 21, 2025
66afc7a
Flat Placement to Partial Placement passing update: Warning about mis…
haydar-c Jun 22, 2025
11f95dd
Change writing to flat placement stage from after DP to after FL
haydar-c Jun 25, 2025
8a60996
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jun 25, 2025
06a72ec
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jun 26, 2025
b954164
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jul 3, 2025
0e4e928
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jul 5, 2025
419aaf7
Reconstruction Legalizer: Clean physical_types.h
haydar-c Jul 6, 2025
de6285a
Reconstruction Legalizer: Clean analytical_placement_flow flat placement
haydar-c Jul 6, 2025
21555fd
Reconstruction Legalizer: Clean includes and args in full legalizer
haydar-c Jul 6, 2025
0285f59
Reconstruction Legalizer: document get_molecule_logical_block_type
haydar-c Jul 6, 2025
11fcc17
Reconstruction Legalizer: Class structure
haydar-c Jul 7, 2025
f1d1f97
Reconstruction Legalizer: Clean full legalizer spaces
haydar-c Jul 7, 2025
95b8974
Reconstruction Legalizer: full legalizer header spaces
haydar-c Jul 7, 2025
40b7786
Reconstruction Legalizer: fix forward declarations in FL header
haydar-c Jul 7, 2025
41beb52
Reconstruction Legalizer: Big Picture comment
haydar-c Jul 7, 2025
70d9e92
Reconstruction Legalizer: Class data types clean&document
haydar-c Jul 7, 2025
0471d36
Reconstruction Legalizer: FL header commenting finished
haydar-c Jul 7, 2025
b708d33
Reconstruction Legalizer: clean partial_placement update
haydar-c Jul 7, 2025
8936f3d
Reconstruction Legalizer: clean load flat place
haydar-c Jul 7, 2025
ebb73b4
Reconstruction Legalizer: Add vtr_reg_strong/strong_ap/flatrecon_full…
haydar-c Jul 8, 2025
1994250
Reconstruction Legalizer: Added vtr_reg_nightly_test7/ap_reconstruction
haydar-c Jul 8, 2025
fdbb13c
Reconstruction Legalizer: Conver BasicMinDisturbance to FlatRecon and…
haydar-c Jul 8, 2025
876e6b2
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jul 8, 2025
2e2299f
make format
haydar-c Jul 8, 2025
c94043a
Revert librtlnumber internal_bits.hpp make format change
haydar-c Jul 8, 2025
d414ab6
Update std:sort and results with better ones
haydar-c Jul 8, 2025
797e706
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jul 21, 2025
1c956ae
Reconstruction Legalizer: Increase N when failed and report neighbor …
haydar-c Jul 23, 2025
71d94f3
Reconstrution Legalizer: Re-creating firs pass clusters with their 1 …
haydar-c Jul 23, 2025
ccf7c4b
Reconstruction Legalizer: Working Example of First Trying 8-Neighbor …
haydar-c Jul 23, 2025
145e96b
Reconstruction Legalizer: Making neighbor fitting faster with specula…
haydar-c Jul 24, 2025
ee0c280
Reconstruction Legelizer: Cluster compressing only at the end and fix…
haydar-c Jul 25, 2025
04b0c4f
Reconstruction Legalizer: Sorting tile according to avg. mol count be…
haydar-c Jul 25, 2025
793fa1e
Reconstruction Legalizer: Results reported as per stage mols clustere…
haydar-c Jul 26, 2025
583dc79
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Jul 26, 2025
27f2ab4
Reconstruction Legalizer: Skipping io block in the Join with neighbor
haydar-c Jul 28, 2025
68f96bc
Reconstruction Legalizer: Trying once neighbor pass at first for fast…
haydar-c Jul 29, 2025
417df57
Revert "Reconstruction Legalizer: Trying once neighbor pass at first …
haydar-c Aug 6, 2025
caa3eaa
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Aug 6, 2025
2caf8b9
Reconstruction Legalizer: Refactored the new neighbor clustering (joi…
haydar-c Aug 8, 2025
2175511
FlatRecon: Keeping both post-placed and post-legalized flat placement…
haydar-c Aug 12, 2025
2f5f886
FlatRecon: Handle unspecified atom locations and give message.
haydar-c Aug 12, 2025
d094833
FlatRecon: Fixed comments abouth the FL header comments, unordered ma…
haydar-c Aug 13, 2025
2ff9b2f
FlatRecon: comments until data structure changes in FL cpp
haydar-c Aug 14, 2025
ee37ffa
FlatRecon: Get rid of unclustered_blocks until orphan window clustering.
haydar-c Aug 14, 2025
b3c9cdc
FlatRecon: Converted orphan window clustering to BFS like.
haydar-c Aug 15, 2025
33ef30f
FlatRecon: Getting ready to convert tile_loc_to_cluster_id_placed to …
haydar-c Aug 15, 2025
a431993
FlatRecon: Using tile_clusters_matrix for neighbor pass.
haydar-c Aug 16, 2025
9d3cad8
FlatRecon: Making full strategy explicit in reconstruction pass.
haydar-c Aug 16, 2025
fbd8a99
FlatRecon: Fixed neighbor pass up to fit in neighbor bool.
haydar-c Aug 16, 2025
ec54357
FlatRecon: Cleaned neighbor pass wrapper.
haydar-c Aug 17, 2025
63fef0e
FlatRecon: Neighbor pass cleaned.
haydar-c Aug 17, 2025
e7f9d94
FlatRecon: Factored out reporting clustering summary function
haydar-c Aug 17, 2025
21b84b4
FlatRecon: Cleaned clustering summary reporting function.
haydar-c Aug 17, 2025
76afd57
FlatRecon: Using try_size_device_grid from pack.cpp
haydar-c Aug 18, 2025
a98961a
Using get_manhattan_distance_to_tile function in reporting at the end.
haydar-c Aug 18, 2025
3d4c154
FlatRecon: Fix command line usage documantation.
haydar-c Aug 18, 2025
d4a0abc
FlatRecon: Implementation related comment consistency fix in partial …
haydar-c Aug 18, 2025
b2934c2
FlatRecon: Class commenting consistency
haydar-c Aug 18, 2025
358a925
FlatRecon: Clean up the place clusters.
haydar-c Aug 18, 2025
b4f749b
FlatRecon: Added make get_flat_placements and updated nightly test 7 …
haydar-c Aug 18, 2025
292a54e
FlatRecon: Update parsing for new summmary and results.
haydar-c Aug 18, 2025
f63113d
Merge master into FlatRecon
haydar-c Aug 18, 2025
c2565c4
FlatRecon: Update get_flat_placement_files.py for linting.
haydar-c Aug 18, 2025
ddf7e9d
FlatRecon: Fix a small bug in neighbor pass and remove block
haydar-c Aug 24, 2025
0dbada4
FlatRecon: Added .fplace file format description and linked to it whe…
haydar-c Aug 25, 2025
87b7cd6
FlatRecon: Addressing documenting comments.
haydar-c Aug 25, 2025
965bf79
FlatRecon: Add detailed doxygen comments and fix issues on legalizer …
haydar-c Aug 25, 2025
4ea6b57
FlatRecon: remaining comments in the full legalizer cpp code.
haydar-c Aug 25, 2025
69ad840
FlatRecon: Clearing clusterID data after compress.
haydar-c Aug 26, 2025
386dcc5
FlatRecon: Added a test to basic test (spree).
haydar-c Aug 26, 2025
85414c6
FlatRecon: Updated strong test result and for omitting site idx.
haydar-c Aug 26, 2025
8de8d63
FlatRecon: Updated the nighhtly test7 flat files and results.
haydar-c Aug 26, 2025
0cfbaba
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Aug 26, 2025
b876cda
FlatRecon: Continue if only 1 atom of a mol provided in fplace
haydar-c Aug 26, 2025
913aeb3
FlatRecon: Added extraction of flat placements to CI
haydar-c Aug 26, 2025
615520f
FlatRecon: Move spree basic test from vtr_reg_basic to vtr_reg_basic_…
haydar-c Aug 26, 2025
5f95301
FlatRecon: Use blif file for the basic odin test
haydar-c Aug 27, 2025
ed57b5d
Merge branch 'master' into reconstruction_grids_with_LegalizationClus…
haydar-c Aug 27, 2025
11b4e66
FlatRecon: Small commenting fix.
haydar-c Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/nightly_test_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
./dev/upgrade_vtr_archs.sh
make get_symbiflow_benchmarks
make get_zeroasic_rr_graphs
make get_flat_placements

# Build VTR using the default build options.
- name: 'Build VTR'
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,14 @@ add_custom_target(get_zeroasic_rr_graphs
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Downloading (~2MB) and extracting Zero ASIC RR graphs (~0.1GB) into VTR source tree.")

#
# Flat Placement Files
#
add_custom_target(get_flat_placements
COMMAND ./vtr_flow/scripts/get_flat_placement_files.py --vtr_flow_dir ./vtr_flow
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Downloading (~5MB) and extracting Flat Placement Files (~0.1GB) into VTR source tree.")

#
# Unit Testing
#
Expand Down
40 changes: 25 additions & 15 deletions doc/src/vpr/command_line_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,22 +444,22 @@ Use the options below to override this default naming behaviour.
Reads a file containing the locations of each atom on the FPGA.
This is used by the packer to better cluster atoms together.

The flat placement file (which often ends in ``.fplace``) is a text file
The flat placement file (which often ends in :ref:`.fplace <vpr_flat_place_file>`) is a text file
where each line describes the location of an atom. Each line in the flat
placement file should have the following syntax:

.. code-block:: none

<atom_name : str> <x : float> <y : float> <layer : float> <atom_sub_tile : int> <atom_site_idx? : int>
<atom_name : str> <x : float> <y : float> <layer : float> <atom_sub_tile : int>

For example:

.. code-block:: none

n523 6 8 0 0 3
n522 6 8 0 0 5
n520 6 8 0 0 2
n518 6 8 0 0 16
n523 6 8 0 0
n522 6 8 0 0
n520 6 8 0 0
n518 6 8 0 0

The position of the atom on the FPGA is given by 3 floating point values
(``x``, ``y``, ``layer``). We allow for the positions of atom to be not
Expand All @@ -475,25 +475,29 @@ Use the options below to override this default naming behaviour.
the sub-tile of an atom is unkown (allowing the packing algorithm to choose
any sub-tile at the given (x, y, layer) location).

The ``site_idx`` is an optional index into a linearized list of primitive
locations within a cluster-level block which may be used as a hint to
reconstruct clusters.

.. warning::

This interface is currently experimental and under active development.

.. option:: --write_flat_place <file>

Writes the post-placement locations of each atom into a flat placement file.
Writes the post-placement locations of each atom into a flat placement file
(see :ref:`flat placement file format <vpr_flat_place_file>`).

For each atom in the netlist, the following information is stored into the
flat placement file:

* The x, y, and sub_tile location of the cluster that contains this atom.

.. option:: --write_legalized_flat_place <file>

Writes the post-legalization locations of each atom into a flat placement file
(see :ref:`flat placement file format <vpr_flat_place_file>`).

For each atom in the netlist, the following information is stored into the
flat placement file:

* The x, y, and sub_tile location of the cluster that contains this atom.
* The flat site index of this atom in its cluster. The flat site index is a
linearized ID of primitive locations in a cluster. This may be used as a
hint to reconstruct clusters.

.. _netlist_options:

Expand Down Expand Up @@ -1287,14 +1291,20 @@ Analytical Placement is generally split into three stages:

**Default:** ``bipartitioning``

.. option:: --ap_full_legalizer {naive | appack}
.. option:: --ap_full_legalizer {naive | appack | flat-recon}

Controls which Full Legalizer to use in the AP Flow.

* ``naive`` Use a Naive Full Legalizer which will try to create clusters exactly where their atoms are placed.

* ``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 a flat placement from a :ref:`.fplace <vpr_flat_place_file>` file
or on the (in memory) output of VTR's integrated Global Placement algorithm. In both cases, it expects the given solution to be close to legal.
If used with a :ref:`.fplace <vpr_flat_place_file>` file, each atom in a molecule should have compatible location information. It is legal to
leave some molecules unconstrained; the reconstruction phase will choose where to place them but does not attempt to optimize these locations.

**Default:** ``appack``

.. option:: --ap_detailed_placer {none | annealer}
Expand Down
36 changes: 36 additions & 0 deletions doc/src/vpr/file_formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,42 @@ Placement File Format Example
xor5 1 2 0 0 #6
[1] 1 1 0 1 #7

.. _vpr_flat_place_file:

Flat Placement File Format (.fplace)
------------------------------------
The flat placement file is a text file where each line describes the location of
an atom. Each line in the flat placement file should have the following syntax:

.. code-block:: none

<atom_name : str> <x : float> <y : float> <layer : float> <atom_sub_tile : int>

For example:

.. code-block:: none

n523 6 8 0 0
n522 6 8 0 0
n520 6 9 0 0
n518 6 9 0 0

The position of the atom on the FPGA is given by 3 floating point values
(``x``, ``y``, ``layer``). We allow x and y locations to be off-grid since
this flat placement will be fed into the packer and placer, which will snap
the positions to grid locations. For 2D FPGA architectures, the ``layer`` should be 0.

The ``sub_tile`` is a clustered placement construct: which cluster-level
location at a given (x, y, layer) should these atoms go at (relevant when
multiple clusters can be stacked there). A sub-tile of -1 may be used when
the sub-tile of an atom is unkown (allowing the packing algorithm to choose
any sub-tile at the given (x, y, layer) location).

When used with ``flat-recon`` full legalizer (see :option:`vpr --ap_full_legalizer`),
each atom in a molecule should have compatible location information. It is legal to
leave some molecules unconstrained; the reconstruction phase will choose where
to place them but does not attempt to optimize these locations.

.. _vpr_route_file:

Routing File Format (.route)
Expand Down
33 changes: 33 additions & 0 deletions libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,40 @@ struct t_physical_tile_loc {
operator bool() const {
return !(x == ARCH_FPGA_UNDEFINED_VAL || y == ARCH_FPGA_UNDEFINED_VAL || layer_num == ARCH_FPGA_UNDEFINED_VAL);
}

/**
* @brief Comparison operator for t_physical_tile_loc
*
* Tiles are ordered first by layer number, then by x, and finally by y.
*/
friend bool operator<(const t_physical_tile_loc& lhs, const t_physical_tile_loc& rhs) {
if (lhs.layer_num != rhs.layer_num)
return lhs.layer_num < rhs.layer_num;
if (lhs.x != rhs.x)
return lhs.x < rhs.x;
return lhs.y < rhs.y;
}

friend bool operator==(const t_physical_tile_loc& a, const t_physical_tile_loc& b) {
return a.x == b.x && a.y == b.y && a.layer_num == b.layer_num;
}

friend bool operator!=(const t_physical_tile_loc& a, const t_physical_tile_loc& b) {
return !(a == b);
}
};

namespace std {
template<>
struct hash<t_physical_tile_loc> {
std::size_t operator()(const t_physical_tile_loc& v) const noexcept {
std::size_t seed = std::hash<int>{}(v.x);
vtr::hash_combine(seed, v.y);
vtr::hash_combine(seed, v.layer_num);
return seed;
}
};
} // namespace std

/** Describes I/O and clock ports of a physical tile type
*
Expand Down
69 changes: 57 additions & 12 deletions vpr/src/analytical_place/analytical_placement_flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -80,6 +81,7 @@ static void print_ap_netlist_stats(const APNetlist& netlist) {
* to be generated on ap_netlist or have the same blocks.
*/
static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_placement_info, const APNetlist& ap_netlist, const Prepacker& prepacker, PartialPlacement& p_placement) {
size_t num_mols_assigned_to_center = 0;
for (APBlockId ap_blk_id : ap_netlist.blocks()) {
// Get the molecule that AP block represents
PackMoleculeId mol_id = ap_netlist.block_molecule(ap_blk_id);
Expand All @@ -97,6 +99,8 @@ static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_plac
float current_loc_layer = flat_placement_info.blk_layer[atom_blk_id];
int current_loc_sub_tile = flat_placement_info.blk_sub_tile[atom_blk_id];
if (found_valid_atom) {
if (current_loc_x == -1 || current_loc_y == -1)
continue;
if (current_loc_x != atom_loc_x || current_loc_y != atom_loc_y || current_loc_layer != atom_loc_layer || current_loc_sub_tile != atom_loc_sub_tile)
VPR_FATAL_ERROR(VPR_ERROR_AP,
"Molecule of ID %zu contains atom %s (ID: %zu) with a location (%g, %g, layer: %g, subtile: %d) "
Expand All @@ -105,21 +109,53 @@ 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) {
atom_loc_x = std::clamp(current_loc_x, 0.0f,
static_cast<float>(g_vpr_ctx.device().grid.width() -1));
atom_loc_y = std::clamp(current_loc_y, 0.0f,
static_cast<float>(g_vpr_ctx.device().grid.height() -1));
// If current_loc_layer or current_loc_sub_tile are unset (-1), default to layer 0 and sub_tile 0.
if (current_loc_layer == -1)
current_loc_layer = 0;
if (current_loc_sub_tile == -1)
current_loc_sub_tile = 0;
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) {
num_mols_assigned_to_center++;
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.
// Needed for flat placement reconstruction statistics reporting.
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;
}
// TODO: If an atom's location is specified in the placement constraints,
// verify it matches the assigned flat placement. If not, override the
// flat placement with the constraint location and warn the user.
} 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;
}
}
VTR_LOG("%zu of %zu molecules placed at device center (no atoms of these molecules found in flat placement).\n",
num_mols_assigned_to_center, ap_netlist.blocks().size());
}

/**
Expand Down Expand Up @@ -245,6 +281,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
// option is specified.
if (!vpr_setup.FileNameOpts.write_legalized_flat_place_file.empty()) {
write_flat_placement(vpr_setup.FileNameOpts.write_legalized_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(),
Expand Down
6 changes: 3 additions & 3 deletions vpr/src/analytical_place/ap_flow_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ enum class e_ap_partial_legalizer {
* enum can select between these different Full Legalizers.
*/
enum class e_ap_full_legalizer {
Naive, ///< The Naive Full Legalizer, which clusters atoms placed in the same tile and tries to place them in that tile according to the flat placement.
APPack, ///< The APPack Full Legalizer, which uses the flat placement to improve the Packer and Placer.
Basic_Min_Disturbance ///< The Basic Min. Disturbance Full Legalizer, which tries to reconstruct a clustered placement that is as close to the incoming flat placement as it can.
Naive, ///< The Naive Full Legalizer, which clusters atoms placed in the same tile and tries to place them in that tile according to the flat placement.
APPack, ///< The APPack Full Legalizer, which uses the flat placement to improve the Packer and Placer.
FlatRecon ///< The Flat Placement Reconstruction Full Legalizer, which tries to reconstruct a clustered placement (or the in-memory global placement) that is as close to the incoming flat placement as it can.
};

/**
Expand Down
Loading