Skip to content

Commit 99f0cd6

Browse files
committed
place: added post-placement resources utilization log
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 53a91e9 commit 99f0cd6

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

vpr/src/base/SetupGrid.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,7 @@ float calculate_device_utilization(const DeviceGrid& grid, std::map<t_logical_bl
664664
//Determine the area of instances in tile units
665665
float instance_area = 0.;
666666
for (auto& kv : instance_counts) {
667-
// XXX How to deal with multiple possible tiles?
668-
t_physical_tile_type_ptr type = kv.first->equivalent_tiles[0];
667+
t_physical_tile_type_ptr type = physical_tile_type(kv.first);
669668
size_t count = kv.second;
670669

671670
float type_area = type->width * type->height;

vpr/src/place/place.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ static void print_place_status(const float t,
439439
const float rlim,
440440
const float crit_exponent,
441441
size_t tot_moves);
442+
static void print_resources_utilization();
442443

443444
/*****************************************************************************/
444445
void try_place(const t_placer_opts& placer_opts,
@@ -832,6 +833,8 @@ void try_place(const t_placer_opts& placer_opts,
832833

833834
report_aborted_moves();
834835

836+
print_resources_utilization();
837+
835838
free_placement_structs(placer_opts);
836839
if (placer_opts.place_algorithm == PATH_TIMING_DRIVEN_PLACE
837840
|| placer_opts.enable_timing_computations) {
@@ -2962,3 +2965,33 @@ static void print_place_status(const float t,
29622965
VTR_LOG(" %6.3f\n", t / oldt);
29632966
fflush(stdout);
29642967
}
2968+
2969+
static void print_resources_utilization() {
2970+
auto& place_ctx = g_vpr_ctx.placement();
2971+
auto& cluster_ctx = g_vpr_ctx.clustering();
2972+
auto& device_ctx = g_vpr_ctx.device();
2973+
2974+
//Record the resource requirement
2975+
std::map<t_logical_block_type_ptr, size_t> num_type_instances;
2976+
std::map<t_logical_block_type_ptr, std::map<t_physical_tile_type_ptr, size_t>> num_placed_instances;
2977+
for (auto blk_id : cluster_ctx.clb_nlist.blocks()) {
2978+
auto block_loc = place_ctx.block_locs[blk_id];
2979+
auto loc = block_loc.loc;
2980+
2981+
auto physical_tile = device_ctx.grid[loc.x][loc.y].type;
2982+
auto logical_block = cluster_ctx.clb_nlist.block_type(blk_id);
2983+
2984+
num_type_instances[logical_block]++;
2985+
num_placed_instances[logical_block][physical_tile]++;
2986+
}
2987+
2988+
for (auto logical_block : num_type_instances) {
2989+
VTR_LOG("Logical Block: %s\n", logical_block.first->name);
2990+
VTR_LOG("\tInstances -> %d\n", logical_block.second);
2991+
2992+
VTR_LOG("\tPhysical Tiles used:\n");
2993+
for (auto physical_tile : num_placed_instances[logical_block.first]) {
2994+
VTR_LOG("\t\t%s: %d\n", physical_tile.first->name, physical_tile.second);
2995+
}
2996+
}
2997+
}

vpr/src/util/vpr_utils.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ void sync_grid_to_blocks() {
162162

163163
auto type = physical_tile_type(blk_id);
164164

165-
auto logical_type = cluster_ctx.clb_nlist.block_type(blk_id);
166-
VTR_LOG("PHYSICAL TILE: %s\tLOGICAL_BLOCK: %s\n", type->name, logical_type->name);
167-
168165
/* Check range of block coords */
169166
if (blk_x < 0 || blk_y < 0
170167
|| (blk_x + type->width - 1) > int(device_ctx.grid.width() - 1)

0 commit comments

Comments
 (0)