Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions doc/src/api/libarchfpga/grid_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
========
Grid Specification Types
========

These types are used to capture user's intended grid specification, i.e., which tiles go where in the device. These specifications will be later turned into a flattened device grid according to the device's size.

.. doxygenstruct:: t_grid_loc_spec
:project: vpr
:members:

.. doxygenstruct:: t_grid_loc_def
:project: vpr
:members:

12 changes: 12 additions & 0 deletions doc/src/api/libarchfpga/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _libarchfpga:

LIBARCHFPGA
=======

.. toctree::
:maxdepth: 1

physical_types
grid_types
scatter_gather_types
interposer_types
13 changes: 13 additions & 0 deletions doc/src/api/libarchfpga/interposer_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
========
Interposer Types
========

These types are used to store information about interposer based architectures.

.. doxygenstruct:: t_interposer_cut_inf
:project: vpr
:members:

.. doxygenstruct:: t_interdie_wire_inf
:project: vpr
:members:
33 changes: 33 additions & 0 deletions doc/src/api/libarchfpga/physical_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
========
Physical Types
========

These types are used to capture user's intended architecture specification.

.. doxygenstruct:: t_arch
:project: vpr
:members:

.. doxygenstruct:: t_arch_switch_inf
:project: vpr
:members:

.. doxygenstruct:: t_segment_inf
:project: vpr
:members:

.. doxygenstruct:: t_physical_tile_loc
:project: vpr
:members:

.. doxygenstruct:: t_sub_tile
:project: vpr
:members:

.. doxygenstruct:: t_layer_def
:project: vpr
:members:

.. doxygenstruct:: t_grid_def
:project: vpr
:members:
17 changes: 17 additions & 0 deletions doc/src/api/libarchfpga/scatter_gather_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
========
Scatter-Gather Types
========

These types store information about about scatter-gather routing patterns

.. doxygenstruct:: t_scatter_gather_pattern
:project: vpr
:members:

.. doxygenstruct:: t_sg_link
:project: vpr
:members:

.. doxygenstruct:: t_sg_location
:project: vpr
:members:
26 changes: 26 additions & 0 deletions doc/src/arch/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,32 @@ Grid Layout Example

Example FPGA grid


.. arch:tag:: <interposer_cut dim=x|y loc="int"/>

:req_param dim: Dimension or axis of the cut. 'X' or 'x' means a horizontal cut while 'Y' or 'y' means a vertical cut.
:req_param loc: Location of the cut. Cuts are done above or to the right of the tiles at coordinate 'loc'. For example a cut with dim=x and loc=0 would cut the vertical wires above tiles in the 0th row. Currently only integer values are supported.

.. note:: Interposers are experimental and are currently not supported by VPR and using the related tags will not actually result in any changes to the flow.
Defines an interposer cut for modelling 2.5D interposer-based architectures. An interposer cut will cut all connections at location 'loc' along the axis 'dim' Leaving the two sides completely unconnected.
To reconnect the two sides, this tag can have multiple <interdie_wire> tags as children to specify the connection between the two sides.

.. arch:tag:: <interdie_wire sg_name="string" sg_link="string" offset_start="expr" offset_end="expr" offset_increment="expr" num="int"/>

:req_param sg_name: Name of the scatter-gather pattern to be used for the interdie connection.
:req_param sg_link: Name of the scatter-gather link to be used for the interdie connection.
:req_param offset_start: Starting point of scatter-gather instantiations.
:req_param offset_end: Ending point of scatter-gather instantiations
:req_param offset_increment: Increment/distance between scatter-gather instantiations.
:req_param num: Number of scatter-gather instantiations per switchblock location.

Defines the interdie wiring between the two sides of the cut. Connectivity is defined using scatter-gather patterns. Starting at 'offset_start' from location of the cut and moving by 'offset_increment' until we reach the location of 'offset_end' away from the cut, 'num' scatter-gather patterns defined by 'sg_name' and 'sg_link' will be instantiated.
Note that these offset points always define the starting point of the scatter-gather pattern's sg_link. offset_start, offset_end and offset_increment can be integer values or expressions involving W and H (device width and height.)

.. figure:: scatter_gather_images/interposer_diagram.png

An example of how specifying interposers in VTR works. Connections between the two sides of a cut are first severed after which the two sides are reconnected using scatter_gather patterns. In this example the length of the sg_link wire used is 3. Note that there are 'num' of each pattern at each switchblock location.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think the figure should show the die-crossing wires at each x location, since that's what would happen.
  2. On the figure or in the text, say the length of the sg_link wire in this case is 3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the interposer cuts all layers? Should say that too. Or say it only supports 1 layer architectures for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure about what happens with 3D architectures and interposers. The idea I had was that each layer could have it's own independent cut lines to keep everything flexible. This might make physical sense for a 2 layer face-to-face stacked chip, but I'm not sure about that either.

Right now the code does independent cut lines for each layer, but I could change it if you think it wouldn't make physical sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that. I'd mention that somewhere in the docs, unless it is super-obvious from its position in the various tags.

.. _arch_device_info:

FPGA Device Information
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ For more specific documentation about VPR see :ref:`vpr`.
api/vtrutil/index
api/ezgl/index
api/vprinternals/index
api/libarchfpga/index

Indices and tables
==================
Expand Down
4 changes: 2 additions & 2 deletions libs/libarchfpga/src/echo_arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
//Layout
fprintf(Echo, "*************************************************\n");
for (const auto& grid_layout : arch->grid_layouts) {
if (grid_layout.grid_type == GridDefType::AUTO) {
if (grid_layout.grid_type == e_grid_def_type::AUTO) {
fprintf(Echo, "Layout: '%s' Type: auto Aspect_Ratio: %f\n", grid_layout.name.c_str(), grid_layout.aspect_ratio);
} else {
VTR_ASSERT(grid_layout.grid_type == GridDefType::FIXED);
VTR_ASSERT(grid_layout.grid_type == e_grid_def_type::FIXED);
fprintf(Echo, "Layout: '%s' Type: fixed Width: %d Height %d\n", grid_layout.name.c_str(), grid_layout.width, grid_layout.height);
}
}
Expand Down
134 changes: 134 additions & 0 deletions libs/libarchfpga/src/grid_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#pragma once

/**
* @file grid_types.h
* @brief FPGA grid layout data types
*/

#include <string>
#include <memory>

// Forward declerations

struct t_metadata_dict;

/**
* @brief Grid location specification
* Each member is a formula evaluated in terms of 'W' (device width),
* and 'H' (device height). Formulas can be evaluated using parse_formula()
* from expr_eval.h.
*/
struct t_grid_loc_spec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should build these into the grid part of the VPR API documentation on the web. You'd need to edit some doxyfile for that, and add an overview at the top of this struct saying this is used to capture the user's specification of the architecture will eventually be turned into a flattened grid.

std::string start_expr; ///<Starting position (inclusive)
std::string end_expr; ///<Ending position (inclusive)

std::string repeat_expr; ///<Distance between repeated region instances

std::string incr_expr; ///<Distance between block instantiations with the region
};

/**
* @brief Definition of how to place physical logic block in the grid.
* @details This defines a region of the grid to be set to a specific type
* (provided its priority is high enough to override other blocks).
*
* The diagram below illustrates the layout specification.
*
* +----+ +----+ +----+
* | | | | | |
* | | | | ... | |
* | | | | | |
* +----+ +----+ +----+
*
* . . .
* . . .
* . . .
*
* +----+ +----+ +----+
* | | | | | |
* | | | | ... | |
* | | | | | |
* +----+ +----+ +----+
* ^
* |
* repeaty |
* |
* v (endx,endy)
* +----+ +----+ +----+
* | | | | | |
* | | | | ... | |
* | | | | | |
* +----+ +----+ +----+
* (startx,starty)
* <-------------->
* repeatx
*
* startx/endx and endx/endy define a rectangular region instance's dimensions.
* The region instance is then repeated every repeatx/repeaty (if specified).
*
* Within a particular region instance a block of block_type is laid down every
* incrx/incry units (if not specified defaults to block width/height):
*
*
* * = an instance of block_type within the region
*
* +------------------------------+
* |* * * *|
* | |
* | |
* | |
* | |
* | |
* |* * * *|
* ^ | |
* | | |
* incry | | |
* | | |
* v | |
* |* * * *|
* +------------------------------+
*
* <------->
* incrx
*
* In the above diagram incrx = 10, and incry = 6
*/
struct t_grid_loc_def {
t_grid_loc_def(std::string block_type_val, int priority_val)
: block_type(std::move(block_type_val))
, priority(priority_val)
, x{"0", "W-1", "max(w+1,W)", "w"} // Fill in x direction, no repeat, incr by block width
, y{"0", "H-1", "max(h+1,H)", "h"} // Fill in y direction, no repeat, incr by block height
{}

std::string block_type; ///< The block type name

int priority = 0; ///< Priority of the specification. In case of conflicting specifications the largest priority wins.

t_grid_loc_spec x; ///< Horizontal location specification
t_grid_loc_spec y; ///< Vertical location specification

/**
* @brief When 1 metadata tag is split among multiple t_grid_loc_def, one
* t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
* t_grid_loc_def point to the owned version.
*
*/
std::unique_ptr<t_metadata_dict> owned_meta;

/**
* @brief Metadata for this location definition. This
* metadata may be shared with multiple grid_locs
* that come from a common definition.
*/
t_metadata_dict* meta = nullptr;
};

/**
* @brief Enum for specfying if the architecture grid specification is for an auto sized device (variable size)
* or a fixed size device.
*/
enum class e_grid_def_type {
AUTO,
FIXED
};
57 changes: 57 additions & 0 deletions libs/libarchfpga/src/interposer_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

/**
* @file interposer_types.h
* @brief This file contains types used for parsing interposer-related tags such as <interposer_cut> and <interdie_wire>
* and converting that information into the device architecture-related data structures.
*
*/

#include <unordered_map>
#include <vector>
#include <string>
#include "grid_types.h"

/**
* @brief Enum for direction of an interposer cut. X means horizontal cut and Y means vertical cut.
*
*/
enum class e_interposer_cut_dim {
X,
Y
};

// Lookup table for converting between a character and an e_interposer_cut_dim
inline const std::unordered_map<char, e_interposer_cut_dim> CHAR_INTERPOSER_DIM_MAP = {
{'X', e_interposer_cut_dim::X},
{'x', e_interposer_cut_dim::X},
{'Y', e_interposer_cut_dim::Y},
{'y', e_interposer_cut_dim::Y}};

/**
* @brief Struct containing information of interdire wires i.e. connections between the dies on an interposer
*
*/
struct t_interdie_wire_inf {
std::string sg_name; ///< Name of the scatter-gather pattern to be used for the interdie connection
std::string sg_link; ///< Name of the scatter-gather link to be used for the interdie connection
/**
* @brief
* Contains starting and ending point (both inclusive) of scatter-gather instantiations and the increment/distance between the instantiations.
* offset_definition.repeat_expr is not relevant for interdie wires and is not set to anything or used.
*
* Locations defined by this offset definition define the starting point or the gathering point of the SG pattern. The end or scatter point of the SG pattern is defined by the sg_link.
*/
t_grid_loc_spec offset_definition;
int num; ///< Number of scatter-gather instantiations per switchblock location
};

/**
* @brief Struct containing information of an interposer cut
*
*/
struct t_interposer_cut_inf {
e_interposer_cut_dim dim; ///< Dimension or axis of interposer cut.
int loc; ///< Location of the cut on the grid. Locations start from zero and cuts will happen above or to the right of the tiles at location=loc.
std::vector<t_interdie_wire_inf> interdie_wires; ///< Connectivity specification between the two sides of the cut.
};
Loading