Skip to content

Commit bb2d5cf

Browse files
Update SetupGrid.cpp
1 parent 6382aaf commit bb2d5cf

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

vpr/src/base/SetupGrid.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static DeviceGrid auto_size_device_grid(const std::vector<t_grid_def>& grid_layo
3333
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);
3434
static bool grid_satisfies_instance_counts(const DeviceGrid& grid, const std::map<t_logical_block_type_ptr, size_t>& instance_counts, float maximum_utilization);
3535
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>());
36-
static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range = true);
36+
static vtr::NdMatrix<const VibInf*, 3> build_vib_device_grid(const t_vib_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range = true);
3737

3838
static void CheckGrid(const DeviceGrid& grid);
3939

@@ -47,11 +47,11 @@ static void set_grid_block_type(int priority,
4747
const t_metadata_dict* meta);
4848

4949
static void set_vib_grid_block_type(int priority,
50-
const t_vib_inf* type,
50+
const VibInf* type,
5151
int layer_num,
5252
size_t x_root,
5353
size_t y_root,
54-
vtr::NdMatrix<const t_vib_inf*, 3>& vib_grid,
54+
vtr::NdMatrix<const VibInf*, 3>& vib_grid,
5555
vtr::NdMatrix<int, 3>& grid_priorities,
5656
const t_metadata_dict* meta);
5757

@@ -148,7 +148,7 @@ DeviceGrid create_device_grid(const std::string& layout_name, const std::vector<
148148
}
149149
}
150150

151-
vtr::NdMatrix<const t_vib_inf*, 3> create_vib_device_grid(std::string layout_name, const std::vector<t_vib_grid_def>& vib_grid_layouts) {
151+
vtr::NdMatrix<const VibInf*, 3> create_vib_device_grid(std::string layout_name, const std::vector<t_vib_grid_def>& vib_grid_layouts) {
152152
if (layout_name == "auto") {
153153
//We do not support auto layout now
154154
//
@@ -591,7 +591,7 @@ static DeviceGrid build_device_grid(const t_grid_def& grid_def, size_t grid_widt
591591
}
592592

593593
///@brief Build the specified device grid
594-
static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range) {
594+
static vtr::NdMatrix<const VibInf*, 3> build_vib_device_grid(const t_vib_grid_def& grid_def, size_t grid_width, size_t grid_height, bool warn_out_of_range) {
595595
if (grid_def.grid_type == GridDefType::FIXED) {
596596
if (grid_def.width != int(grid_width) || grid_def.height != int(grid_height)) {
597597
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
@@ -603,7 +603,7 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
603603
auto& device_ctx = g_vpr_ctx.device();
604604

605605
//Initialize the grid and each location priority based on available dies in the architecture file
606-
vtr::NdMatrix<const t_vib_inf*, 3> vib_grid;
606+
vtr::NdMatrix<const VibInf*, 3> vib_grid;
607607
vtr::NdMatrix<int, 3> grid_priorities;
608608
int num_layers = (int)grid_def.layers.size();
609609
vib_grid.resize(std::array<size_t, 3>{(size_t)num_layers, grid_width, grid_height});
@@ -613,7 +613,7 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
613613
grid_priorities.resize(std::array<size_t, 3>{(size_t)num_layers, grid_width, grid_height}, std::numeric_limits<int>::lowest());
614614

615615
//Initialize the device to all empty blocks
616-
const t_vib_inf* empty_type = nullptr;
616+
const VibInf* empty_type = nullptr;
617617
//VTR_ASSERT(empty_type != nullptr);
618618
for (int layer = 0; layer < num_layers; ++layer) {
619619
for (size_t x = 0; x < grid_width; ++x) {
@@ -628,14 +628,14 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
628628
}
629629

630630
FormulaParser p;
631-
std::set<const t_vib_inf*> seen_types;
631+
std::set<const VibInf*> seen_types;
632632
for (int layer = 0; layer < num_layers; layer++) {
633633
for (const auto& grid_loc_def : grid_def.layers.at(layer).loc_defs) {
634634
//Fill in the block types according to the specification
635635
//auto type = find_tile_type_by_name(grid_loc_def.block_type, device_ctx.physical_tile_types);
636-
const t_vib_inf* type = nullptr;
636+
const VibInf* type = nullptr;
637637
for (size_t vib_type = 0; vib_type < device_ctx.arch->vib_infs.size(); vib_type++) {
638-
if (grid_loc_def.block_type == device_ctx.arch->vib_infs[vib_type].name) {
638+
if (grid_loc_def.block_type == device_ctx.arch->vib_infs[vib_type].get_name()) {
639639
type = &device_ctx.arch->vib_infs[vib_type];
640640
break;
641641
}
@@ -686,15 +686,15 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
686686
if (startx > grid_width - 1) {
687687
if (warn_out_of_range) {
688688
VTR_LOG_WARN("Block type '%s' grid location specification startx (%s = %d) falls outside device horizontal range [%d,%d]\n",
689-
type->name, xspec.start_expr.c_str(), startx, 0, grid_width - 1);
689+
type->get_name(), xspec.start_expr.c_str(), startx, 0, grid_width - 1);
690690
}
691691
continue; //No instances will be created
692692
}
693693

694694
if (starty > grid_height - 1) {
695695
if (warn_out_of_range) {
696696
VTR_LOG_WARN("Block type '%s' grid location specification starty (%s = %d) falls outside device vertical range [%d,%d]\n",
697-
type->name, yspec.start_expr.c_str(), starty, 0, grid_height - 1);
697+
type->get_name(), yspec.start_expr.c_str(), starty, 0, grid_height - 1);
698698
}
699699
continue; //No instances will be created
700700
}
@@ -703,28 +703,28 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
703703
if (endx > grid_width - 1) {
704704
if (warn_out_of_range) {
705705
VTR_LOG_WARN("Block type '%s' grid location specification endx (%s = %d) falls outside device horizontal range [%d,%d]\n",
706-
type->name, xspec.end_expr.c_str(), endx, 0, grid_width - 1);
706+
type->get_name(), xspec.end_expr.c_str(), endx, 0, grid_width - 1);
707707
}
708708
}
709709

710710
if (endy > grid_height - 1) {
711711
if (warn_out_of_range) {
712712
VTR_LOG_WARN("Block type '%s' grid location specification endy (%s = %d) falls outside device vertical range [%d,%d]\n",
713-
type->name, yspec.end_expr.c_str(), endy, 0, grid_height - 1);
713+
type->get_name(), yspec.end_expr.c_str(), endy, 0, grid_height - 1);
714714
}
715715
}
716716

717717
//The end must fall after (or equal) to the start
718718
if (endx < startx) {
719719
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
720720
"Grid location specification endx (%s = %d) can not come before startx (%s = %d) for block type '%s'",
721-
xspec.end_expr.c_str(), endx, xspec.start_expr.c_str(), startx, type->name);
721+
xspec.end_expr.c_str(), endx, xspec.start_expr.c_str(), startx, type->get_name());
722722
}
723723

724724
if (endy < starty) {
725725
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
726726
"Grid location specification endy (%s = %d) can not come before starty (%s = %d) for block type '%s'",
727-
yspec.end_expr.c_str(), endy, yspec.start_expr.c_str(), starty, type->name);
727+
yspec.end_expr.c_str(), endy, yspec.start_expr.c_str(), starty, type->get_name());
728728
}
729729

730730
//The minimum increment is the block dimension
@@ -733,15 +733,15 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
733733
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
734734
"Grid location specification incrx for block type '%s' must be at least"
735735
" block width (%d) to avoid overlapping instances (was %s = %d)",
736-
type->name, 1, xspec.incr_expr.c_str(), incrx);
736+
type->get_name(), 1, xspec.incr_expr.c_str(), incrx);
737737
}
738738

739739
//VTR_ASSERT(type->height > 0);
740740
if (incry < 1/*size_t(type->height)*/) {
741741
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
742742
"Grid location specification incry for block type '%s' must be at least"
743743
" block height (%d) to avoid overlapping instances (was %s = %d)",
744-
type->name, 1, yspec.incr_expr.c_str(), incry);
744+
type->get_name(), 1, yspec.incr_expr.c_str(), incry);
745745
}
746746

747747
//The minimum repeat is the region dimension
@@ -750,15 +750,15 @@ static vtr::NdMatrix<const t_vib_inf*, 3> build_vib_device_grid(const t_vib_grid
750750
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
751751
"Grid location specification repeatx for block type '%s' must be at least"
752752
" the region width (%d) to avoid overlapping instances (was %s = %d)",
753-
type->name, region_width, xspec.repeat_expr.c_str(), repeatx);
753+
type->get_name(), region_width, xspec.repeat_expr.c_str(), repeatx);
754754
}
755755

756756
size_t region_height = endy - starty + 1; //+1 since start/end are both inclusive
757757
if (repeaty < region_height) {
758758
VPR_FATAL_ERROR(VPR_ERROR_ARCH,
759759
"Grid location specification repeaty for block type '%s' must be at least"
760760
" the region height (%d) to avoid overlapping instances (was %s = %d)",
761-
type->name, region_height, xspec.repeat_expr.c_str(), repeaty);
761+
type->get_name(), region_height, xspec.repeat_expr.c_str(), repeaty);
762762
}
763763

764764
//VTR_LOG("Applying grid_loc_def for '%s' priority %d startx=%s=%zu, endx=%s=%zu, starty=%s=%zu, endx=%s=%zu,\n",
@@ -952,22 +952,22 @@ static void set_grid_block_type(int priority,
952952
}
953953

954954
static void set_vib_grid_block_type(int priority,
955-
const t_vib_inf* type,
955+
const VibInf* type,
956956
int layer_num,
957957
size_t x_root,
958958
size_t y_root,
959-
vtr::NdMatrix<const t_vib_inf*, 3>& vib_grid,
959+
vtr::NdMatrix<const VibInf*, 3>& vib_grid,
960960
vtr::NdMatrix<int, 3>& grid_priorities,
961961
const t_metadata_dict* meta) {
962962
struct TypeLocation {
963-
TypeLocation(size_t x_val, size_t y_val, const t_vib_inf* type_val, int priority_val)
963+
TypeLocation(size_t x_val, size_t y_val, const VibInf* type_val, int priority_val)
964964
: x(x_val)
965965
, y(y_val)
966966
, type(type_val)
967967
, priority(priority_val) {}
968968
size_t x;
969969
size_t y;
970-
const t_vib_inf* type;
970+
const VibInf* type;
971971
int priority;
972972

973973
bool operator<(const TypeLocation& rhs) const {
@@ -1012,8 +1012,8 @@ static void set_vib_grid_block_type(int priority,
10121012
" Existing block type '%s' at (%zu,%zu) has the same priority (%d) as new overlapping type '%s'."
10131013
" The last specification will apply.\n",
10141014
x_root, y_root,
1015-
max_priority_type_loc.type->name, max_priority_type_loc.x, max_priority_type_loc.y,
1016-
priority, type->name);
1015+
max_priority_type_loc.type->get_name(), max_priority_type_loc.x, max_priority_type_loc.y,
1016+
priority, type->get_name());
10171017
}
10181018

10191019
//Mark all the grid tiles 'covered' by this block with the appropriate type

0 commit comments

Comments
 (0)