Skip to content

Commit

Permalink
mpl2: throw error when PAR gives MPL2 a completely unbalanced solution
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
  • Loading branch information
AcKoucher committed Dec 19, 2024
1 parent e3ab3fb commit efe43d3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/mpl2/src/clusterEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,14 @@ void ClusteringEngine::breakLargeFlatCluster(Cluster* parent)
vertex_weight,
hyperedge_weights);

if (partitionerSolutionIsFullyUnbalanced(part, num_other_cluster_vertices)) {
logger_->error(MPL,
37,
"Couldn't break flat cluster {} with PAR. The solution is "
"fully unbalanced.",
parent->getName());
}

parent->clearLeafStdCells();
parent->clearLeafMacros();

Expand Down Expand Up @@ -1481,6 +1489,27 @@ void ClusteringEngine::breakLargeFlatCluster(Cluster* parent)
breakLargeFlatCluster(raw_part_1);
}

bool ClusteringEngine::partitionerSolutionIsFullyUnbalanced(
const std::vector<int>& solution,
const int num_other_cluster_vertices)
{
// The partition of the first vertex which represents
// an actual macro or std cell.
const int first_vertex_partition = solution[num_other_cluster_vertices];
const int number_of_vertices = static_cast<int>(solution.size());

// Skip all the vertices that represents other clusters.
for (int vertex_id = num_other_cluster_vertices;
vertex_id < number_of_vertices;
++vertex_id) {
if (solution[vertex_id] != first_vertex_partition) {
return false;
}
}

return true;
}

// Recursively merge children whose number of std cells and macro
// is below the current level thresholds. There are three cases:
// 1) Children are closely connected.
Expand Down
2 changes: 2 additions & 0 deletions src/mpl2/src/clusterEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class ClusteringEngine
void createCluster(Cluster* parent);
void updateSubTree(Cluster* parent);
void breakLargeFlatCluster(Cluster* parent);
bool partitionerSolutionIsFullyUnbalanced(const std::vector<int>& solution,
int num_other_cluster_vertices);
void mergeChildrenBelowThresholds(std::vector<Cluster*>& small_children);
bool attemptMerge(Cluster* receiver, Cluster* incomer);
void fetchMixedLeaves(Cluster* parent,
Expand Down

0 comments on commit efe43d3

Please sign in to comment.