Skip to content

Commit 6aef5f5

Browse files
committed
gaurd enable_placer_debug with VTR_ENABLE_DEBUG_LOGGING
1 parent e69a7fe commit 6aef5f5

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -978,13 +978,9 @@ static void place_all_blocks(const t_placer_opts& placer_opts, vtr::vector<Clust
978978

979979
auto blk_id_type = cluster_ctx.clb_nlist.block_type(blk_id);
980980

981-
const auto& cluster_blk_pb_type = cluster_ctx.clb_nlist.block_type(blk_id)->pb_type;
982-
int block_num_pins = cluster_blk_pb_type ? cluster_blk_pb_type->num_pins : 0;
983-
std::vector<size_t> block_nets(block_num_pins, OPEN);
984-
for (int ipin = 0; ipin < block_num_pins; ipin++) {
985-
block_nets[ipin] = (size_t)cluster_ctx.clb_nlist.block_net(blk_id, ipin);
986-
}
987-
enable_placer_debug(placer_opts, size_t(blk_id), block_nets);
981+
#ifndef VTR_ENABLE_DEBUG_LOGGING
982+
enable_placer_debug(placer_opts, blk_id);
983+
#endif
988984
VTR_LOGV_DEBUG(g_vpr_ctx.placement().f_placer_debug, "Popped Block %d\n", size_t(blk_id));
989985

990986
blocks_placed_since_heap_update++;

vpr/src/place/move_utils.cpp

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,23 @@ std::set<t_pl_loc> determine_locations_emptied_by_move(t_pl_blocks_to_be_moved&
497497
return empty_locs;
498498
}
499499

500+
#ifndef VTR_ENABLE_DEBUG_LOGGING
500501
void enable_placer_debug(const t_placer_opts& placer_opts,
501-
int blk_id_num,
502-
const std::vector<size_t>& net_id_nums) {
502+
ClusterBlockId blk_id) {
503+
if (!blk_id.is_valid()) {
504+
return;
505+
}
506+
507+
int blk_id_num = (int) size_t(blk_id);
508+
// Get the nets connected to the block
509+
const auto& cluster_ctx = g_vpr_ctx.clustering();
510+
const auto& cluster_blk_pb_type = cluster_ctx.clb_nlist.block_type(blk_id)->pb_type;
511+
int block_num_pins = cluster_blk_pb_type ? cluster_blk_pb_type->num_pins : 0;
512+
std::vector<ClusterNetId> block_nets(block_num_pins, ClusterNetId::INVALID());
513+
for (int ipin = 0; ipin < block_num_pins; ipin++) {
514+
block_nets[ipin] = cluster_ctx.clb_nlist.block_net(blk_id, ipin);
515+
}
516+
503517
bool& f_placer_debug = g_vpr_ctx.mutable_placement().f_placer_debug;
504518

505519
bool active_blk_debug = (placer_opts.placer_debug_block >= -1);
@@ -517,21 +531,22 @@ void enable_placer_debug(const t_placer_opts& placer_opts,
517531
if (placer_opts.placer_debug_net == -1) {
518532
match_net = true;
519533
} else {
520-
for (size_t net_id_num : net_id_nums) {
521-
if ((int)net_id_num != OPEN && placer_opts.placer_debug_net == (int)net_id_num) {
522-
match_net = true;
523-
break;
534+
for (const auto& net_id : block_nets) {
535+
if (net_id.is_valid()) {
536+
int net_id_num = (int) size_t(net_id);
537+
if (placer_opts.placer_debug_net == net_id_num) {
538+
match_net = true;
539+
break;
540+
}
524541
}
525542
}
526543
}
527544

528545
if (active_blk_debug) f_placer_debug &= match_blk;
529546
if (active_net_debug) f_placer_debug &= match_net;
530547

531-
#ifndef VTR_ENABLE_DEBUG_LOGGING
532-
VTR_LOGV_WARN(f_placer_debug, "Limited placer debug output provided since compiled without VTR_ENABLE_DEBUG_LOGGING defined\n");
533-
#endif
534548
}
549+
#endif
535550

536551
ClusterBlockId propose_block_to_move(const t_placer_opts& placer_opts,
537552
int& logical_blk_type_index,
@@ -559,16 +574,9 @@ ClusterBlockId propose_block_to_move(const t_placer_opts& placer_opts,
559574
b_from = pick_from_block(logical_blk_type_index);
560575
}
561576
}
562-
563-
if (b_from) {
564-
const auto& cluster_blk_pb_type = cluster_ctx.clb_nlist.block_type(b_from)->pb_type;
565-
int block_num_pins = cluster_blk_pb_type ? cluster_blk_pb_type->num_pins : 0;
566-
std::vector<size_t> block_nets(block_num_pins, OPEN);
567-
for (int ipin = 0; ipin < block_num_pins; ipin++) {
568-
block_nets[ipin] = (size_t)cluster_ctx.clb_nlist.block_net(b_from, ipin);
569-
}
570-
enable_placer_debug(placer_opts, size_t(b_from), block_nets);
571-
}
577+
#ifndef VTR_ENABLE_DEBUG_LOGGING
578+
enable_placer_debug(placer_opts, b_from);
579+
#endif
572580

573581
return b_from;
574582
}

vpr/src/place/move_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,9 @@ bool intersect_range_limit_with_floorplan_constraints(t_logical_block_type_ptr t
328328

329329
std::string e_move_result_to_string(e_move_result move_outcome);
330330

331+
#ifndef VTR_ENABLE_DEBUG_LOGGING
331332
void enable_placer_debug(const t_placer_opts& placer_opts,
332-
int blk_id_num,
333-
const std::vector<size_t>& net_id_nums);
333+
ClusterBlockId blk_id);
334+
#endif
334335

335336
#endif

0 commit comments

Comments
 (0)