DPL: Remove the use of unordered_set in searchNearestSite#8248
Open
calewis wants to merge 5 commits intoThe-OpenROAD-Project:masterfrom
Open
DPL: Remove the use of unordered_set in searchNearestSite#8248calewis wants to merge 5 commits intoThe-OpenROAD-Project:masterfrom
calewis wants to merge 5 commits intoThe-OpenROAD-Project:masterfrom
Conversation
By carefully picking which direction nodes can expand we can avoid needing to keep track of already visited nodes. This avoids the overhead of keeping track of where we've already visited. Signed-off-by: Drew Lewis <cannada@google.com>
Signed-off-by: Drew Lewis <cannada@google.com>
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
maliberty
approved these changes
Sep 5, 2025
Member
|
test failures need addressing |
Signed-off-by: Drew Lewis <cannada@google.com>
This reverts commit 54ddbc6.
auto-merge was automatically disabled
September 8, 2025 22:50
Head branch was pushed to by a user without write access
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Signed-off-by: Drew Lewis <cannada@google.com>
15fa584 to
0ff4613
Compare
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Member
|
I thought the goal here is to do the same search as would have done previously with better efficiency. From the test failures it is apparent that we are not. Is it possible to make this equivalent and avoid the need to do a big validation cycle? |
Member
|
(Also DCO needs fixing) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By carefully picking which direction nodes can expand we can avoid needing to keep track of already visited nodes. This avoids the overhead of keeping track of where we've already visited.
Also a minor optimization of not adding the center to the PQ, if the center is a match we can exit early and avoid PQ construction.
The expansion strategy goes as follows:
The center naturally expands in all 4 directions.
Nodes in the same column as the center expand in 3 directions
Assume we are on the y-axis above the center, then we know the only way we could have reached this point is from below so we don't need to add our neighbor below us to the queue, opposite goes for the y-axis nodes below the center, they don't need to add the node directly above them.
Finally we get to off center off y-axis nodes, expanding only to the left or right.
Because we are expanding on a structured grid instead of an arbitrary graph we can avoid keeping track of visited nodes saving us the overhead of using the
unordered_set.