Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsz: Revamp rebuffering #6637

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

openroad-ci
Copy link
Collaborator

Improve the rebuffering code:

  • replace "slack penalization" with separate timing-oriented and area-oriented passes over the buffer tree; this should allow better area recovery on non-critical sections of the buffer tree, especially if the tree is large
  • make slight adjustments to the delay model
  • restructure some of the code

Fixes #5440, #5441

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

});

if (Z.empty())
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
return;
if (Z.empty()) {
return;
}

});

if (Z.empty())
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
return;
if (Z.empty()) {
return;
}

}

// Find initial timing-optimized rebuffering choice
BufferedNetPtr RepairSetup::rebufferForTiming(BufferedNetPtr bnet)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the parameter 'bnet' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

Suggested change
BufferedNetPtr RepairSetup::rebufferForTiming(BufferedNetPtr bnet)
BufferedNetPtr RepairSetup::rebufferForTiming(const BufferedNetPtr& bnet)

src/rsz/src/RepairSetup.hh:210:

-   BufferedNetPtr rebufferForTiming(BufferedNetPtr bnet);
+   BufferedNetPtr rebufferForTiming(const BufferedNetPtr& bnet);

using BnetPtr = BufferedNetPtr;

const BnetSeq Z = visitTree(
[this](auto& recurse, int level, BnetPtr bnet) -> BnetSeq {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the parameter 'bnet' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

      [this](auto& recurse, int level, BnetPtr bnet) -> BnetSeq {
                                               ^

case BnetType::wire: {
BnetSeq Z = recurse(bnet->ref());
for (BnetPtr& z : Z)
z = addWire(z, bnet->location(), bnet->layer(), level);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
z = addWire(z, bnet->location(), bnet->layer(), level);
for (BnetPtr& z : Z) {
z = addWire(z, bnet->location(), bnet->layer(), level);
}


// spread down arrival delay
visitTree(
[](auto& recurse, int level, BufferedNetPtr bnet, Delay arrival) -> int {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the parameter 'bnet' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

      [](auto& recurse, int level, BufferedNetPtr bnet, Delay arrival) -> int {
                                                  ^

drvr_delay);

BnetSeq Z = visitTree(
[&](auto& recurse, int level, BufferedNetPtr bnet) -> BufferedNetSeq {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the parameter 'bnet' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

      [&](auto& recurse, int level, BufferedNetPtr bnet) -> BufferedNetSeq {
                                                   ^

assert(bnet->ref()->type == BnetType::wire);
BnetSeq Z = recurse(bnet->ref()->ref());
for (BnetPtr& z : Z)
z = addWire(z, bnet->location(), bnet->ref()->layer(), level);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
z = addWire(z, bnet->location(), bnet->ref()->layer(), level);
for (BnetPtr& z : Z) {
z = addWire(z, bnet->location(), bnet->ref()->layer(), level);
}

case BnetType::wire: {
BnetSeq Z = recurse(bnet->ref());
for (BnetPtr& z : Z)
z = addWire(z, bnet->location(), bnet->layer(), level);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
z = addWire(z, bnet->location(), bnet->layer(), level);
for (BnetPtr& z : Z) {
z = addWire(z, bnet->location(), bnet->layer(), level);
}

} else {
debugPrint(logger_, RSZ, "rebuffer", 2, "no available option");
return nullptr;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use 'else' after 'return' [readability-else-after-return]

Suggested change
}
} if (best_slack_option) {
debugPrint(logger_,
RSZ,
"rebuffer",
2,
"best option {} (closest to meeting timing)",
best_slack_index);
return best_slack_option;
} else {
debugPrint(logger_, RSZ, "rebuffer", 2, "no available option");
return nullptr;
}

povik added 9 commits February 5, 2025 14:44
Buffered net constructor already sets the appropriate capacitance value
for each bnet type.

Signed-off-by: Martin Povišer <[email protected]>
Signed-off-by: Martin Povišer <[email protected]>
Signed-off-by: Martin Povišer <[email protected]>
Signed-off-by: Martin Povišer <[email protected]>
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

while (pin_iter->hasNext()) {
const Pin *pin = pin_iter->next();
const LibertyPort *port;
if ((port = network_->libertyPort(pin)) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition]

      if ((port = network_->libertyPort(pin)) &&
           ^
Additional context

src/rsz/src/Resizer.cc:303: if it should be an assignment, move it out of the 'if' condition

      if ((port = network_->libertyPort(pin)) &&
           ^

src/rsz/src/Resizer.cc:303: if it is meant to be an equality check, change '=' to '=='

      if ((port = network_->libertyPort(pin)) &&
           ^

insts.push_back(inst);
const Pin *out_pin = network_->findPin(inst, out);
if (out_pin)
queue.push_back(network_->net(out_pin));
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: statement should be inside braces [google-readability-braces-around-statements]

Suggested change
queue.push_back(network_->net(out_pin));
if (out_pin) {
queue.push_back(network_->net(out_pin));
}

povik added 4 commits February 5, 2025 16:27
Signed-off-by: Martin Povišer <[email protected]>
Signed-off-by: Martin Povišer <[email protected]>
Copy link
Contributor

github-actions bot commented Feb 6, 2025

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: Martin Povišer <[email protected]>
Copy link
Contributor

github-actions bot commented Feb 6, 2025

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: Martin Povišer <[email protected]>
Copy link
Contributor

github-actions bot commented Feb 7, 2025

clang-tidy review says "All clean, LGTM! 👍"

@povik
Copy link
Contributor

povik commented Feb 7, 2025

Overall the effect of this change is a slight improvement in timing QoR: https://dashboard.precisioninno.com/compare?sourceAType=Commit&sourceBType=Commit&sourceBName=80fedddbbc3e57d381ef2685597027e220f23586&sourceBID=2&sourceAName=ae2e846418d75a113415ef9bf2d88999226a8846&sourceAID=5099

On public designs, the metric failures are:

gf180 ibex (base)
 Flow reached last stage.
 Found 2 metrics failures.
     [ERROR] globalroute__antenna_diodes_count fail test: 2.0 <= 0.0
     [ERROR] detailedroute__antenna_diodes_count fail test: 8.0 <= 5.0

gf180 riscv32i (base)
 Flow reached last stage.
 Found 1 metrics failures.
     [ERROR] globalroute__antenna_diodes_count fail test: 1.0 <= 0.0

sky130hd riscv32i (base)
 Flow reached last stage.
 Found 2 metrics failures.
     [ERROR] globalroute__antenna_diodes_count fail test: 5.0 <= 4.0
     [ERROR] finish__timing__drv__setup_violation_count fail test: 438.0 <= 376.0

I've started secure CI under secure-rsz-rebuffer-revamp

@povik povik requested a review from maliberty February 7, 2025 10:30
worst slack -0.15
No differences found.
worst slack -0.13
Differences found at line 312.
Copy link
Collaborator

Choose a reason for hiding this comment

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

No differences

@maliberty maliberty requested review from precisionmoon and removed request for maliberty February 12, 2025 17:20
@maliberty
Copy link
Member

@povik you have some conflicts to resolve
@precisionmoon please review

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.

rsz: Rebuffering wire delay model can be better
4 participants