Skip to content

Conversation

@luis201420
Copy link
Contributor

Fixes #8540

It eliminates the need for predefined lists to find the best combination of diameter and cluster size. Both lists are no longer needed since buffer max cap includes them. The iterations that performed this search are also removed.

The following cases will now be considered as follows:

  • If the cluster size or diameter is not defined, then the buffer max cap is used to create the clusters.
  • If the cluster size is defined, then that size, along with the buffer max cap, will be used to create the clusters.
  • If the cluster diameter is defined, then the diameter, along with the buffer max cap, will be used to create the clusters.
  • Finally, in case If both values ​​are defined, then they will be used by disabling the buffer max cap.

Signed-off-by: luis201420 <[email protected]>
@luis201420 luis201420 requested a review from arthurjolo December 3, 2025 19:31
@luis201420
Copy link
Contributor Author

I ran a CI and all the public designs passed. I am waiting for the results of the private designs.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

techChar_(techChar),
maxInternalDiameter_(10),
capPerUnit_(0.0),
use_max_diameter_((HTree->getTreeType() == TreeType::MacroTree)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "cts::TreeType" is directly included [misc-include-cleaner]

src/cts/src/SinkClustering.cpp:14:

- #include "stt/SteinerTreeBuilder.h"
+ #include "TreeBuilder.h"
+ #include "stt/SteinerTreeBuilder.h"

Copy link
Contributor

@arthurjolo arthurjolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code changes look fine, it is good to leave the list of cluster sizes and diameter behind. Just one small suggestion on the method for defining if the limit is exceeded.

const double capCost,
const unsigned sizeLimit)
{
if (useMaxCapLimit_) {
Copy link
Contributor

@arthurjolo arthurjolo Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this if statement can be a bit different now that we define when to use each of the limits.

suggestion:


bool is_limit_exceeded = false
if (useMaxCapLimit_) {
  is_limit_exceeded |= (capCost > options_->getSinkBufferInputCap() * max_cap__factor_);
// size is defined by the user
if (use_max_size_) {
  is_limit_exceeded |= (size >= sizeLimit);
}
// diameter is defined by the user
if (use_max_diameter_) {
  is_limit_exceeded |= (cost > maxInternalDiameter_);
}
return is_limit_exceeded;

like this we don't need to separate into 2 different cases useMaxCap and not useMaxCap

@arthurjolo arthurjolo self-requested a review December 3, 2025 20:19
Comment on lines 209 to 214
void setMaxDiameter(double distance)
{
maxDiameter_ = distance;
sinkClusteringUseMaxCap_ = false;
maxDiameterSet_ = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the comment of the PR we would only want to disable buffer max cap if both cluster size and diameter were set. But here if we set the diameter we immediately disable the useMaxCap_.

Comment on lines 223 to 228
void setSinkClusteringSize(unsigned size)
{
sinkClustersSize_ = size;
sinkClusteringUseMaxCap_ = false;
sinkClustersSizeSet_ = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CTS: improve automatic clustering

2 participants