Skip to content

Commit edfc3cc

Browse files
remove blocks_per_type() from clustered_netlist
1 parent 14fd2da commit edfc3cc

File tree

5 files changed

+1
-25
lines changed

5 files changed

+1
-25
lines changed

vpr/src/base/clustered_netlist.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,6 @@ t_logical_block_type_ptr ClusteredNetlist::block_type(const ClusterBlockId id) c
3030
return block_types_[id];
3131
}
3232

33-
const std::vector<ClusterBlockId>& ClusteredNetlist::blocks_per_type(const t_logical_block_type& blk_type) const {
34-
// empty vector is declared static to avoid re-allocation every time the function is called
35-
static std::vector<ClusterBlockId> empty_vector;
36-
if (blocks_per_type_.count(blk_type.index) == 0) {
37-
return empty_vector;
38-
}
39-
40-
// the vector is returned as const reference to avoid unnecessary copies,
41-
// especially that returned vectors may be very large as they contain
42-
// all clustered blocks with a specific block type
43-
return blocks_per_type_.at(blk_type.index);
44-
}
45-
4633
ClusterNetId ClusteredNetlist::block_net(const ClusterBlockId blk_id, const int logical_pin_index) const {
4734
auto pin_id = block_pin(blk_id, logical_pin_index);
4835

@@ -123,8 +110,6 @@ ClusterBlockId ClusteredNetlist::create_block(const char* name, t_pb* pb, t_logi
123110
block_pbs_.insert(blk_id, pb);
124111
block_types_.insert(blk_id, type);
125112

126-
blocks_per_type_[type->index].push_back(blk_id);
127-
128113
//Allocate and initialize every potential pin of the block
129114
block_logical_pins_.insert(blk_id, std::vector<ClusterPinId>(get_max_num_pins(type), ClusterPinId::INVALID()));
130115
}
@@ -185,14 +170,11 @@ ClusterNetId ClusteredNetlist::create_net(const std::string& name) {
185170
}
186171

187172
void ClusteredNetlist::remove_block_impl(const ClusterBlockId blk_id) {
188-
//find the block type, so we can remove it from blocks_per_type_ data structure
189-
auto blk_type = block_type(blk_id);
190173
//Remove & invalidate pointers
191174
free_pb(block_pbs_[blk_id]);
192175
delete block_pbs_[blk_id];
193176
block_pbs_.insert(blk_id, NULL);
194177
block_types_.insert(blk_id, NULL);
195-
std::remove(blocks_per_type_[blk_type->index].begin(), blocks_per_type_[blk_type->index].end(), blk_id);
196178
block_logical_pins_.insert(blk_id, std::vector<ClusterPinId>());
197179
}
198180

vpr/src/base/clustered_netlist.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ class ClusteredNetlist : public Netlist<ClusterBlockId, ClusterPortId, ClusterPi
134134
///@brief Returns the type of CLB (Logic block, RAM, DSP, etc.)
135135
t_logical_block_type_ptr block_type(const ClusterBlockId id) const;
136136

137-
///@brief Returns the blocks with the specific block types in the netlist
138-
const std::vector<ClusterBlockId>& blocks_per_type(const t_logical_block_type& blk_type) const;
139-
140137
///@brief Returns the net of the block attached to the specific pin index
141138
ClusterNetId block_net(const ClusterBlockId blk_id, const int pin_index) const;
142139

vpr/src/place/initial_placement.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,6 @@ bool place_one_block(const ClusterBlockId& blk_id,
11571157
static void alloc_and_load_movable_blocks() {
11581158
auto& place_ctx = g_vpr_ctx.mutable_placement();
11591159
auto& cluster_ctx = g_vpr_ctx.clustering();
1160-
auto& device_ctx = g_vpr_ctx.device();
11611160

11621161
place_ctx.movable_blocks.clear();
11631162
place_ctx.movable_blocks_per_type.clear();

vpr/src/place/place.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4369,14 +4369,13 @@ static void print_placement_move_types_stats(
43694369
}
43704370

43714371
auto& device_ctx = g_vpr_ctx.device();
4372-
auto& cluster_ctx = g_vpr_ctx.clustering();
43734372
int count = 0;
43744373
int num_of_avail_moves = move_type_stat.blk_type_moves.size() / device_ctx.logical_block_types.size();
43754374

43764375
//Print placement information for each block type
43774376
for (const auto& itype : device_ctx.logical_block_types) {
43784377
//Skip non-existing block types in the netlist
4379-
if (itype.index == 0 || cluster_ctx.clb_nlist.blocks_per_type(itype).empty()) {
4378+
if (itype.index == 0 || movable_blocks_per_type(itype).empty()) {
43804379
continue;
43814380
}
43824381

vpr/src/place/simpleRL_move_generator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ t_propose_action SoftmaxAgent::propose_action() {
302302
}
303303

304304
void SoftmaxAgent::set_block_ratio_() {
305-
auto& cluster_ctx = g_vpr_ctx.clustering();
306305
const auto& place_ctx = g_vpr_ctx.placement();
307306
size_t num_movable_total_blocks = place_ctx.movable_blocks.size();
308307

0 commit comments

Comments
 (0)