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

drt: Flip map keys in graph init #6161

Merged

Conversation

kbieganski
Copy link
Contributor

Also use Boost's flat_map instead of std::map.

aes - asap7 - 5_2_route - 8 thread(s)

Branch Min [s] Max [s] Mean [s] Median [s] Relative
baseline 400.68 400.80 400.74 ± 0.04 400.73 1.05
drt-graph-init-flip-keys 379.85 380.59 380.27 ± 0.26 380.37 1.00

ibex - asap7 - 5_2_route - 8 thread(s)

Branch Min [s] Max [s] Mean [s] Median [s] Relative
baseline 570.60 570.74 570.67 ± 0.05 570.66 1.06
drt-graph-init-flip-keys 538.44 538.73 538.57 ± 0.11 538.54 1.00

ibex - nangate45 - 5_2_route - 8 thread(s)

Branch Min [s] Max [s] Mean [s] Median [s] Relative
baseline 168.32 168.69 168.53 ± 0.16 168.59 1.02
drt-graph-init-flip-keys 165.32 165.73 165.53 ± 0.17 165.54 1.00

black_parrot - nangate45 - 5_2_route - 8 thread(s)

Branch Min [s] Max [s] Mean [s] Median [s] Relative
baseline 1878.71 1880.53 1879.36 ± 0.83 1878.84 1.03
drt-graph-init-flip-keys 1824.96 1827.76 1826.00 ± 1.25 1825.29 1.00

I observed up to 10% speedup on some designs that I cannot share. I believe this scales nicely for bigger designs.

Copy link
Contributor

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

@QuantamHD
Copy link
Collaborator

@kbieganski you might want to push something to restart the CI it looks like the C++20 action might have had a problem unrelated to this PR

@kbieganski kbieganski force-pushed the drt-graph-init-flip-keys branch from e685c4f to 96295ad Compare November 18, 2024 20:34
Copy link
Contributor

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

@maliberty
Copy link
Member

What motived flipping the keys? Since we only have data for flipping + flat_map it is hard to see what benefit was had from each.

@kbieganski
Copy link
Contributor Author

flat_map by itself only gives 1-2%. The gain from flipping is mostly having a few big arrays instead of lots of small ones.

@kbieganski kbieganski force-pushed the drt-graph-init-flip-keys branch 2 times, most recently from a38fb86 to b5aa75d Compare November 25, 2024 15:31
Copy link
Contributor

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

@maliberty
Copy link
Member

Please merge master into this PR. I suspect that will solve the pr-head issue.

@kbieganski kbieganski force-pushed the drt-graph-init-flip-keys branch from b5aa75d to ef1c920 Compare November 27, 2024 11:49
Copy link
Contributor

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

src/drt/src/dr/FlexDR_init.cpp Outdated Show resolved Hide resolved
src/drt/src/dr/FlexDR_init.cpp Outdated Show resolved Hide resolved
src/drt/src/dr/FlexDR_init.cpp Outdated Show resolved Hide resolved
src/drt/src/dr/FlexGridGraph.cpp Show resolved Hide resolved
@kbieganski kbieganski force-pushed the drt-graph-init-flip-keys branch from ef1c920 to 1aaeafd Compare December 4, 2024 14:28
Copy link
Contributor

github-actions bot commented Dec 4, 2024

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

@kbieganski kbieganski force-pushed the drt-graph-init-flip-keys branch from 1aaeafd to 6dbb628 Compare December 4, 2024 16:59
Copy link
Contributor

github-actions bot commented Dec 4, 2024

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

// add edge for preferred direction
if (dir == dbTechLayerDir::HORIZONTAL && yFound) {
auto& yLayerMap = yMap[layerNum];
auto& yLayer2Map = yMap[layerNum + 2];
Copy link
Member

Choose a reason for hiding this comment

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

What if layerNum is the top routing layer? Wouldn't that insert layerNum+2 as a new entry to the flatmap and possible reallocate memory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but it's cheap:

  • it only happens once at most,
  • it may not reallocate,
  • even if it does, it's on the order of 10 elements,
  • and all the inner maps are just moved so they themselves don't reallocate.

In the original code this can happen for each coordinate.

@kbieganski
Copy link
Contributor Author

@osamahammad21 Any further feedback?

@osamahammad21 osamahammad21 merged commit 175da76 into The-OpenROAD-Project:master Jan 4, 2025
11 checks passed
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.

4 participants