Skip to content

3D Placement Constraints #2623

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

Merged
merged 34 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fb3beca
updated Region and RegionRectCoord to support layer range
soheilshahrouz Jun 17, 2024
0907fcf
add layer_low and layer_high to vpr_contstraints.xsd
soheilshahrouz Jun 18, 2024
875a238
add layer_low and layer_high to vpr_constraints_writer
soheilshahrouz Jun 18, 2024
448aa85
update grid_tile_lookup to support layer range
soheilshahrouz Jun 18, 2024
a67c8c2
updated initial placement to support layer range
soheilshahrouz Jun 19, 2024
25e5145
Merge branch 'update_search_range_with_floorplan_constraint' into 3d_…
soheilshahrouz Jun 19, 2024
e97bfff
update place_constraints.cpp to support layer range
soheilshahrouz Jun 20, 2024
cd75e21
early check to see if a block can be placed in a layer
soheilshahrouz Jun 20, 2024
423f975
replace initial rect coordinates with numeric_limits functions
soheilshahrouz Jun 21, 2024
686011b
fix compilation errors in test_vpr_constraints.cpp
soheilshahrouz Jun 21, 2024
d73139d
add unit tests for 3d floorplan regions
soheilshahrouz Jun 21, 2024
e998e82
add StringMaker<vtr::Rect<T>>
soheilshahrouz Jun 21, 2024
54bf518
fix false empty region intersection bug
soheilshahrouz Jun 21, 2024
0fcae3a
fix empty region check bug
soheilshahrouz Jun 21, 2024
32e6900
update test_vpr_constraints with cases that have regions spanning mul…
soheilshahrouz Jun 21, 2024
aeb4612
bugfix: consider the last layer in exhaustive initial placement of a …
soheilshahrouz Jun 24, 2024
e32f037
bugfix: consider the last layer when constructing GridTileLookup
soheilshahrouz Jun 24, 2024
56691b5
default layer range when the layer is not specified
soheilshahrouz Jun 24, 2024
24449d3
remove RegionRectCoord class
soheilshahrouz Jun 25, 2024
fa40fc3
remove calls to get_region_bounds() and set_region_bounds()
soheilshahrouz Jun 25, 2024
3d6941f
add CI test for 3d placement constraints
soheilshahrouz Jun 25, 2024
2d1de0c
draw floorplan regions for 3d architectures
soheilshahrouz Jun 26, 2024
8d41358
add hash function for PartitionRegion
soheilshahrouz Jun 30, 2024
9fd7389
add == operator for PartitionRegion
soheilshahrouz Jun 30, 2024
571cede
changed floorplan_constraints_regions_overfull() to check whether who…
soheilshahrouz Jun 30, 2024
c74ca63
check the legality of region when parsing it
soheilshahrouz Jun 30, 2024
ea6464e
add comments
soheilshahrouz Jul 1, 2024
00e5b65
fix the failing unit test
soheilshahrouz Jul 3, 2024
9849395
updated docs with layer_low and layer_high
soheilshahrouz Jul 3, 2024
2d959d8
add a 3D constraint file where are atoms are locked down
soheilshahrouz Jul 3, 2024
ba78649
Merge remote-tracking branch 'origin/master' into 3d_constraints
soheilshahrouz Jul 3, 2024
a446074
add vpr_tight_floorplan_3d to task list
soheilshahrouz Jul 5, 2024
a24e8ab
bugfix: consider the last layer in region_with_subtile_count()
soheilshahrouz Jul 5, 2024
224c8ac
fixbug: print block type name and the number of tiles for overfull prs
soheilshahrouz Jul 5, 2024
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
36 changes: 33 additions & 3 deletions doc/src/vpr/placement_constraints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ A Placement Constraints File Example
<add_atom name_pattern="n4917"/>
<add_atom name_pattern="n6010"/>
</partition>

<partition name="Part2">
<add_region x_low="3" y_low="3" x_high="85" y_high="85"/> <!-- When the layer is not explicitly specified, layer 0 is assumed. -->
<add_region x_low="8" y_low="5" x_high="142" y_high="29 layer_low="0" layer_high="1"/> <!-- In 3D architectures, the region can span across multiple layers. -->
<add_region x_low="6" y_low="55" x_high="50" y_high="129 layer_low="2" layer_high="2"/> <!-- If the region only covers a non-zero layer, both layer_low and layer_high must be set the same value. -->
<add_atom name_pattern="n135"/>
<add_atom name_pattern="n7016"/>
</partition>
</partition_list>
</vpr_constraints>

Expand Down Expand Up @@ -75,7 +83,10 @@ The ``name_pattern`` can be the exact name of the atom from the input atom netli
Region
^^^^^^

An ``<add_region>`` tag is used to add a region to the partition. A ``region`` is a rectangular area on the chip. A partition can contain any number of independent regions - the regions within one partition must not overlap with each other (in order to ease processing when loading in the file). An ``<add_region>`` tag has the following attributes.
An ``<add_region>`` tag is used to add a region to the partition. A ``region`` is a rectangular area or cubic volume
on the chip. A partition can contain any number of independent regions - the regions within one partition **must not**
overlap with each other (in order to ease processing when loading in the file).
An ``<add_region>`` tag has the following attributes.

:req_param x_low:
The x value of the lower left point of the rectangle.
Expand All @@ -90,11 +101,30 @@ An ``<add_region>`` tag is used to add a region to the partition. A ``region`` i
The y value of the upper right point of the rectangle.

:opt_param subtile:
Each x, y location on the grid may contain multiple locations known as subtiles. This paramter is an optional value specifying the subtile location that the atom(s) of the partition shall be constrained to.
Each x, y location on the grid may contain multiple locations known as subtiles. This parameter is an optional value specifying the subtile location that the atom(s) of the partition shall be constrained to.

:opt_param layer_low:
The lowest layer number that the region covers. The default value is 0.

:opt_param layer_high:
The highest layer number that the region covers. The default value is 0.

The optional ``subtile`` attribute is commonly used when constraining an atom to a specific location on the chip (e.g. an exact I/O location). It is legal to use with larger regions, but uncommon.

If a user would like to specify an area on the chip with an unusual shape (e.g. L-shaped or T-shaped), they can simply add multiple ``<add_region>`` tags to cover the area specified.
In 2D architectures, ``layer_low`` and ``layer_high`` can be safely ignored as their default value is 0.
In 3D architectures, a region can span across multiple layers or be assigned to a specific layer.
For assigning a region to a specific non-zero layer, the user should set both ``layer_low`` and ``layer_high`` to the
desired layer number. If a layer range is to be covered by the region, the user set ``layer_low`` and ``layer_high`` to
different values.

If a user would like to specify an area on the chip with an unusual shape (e.g. L-shaped or T-shaped),
they can simply add multiple ``<add_region>`` tags to cover the area specified.

It is strongly recommended that different partitions do not overlap. The packing algorithm compares the number clustered
blocks and the number of physical blocks in a region to decide pack atoms inside a partition more aggressively when
there are not enough resources in a partition. Overlapping partitions causes some physical blocks to be counted in more
than one partition.




Expand Down
12 changes: 6 additions & 6 deletions libs/libarchfpga/src/echo_arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
}

fprintf(Echo, "\tInput Connect Block Switch Name Within a Same Die: %s\n", arch->ipin_cblock_switch_name[ipin_cblock_switch_index_within_die].c_str());

//if there is more than one layer available, print the connection block switch name that is used for connection between two dice
for(const auto& layout : arch->grid_layouts){
for (const auto& layout : arch->grid_layouts) {
int num_layers = (int)layout.layers.size();
if(num_layers > 1){
if (num_layers > 1) {
fprintf(Echo, "\tInput Connect Block Switch Name Between Two Dice: %s\n", arch->ipin_cblock_switch_name[ipin_cblock_switch_index_between_dice].c_str());
}
}
Expand Down Expand Up @@ -295,11 +295,11 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
fprintf(Echo, "\t\t\t\ttype unidir mux_name for within die connections: %s\n",
arch->Switches[seg.arch_wire_switch].name.c_str());
//if there is more than one layer available, print the segment switch name that is used for connection between two dice
for(const auto& layout : arch->grid_layouts){
for (const auto& layout : arch->grid_layouts) {
int num_layers = (int)layout.layers.size();
if(num_layers > 1){
if (num_layers > 1) {
fprintf(Echo, "\t\t\t\ttype unidir mux_name for between two dice connections: %s\n",
arch->Switches[seg.arch_opin_between_dice_switch].name.c_str());
arch->Switches[seg.arch_opin_between_dice_switch].name.c_str());
}
}
} else { //Should be bidir
Expand Down
23 changes: 21 additions & 2 deletions libs/libvtrutil/src/vtr_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/**
* @file
* @brief This file include differents different geometry classes
* @brief This file includes different geometry classes
*/

namespace vtr {
Expand Down Expand Up @@ -92,11 +92,18 @@ class Point {
///@brief Swap x and y values
void swap();

/// @brief += operator
Point<T>& operator+= (const Point<T>& rhs);

/// @brief += operator
Point<T>& operator-= (const Point<T>& rhs);

private:
T x_;
T y_;
};


/**
* @brief A 2D rectangle
*
Expand Down Expand Up @@ -144,6 +151,12 @@ class Rect {
///@brief Return the top right point
Point<T> top_right() const;

/**
* @brief Return the bottom left and top right coordinates
* @return [xmin, ymin, xmax, ymax]
*/
std::tuple<T, T, T, T> coordinates() const;

///@brief Return the rectangle width
T width() const;

Expand Down Expand Up @@ -190,6 +203,12 @@ class Rect {
///@brief set ymax to a point
void set_ymax(T ymax_val);

/// @brief += operator
Rect<T>& operator+= (const Point<T>& rhs);

/// @brief -= operator
Rect<T>& operator-= (const Point<T>& rhs);

///@brief Equivalent to `*this = bounding_box(*this, other)`
Rect<T>& expand_bounding_box(const Rect<T>& other);

Expand Down Expand Up @@ -302,7 +321,7 @@ class RectUnion {
friend bool operator!= <>(const RectUnion<T>& lhs, const RectUnion<T>& rhs);

private:
// Note that a union of rectanges may have holes and may not be contiguous
// Note that a union of rectangles may have holes and may not be contiguous
std::vector<Rect<T>> rects_;
};

Expand Down
33 changes: 33 additions & 0 deletions libs/libvtrutil/src/vtr_geometry.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ void Point<T>::swap() {
std::swap(x_, y_);
}

template<class T>
Point<T>& Point<T>::operator+=(const Point<T>& rhs) {
x_ += rhs.x_;
y_ += rhs.y_;
return *this;
}

template<class T>
Point<T>& Point<T>::operator-=(const Point<T>& rhs) {
x_ -= rhs.x_;
y_ -= rhs.y_;
return *this;
}

/*
* Rect
*/
Expand Down Expand Up @@ -120,6 +134,11 @@ Point<T> Rect<T>::top_right() const {
return top_right_;
}

template<class T>
std::tuple<T, T, T, T> Rect<T>::coordinates() const {
return {xmin(), ymin(), xmax(), ymax()};
}

template<class T>
T Rect<T>::width() const {
return xmax() - xmin();
Expand Down Expand Up @@ -224,6 +243,20 @@ void Rect<T>::set_ymax(T ymax_val) {
top_right_.set_y(ymax_val);
}

template<class T>
Rect<T>& Rect<T>::operator+=(const Point<T>& rhs) {
bottom_left_ += rhs;
top_right_ += rhs;
return *this;
}

template<class T>
Rect<T>& Rect<T>::operator-=(const Point<T>& rhs) {
bottom_left_ -= rhs;
top_right_ -= rhs;
return *this;
}

template<class T>
Rect<T>& Rect<T>::expand_bounding_box(const Rect<T>& other) {
*this = bounding_box(*this, other);
Expand Down
Loading