Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fda766d

Browse files
committedSep 20, 2024·
[ClusterLegalizer] Cleaned Up Cluster Placement Stats
Removed external access to the cluster placement stats. Made the cluster palcement info private for each cluster. The cluster placement info of each cluster was being shared per cluster type. This caused issues when two clusters were being created at the same time.
1 parent e38c0f3 commit fda766d

File tree

53 files changed

+3710
-3702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3710
-3702
lines changed
 

‎libs/libarchfpga/src/physical_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,6 @@ class t_pb_graph_node {
12931293
int total_pb_pins; /* only valid for top-level */
12941294

12951295
void* temp_scratch_pad; /* temporary data, useful for keeping track of things when traversing data structure */
1296-
t_cluster_placement_primitive* cluster_placement_primitive; /* pointer to indexing structure useful during packing stage */
12971296

12981297
int* input_pin_class_size; /* Stores the number of pins that belong to a particular input pin class */
12991298
int num_input_pin_class; /* number of input pin classes that this pb_graph_node has */

‎vpr/src/base/vpr_types.cpp

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -452,100 +452,3 @@ void t_pb::set_atom_pin_bit_index(const t_pb_graph_pin* gpin, BitIndex atom_pin_
452452
pin_rotations_[gpin] = atom_pin_bit_idx;
453453
}
454454

455-
/**
456-
* Free linked lists found in cluster_placement_stats_list
457-
*/
458-
void free_cluster_placement_stats(t_cluster_placement_stats* cluster_placement_stats_list) {
459-
auto& device_ctx = g_vpr_ctx.device();
460-
461-
for (const auto& type : device_ctx.logical_block_types) {
462-
int index = type.index;
463-
cluster_placement_stats_list[index].free_primitives();
464-
}
465-
delete[] cluster_placement_stats_list;
466-
}
467-
468-
void t_cluster_placement_stats::move_inflight_to_tried() {
469-
tried.insert(*in_flight.begin());
470-
in_flight.clear();
471-
}
472-
473-
void t_cluster_placement_stats::invalidate_primitive_and_increment_iterator(int pb_type_index, std::unordered_multimap<int, t_cluster_placement_primitive*>::iterator& it) {
474-
invalid.insert(*it);
475-
valid_primitives[pb_type_index].erase(it++);
476-
}
477-
478-
void t_cluster_placement_stats::move_primitive_to_inflight(int pb_type_index, std::unordered_multimap<int, t_cluster_placement_primitive*>::iterator& it) {
479-
in_flight.insert(*it);
480-
valid_primitives[pb_type_index].erase(it);
481-
}
482-
483-
/**
484-
* @brief Put primitive back on the correct location of valid primitives vector based on the primitive pb type
485-
*
486-
* @note that valid status is not changed because if the primitive is not valid, it will get properly collected later
487-
*/
488-
void t_cluster_placement_stats::insert_primitive_in_valid_primitives(std::pair<int, t_cluster_placement_primitive*> cluster_placement_primitive) {
489-
int i;
490-
bool success = false;
491-
int null_index = OPEN;
492-
t_cluster_placement_primitive* input_cluster_placement_primitive = cluster_placement_primitive.second;
493-
494-
for (i = 0; i < num_pb_types && !success; i++) {
495-
if (valid_primitives[i].empty()) {
496-
null_index = i;
497-
continue;
498-
}
499-
t_cluster_placement_primitive* cur_cluster_placement_primitive = valid_primitives[i].begin()->second;
500-
if (input_cluster_placement_primitive->pb_graph_node->pb_type
501-
== cur_cluster_placement_primitive->pb_graph_node->pb_type) {
502-
success = true;
503-
valid_primitives[i].insert(cluster_placement_primitive);
504-
}
505-
}
506-
if (!success) {
507-
VTR_ASSERT(null_index != OPEN);
508-
valid_primitives[null_index].insert(cluster_placement_primitive);
509-
}
510-
}
511-
512-
void t_cluster_placement_stats::flush_queue(std::unordered_multimap<int, t_cluster_placement_primitive*>& queue) {
513-
for (auto& it : queue) {
514-
insert_primitive_in_valid_primitives(it);
515-
}
516-
queue.clear();
517-
}
518-
519-
void t_cluster_placement_stats::flush_intermediate_queues() {
520-
flush_queue(in_flight);
521-
flush_queue(tried);
522-
}
523-
524-
void t_cluster_placement_stats::flush_invalid_queue() {
525-
flush_queue(invalid);
526-
}
527-
528-
bool t_cluster_placement_stats::in_flight_empty() {
529-
return in_flight.empty();
530-
}
531-
532-
t_pb_type* t_cluster_placement_stats::in_flight_type() {
533-
return in_flight.begin()->second->pb_graph_node->pb_type;
534-
}
535-
536-
void t_cluster_placement_stats::free_primitives() {
537-
for (auto& primitive : tried)
538-
delete primitive.second;
539-
540-
for (auto& primitive : in_flight)
541-
delete primitive.second;
542-
543-
for (auto& primitive : invalid)
544-
delete primitive.second;
545-
546-
for (int j = 0; j < num_pb_types; j++) {
547-
for (auto& primitive : valid_primitives[j]) {
548-
delete primitive.second;
549-
}
550-
}
551-
}

0 commit comments

Comments
 (0)
Please sign in to comment.