Skip to content

Specify available moves explicitly #2542

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 5 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 6 additions & 4 deletions libs/libarchfpga/src/device_grid.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#include "device_grid.h"

#include <utility>

DeviceGrid::DeviceGrid(std::string grid_name, vtr::NdMatrix<t_grid_tile, 3> grid)
: name_(grid_name)
, grid_(grid) {
: name_(std::move(grid_name))
, grid_(std::move(grid)) {
count_instances();
}

DeviceGrid::DeviceGrid(std::string grid_name, vtr::NdMatrix<t_grid_tile, 3> grid, std::vector<t_logical_block_type_ptr> limiting_res)
: DeviceGrid(grid_name, grid) {
limiting_resources_ = limiting_res;
: DeviceGrid(std::move(grid_name), std::move(grid)) {
limiting_resources_ = std::move(limiting_res);
}

size_t DeviceGrid::num_instances(t_physical_tile_type_ptr type, int layer_num) const {
Expand Down
10 changes: 5 additions & 5 deletions libs/libvtrutil/src/vtr_ndmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class NdMatrixBase {
data_ = std::make_unique<T[]>(size());
}

///@brief Returns the size of the matrix (number of elements) calucated from the current dimensions
///@brief Returns the size of the matrix (number of elements) calculated from the current dimensions
size_t calc_size() const {
///@brief Size is the product of all dimension sizes
size_t cnt = dim_size(0);
Expand All @@ -310,7 +310,7 @@ class NdMatrixBase {
*
* Examples:
*
* //A 2-dimensional matrix with indicies [0..4][0..9]
* //A 2-dimensional matrix with indices [0..4][0..9]
* NdMatrix<int,2> m1({5,10});
*
* //Accessing an element
Expand All @@ -319,17 +319,17 @@ class NdMatrixBase {
* //Setting an element
* m1[2][8] = 0;
*
* //A 3-dimensional matrix with indicies [0..4][0..9][0..19]
* //A 3-dimensional matrix with indices [0..4][0..9][0..19]
* NdMatrix<int,3> m2({5,10,20});
*
* //A 2-dimensional matrix with indicies [0..4][0..9], with all entries
* //A 2-dimensional matrix with indices [0..4][0..9], with all entries
* //initialized to 42
* NdMatrix<int,2> m3({5,10}, 42);
*
* //Filling all entries with value 101
* m3.fill(101);
*
* //Resizing an existing matrix (all values reset to default constucted value)
* //Resizing an existing matrix (all values reset to default constructed value)
* m3.resize({5,5})
*
* //Resizing an existing matrix (all elements set to value 88)
Expand Down
4 changes: 2 additions & 2 deletions vpr/src/base/CheckSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void CheckSetup(const t_packer_opts& PackerOpts,
"Timing analysis must be enabled for timing-driven placement.\n");
}

if (!PlacerOpts.doPlacement && ("" != PlacerOpts.constraints_file)) {
if (!PlacerOpts.doPlacement && (!PlacerOpts.constraints_file.empty())) {
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
"A block location file requires that placement is enabled.\n");
}
Expand All @@ -57,7 +57,7 @@ void CheckSetup(const t_packer_opts& PackerOpts,
if (!Timing.timing_analysis_enabled
&& (DEMAND_ONLY != RouterOpts.base_cost_type && DEMAND_ONLY_NORMALIZED_LENGTH != RouterOpts.base_cost_type)) {
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
"base_cost_type must be demand_only or demand_only_normailzed_length when timing analysis is disabled.\n");
"base_cost_type must be demand_only or demand_only_normalized_length when timing analysis is disabled.\n");
}
}

Expand Down
12 changes: 6 additions & 6 deletions vpr/src/base/SetupGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ using vtr::t_formula_data;

static DeviceGrid auto_size_device_grid(const std::vector<t_grid_def>& grid_layouts, const std::map<t_logical_block_type_ptr, size_t>& minimum_instance_counts, float maximum_device_utilization);
static std::vector<t_logical_block_type_ptr> grid_overused_resources(const DeviceGrid& grid, std::map<t_logical_block_type_ptr, size_t> instance_counts);
static bool grid_satisfies_instance_counts(const DeviceGrid& grid, std::map<t_logical_block_type_ptr, size_t> instance_counts, float maximum_utilization);
static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t width, size_t height, bool warn_out_of_range = true, std::vector<t_logical_block_type_ptr> limiting_resources = std::vector<t_logical_block_type_ptr>());
static bool grid_satisfies_instance_counts(const DeviceGrid& grid, const std::map<t_logical_block_type_ptr, size_t>& instance_counts, float maximum_utilization);
static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t width, size_t height, bool warn_out_of_range = true, const std::vector<t_logical_block_type_ptr>& limiting_resources = std::vector<t_logical_block_type_ptr>());

static void CheckGrid(const DeviceGrid& grid);

Expand Down Expand Up @@ -316,8 +316,8 @@ static std::vector<t_logical_block_type_ptr> grid_overused_resources(const Devic
return overused_resources;
}

static bool grid_satisfies_instance_counts(const DeviceGrid& grid, std::map<t_logical_block_type_ptr, size_t> instance_counts, float maximum_utilization) {
//Are the resources satisified?
static bool grid_satisfies_instance_counts(const DeviceGrid& grid, const std::map<t_logical_block_type_ptr, size_t>& instance_counts, float maximum_utilization) {
//Are the resources satisfied?
auto overused_resources = grid_overused_resources(grid, instance_counts);

if (!overused_resources.empty()) {
Expand All @@ -335,7 +335,7 @@ static bool grid_satisfies_instance_counts(const DeviceGrid& grid, std::map<t_lo
}

///@brief Build the specified device grid
static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range, const std::vector<t_logical_block_type_ptr> limiting_resources) {
static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range, const std::vector<t_logical_block_type_ptr>& limiting_resources) {
if (grid_def.grid_type == GridDefType::FIXED) {
if (grid_def.width != int(grid_width) || grid_def.height != int(grid_height)) {
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
Expand Down Expand Up @@ -754,7 +754,7 @@ static void CheckGrid(const DeviceGrid& grid) {
}
}

float calculate_device_utilization(const DeviceGrid& grid, std::map<t_logical_block_type_ptr, size_t> instance_counts) {
float calculate_device_utilization(const DeviceGrid& grid, const std::map<t_logical_block_type_ptr, size_t>& instance_counts) {
//Record the resources of the grid
std::map<t_physical_tile_type_ptr, size_t> grid_resources;
for (int layer_num = 0; layer_num < grid.get_num_layers(); ++layer_num) {
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/base/SetupGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DeviceGrid create_device_grid(std::string layout_name, const std::vector<t_grid_
* Calculate the device utilization (i.e. fraction of used grid tiles)
* foor the specified grid and resource requirements
*/
float calculate_device_utilization(const DeviceGrid& grid, std::map<t_logical_block_type_ptr, size_t> instance_counts);
float calculate_device_utilization(const DeviceGrid& grid, const std::map<t_logical_block_type_ptr, size_t>& instance_counts);

/**
* @brief Returns the effective size of the device
Expand Down
3 changes: 2 additions & 1 deletion vpr/src/base/read_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,8 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
.help(
"The percentage probabilities of different moves in Simulated Annealing placement."
"This option is only effective for timing-driven placement."
"The numbers listed are interpreted as the percentage probabilities of {uniformMove, MedianMove, CentroidMove, WeightedCentroid, WeightedMedian, Timing feasible Region(TFR), Critical UniformMove}, in that order.")
"The numbers listed are interpreted as the percentage probabilities of {uniformMove, MedianMove, CentroidMove, "
"WeightedCentroid, WeightedMedian, Critical UniformMove, Timing feasible Region(TFR)}, in that order.")
.nargs('+')
.default_value({"100", "0", "0", "0", "0", "0", "0"})

Expand Down
13 changes: 4 additions & 9 deletions vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ enum class ScreenUpdatePriority {
/* Values large enough to be way out of range for any data, but small enough
* to allow a small number to be added to them without going out of range. */
#define HUGE_POSITIVE_FLOAT 1.e30
#define HUGE_NEGATIVE_FLOAT -1.e30

/* Used to avoid floating-point errors when comparing values close to 0 */
#define EPSILON 1.e-15
#define NEGATIVE_EPSILON -1.e-15

#define FIRST_ITER_WIRELENTH_LIMIT 0.85 /* If used wirelength exceeds this value in first iteration of routing, do not route */

Expand All @@ -110,12 +108,10 @@ constexpr auto INVALID_BLOCK_ID = ClusterBlockId(-2);
* and maps it to the complex logic blocks found in the architecture
******************************************************************************/

#define NO_CLUSTER -1
#define NEVER_CLUSTER -2
#define NOT_VALID -10000 /* Marks gains that aren't valid */
#define NOT_VALID (-10000) /* Marks gains that aren't valid */
/* Ensure no gain can ever be this negative! */
#ifndef UNDEFINED
# define UNDEFINED -1
# define UNDEFINED (-1)
#endif

enum class e_router_lookahead {
Expand Down Expand Up @@ -550,9 +546,8 @@ enum class e_timing_update_type {
****************************************************************************/

/* Values of number of placement available move types */
#define NUM_PL_MOVE_TYPES 7
#define NUM_PL_NONTIMING_MOVE_TYPES 3
#define NUM_PL_1ST_STATE_MOVE_TYPES 4
constexpr int NUM_PL_MOVE_TYPES = 7;
constexpr int NUM_PL_NONTIMING_MOVE_TYPES = 3;

/* Timing data structures end */
enum sched_type {
Expand Down
Loading
Loading