Skip to content

rsz: Support nested journals' move result tracking#10431

Open
erendn wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
erendn:resizer_nested_journal_fix
Open

rsz: Support nested journals' move result tracking#10431
erendn wants to merge 7 commits into
The-OpenROAD-Project:masterfrom
erendn:resizer_nested_journal_fix

Conversation

@erendn
Copy link
Copy Markdown
Contributor

@erendn erendn commented May 14, 2026

Summary

MoveCommitter doesn't exactly use nested journaling and can leave footprints of unrolled changes behind (hasMoves() sees moves on instances that were reverted). This PR doesn't fix it yet since it will change the resizer behavior but I will fix it during the refactor. After this PR is merged, that fix is just a one-liner.

Type of Change

  • Bug fix

Impact

It doesn't change the behavior just yet.

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).

erendn added 3 commits May 14, 2026 10:31
Signed-off-by: Eren Dogan <erendogan@google.com>
Signed-off-by: Eren Dogan <erendogan@google.com>
Signed-off-by: Eren Dogan <erendogan@google.com>
@erendn erendn requested a review from a team as a code owner May 14, 2026 19:33
@erendn erendn requested a review from jhkim-pii May 14, 2026 19:33
Copy link
Copy Markdown
Contributor

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

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 implements nested journaling support in the MoveCommitter by replacing the single journal flag with a stack-based tracking system for move results. This change allows for hierarchical commit and restore operations, aligning with the underlying database's ECO journal behavior. The feedback identifies a critical safety issue in the unrecording of move results where a multiset iterator must be validated before erasure to prevent potential crashes. Additionally, the reviewer pointed out that the new internal logic in the journaling methods makes several manual calls to accept or reject pending moves in SetupLegacyBase.cc redundant.

Comment on lines +395 to +396
pending_instances_by_type_[index].erase(
pending_instances_by_type_[index].find(inst));
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.

high

The result of find(inst) must be checked against end() before being passed to erase(). Passing end() to erase() is undefined behavior and will likely cause a crash if the instance is not found in the multiset for any reason.

    auto it = pending_instances_by_type_[index].find(inst);
    if (it != pending_instances_by_type_[index].end()) {
      pending_instances_by_type_[index].erase(it);
    }

Comment thread src/rsz/src/policy/SetupLegacyBase.cc
Comment thread src/rsz/src/policy/SetupLegacyBase.cc
Copy link
Copy Markdown
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

Comment thread src/rsz/src/MoveCommitter.cc
Signed-off-by: Eren Dogan <erendogan@google.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

@jhkim-pii
Copy link
Copy Markdown
Contributor

@codex review

@jhkim-pii
Copy link
Copy Markdown
Contributor

@erendn Could you please add a regression to capture the behavior?

Copy link
Copy Markdown

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

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: a0e5e8de7d

ℹ️ 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".

Comment thread src/rsz/src/MoveCommitter.hh Outdated
Comment on lines +573 to +576
if (pending_move_results_.empty()) {
// Outermost restore: the tracker's pending entries are no longer
// load-bearing. Flush them and emit the totals snapshot.
rejectTrackedMoves();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject nested journal tracker events on restore

During nested restores, this code only calls rejectTrackedMoves() when unwinding the outermost journal, so inner-branch tracker events remain in MoveTracker pending state even after their ECOs are undone. Those stale events are later finalized by the outer journal and get reported as if they belonged to the surviving branch, which corrupts move-tracker commit/reject reporting whenever nested journals are used.

Useful? React with 👍 / 👎.

erendn added 2 commits May 14, 2026 19:14
Signed-off-by: Eren Dogan <erendogan@google.com>
Signed-off-by: Eren Dogan <erendogan@google.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

Signed-off-by: Eren Dogan <erendogan@google.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

@erendn
Copy link
Copy Markdown
Contributor Author

erendn commented May 15, 2026

I added a gtest to capture the behavior. It catches the current behavior, which is incorrect, but I left warnings to myself that when I actually fix it in refactor, the unit tests will make sure it behaves correctly.

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