Skip to content

dpl: updateHistCost() runtime improvement#10979

Open
gudeh wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
gudeh:dpl-histCost-improvement
Open

dpl: updateHistCost() runtime improvement#10979
gudeh wants to merge 4 commits into
The-OpenROAD-Project:masterfrom
gudeh:dpl-histCost-improvement

Conversation

@gudeh

@gudeh gudeh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace std::unodered_set to std::vector for container to check already visited pixels at NegotiationLegalizer::updateHistoryCosts().

While investigating with VTune I realized our current bottleneck is with updateHistoryCosts(), with system time at std::unodered_set.
image

With this change we get the following situation:
image

Type of Change

  • runtime improvement

Impact

For a private design with 413K instances we go from 48sec to 34sec to execute negotiation alone.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Related Issues

We had other recent runtime improvements for negotiation: #10929, #10936, #10949. All these improvements compound, with each reducing runtime on its own.

gudeh added 2 commits July 22, 2026 23:52
replace std::unordered_set with std::vector for pixel history-cost dedup

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh
gudeh requested a review from a team as a code owner July 23, 2026 14:49
@gudeh
gudeh requested a review from osamahammad21 July 23, 2026 14:49
@gudeh

gudeh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes pixel deduplication in updateHistoryCosts by replacing the std::unordered_set with a stamp-based approach using a std::vector<uint32_t> and a generation counter. Feedback suggests defensively handling potential integer overflow of the generation counter to avoid state conflicts, and using size_t instead of int for the pixel index calculation to prevent signed integer overflow on large grids.

Comment thread src/dpl/src/NegotiationLegalizerPass.cpp
Comment thread src/dpl/src/NegotiationLegalizerPass.cpp
@gudeh gudeh changed the title Dpl hist cost improvement dpl: updateHistCost() runtime improvement Jul 23, 2026
gudeh added 2 commits July 23, 2026 22:10
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh
gudeh requested a review from maliberty July 23, 2026 22:11
@maliberty

Copy link
Copy Markdown
Member

@codex review

Comment on lines +980 to +981
++hist_gen_;
if (hist_gen_ == 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How will it be zero after you just incremented it?

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7e6414663

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


// legalize() can run again on this same object, and grid_w_/grid_h_ may be
// different next time.
hist_seen_stamp_.assign(static_cast<size_t>(grid_w_) * grid_h_, 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required DCO sign-off

This commit has no Signed-off-by: trailer (git interpret-trailers --parse returns no trailers), despite its message claiming DCO compliance. Add the author sign-off so the commit satisfies the repository's mandatory DCO requirement and can pass the corresponding merge check.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants