Skip to content

drt/odb: fix non-determinism on pin access#10085

Merged
eder-matheus merged 5 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:drt_odb_stable
Apr 11, 2026
Merged

drt/odb: fix non-determinism on pin access#10085
eder-matheus merged 5 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:drt_odb_stable

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

@openroad-ci openroad-ci commented Apr 8, 2026

Summary

Three fixes for ODB serialization non-determinism: (1) setAccessPoint now inserts into AP's iterms_ in sorted order via lower_bound for deterministic serialization, (2) clearPrefAccessPoints removes stale iterm back-references from access points before clearing, and (3) dirty_unique_classes in FlexPA::updateDirtyInsts uses key-based ordering instead of pointer-based to ensure deterministic pin_access_idx assignment across runs.

Type of Change

  • Bug fix

Impact

Ensure stable results when running incremental repairs, specifically incremental pin access.

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

Fixes #10023.

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Move the iterms_ sort from dbAccessPoint serialization to insertion
time in setAccessPoint, using lower_bound + insert instead of
push_back. This keeps the serialization code generator-safe (the
previous sort in operator<< was outside user code markers and would
be overwritten by the ODB code generator).

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
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 introduces deterministic ordering for unique classes in FlexPA and improves back-reference management in dbITerm by maintaining sorted iterm lists and cleaning up references during clearing. However, the setAccessPoint implementation is incomplete as it fails to remove old back-references when a pin is reassigned, which can lead to stale data and duplicate entries.

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

@eder-matheus eder-matheus requested a review from maliberty April 8, 2026 15:15
@eder-matheus
Copy link
Copy Markdown
Member

@maliberty Secure-CI is passing for these changes.

@maliberty maliberty requested a review from osamahammad21 April 8, 2026 22:33
@maliberty
Copy link
Copy Markdown
Member

@osamahammad21 please review and merge if ok

Comment on lines +803 to +805
auto& iterms = _ap->iterms_;
auto pos = std::lower_bound(iterms.begin(), iterms.end(), iterm->getOID());
iterms.insert(pos, iterm->getOID());
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.

Does this relate to non-determinism? I don’t see how preserving insertion order would introduce non-deterministic behavior.

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.

It doesn't impact the final result in terms of routing (wire and via location, wire count, etc) but it can impact the final ODB. In the issue, the main concern was different sha1 between the ODBs generated on different runs that must produce the same output. This change in dbITerm ensures that the ODB files will be consistent.

@eder-matheus
Copy link
Copy Markdown
Member

@osamahammad21 any other comments?

@eder-matheus eder-matheus enabled auto-merge April 11, 2026 00:05
@eder-matheus eder-matheus merged commit 3ab4b4a into The-OpenROAD-Project:master Apr 11, 2026
15 of 16 checks passed
@openroad-ci openroad-ci deleted the drt_odb_stable branch April 11, 2026 01:08
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.

Global route non-determinism in sky130hd/microwatt

4 participants