The-OpenROAD-Project / OpenSTA

OpenSTA engine
GNU General Public License v3.0
404 stars 172 forks source link

Optimize use of std::shared_ptr. #207

Closed rmlarsen closed 9 months ago

rmlarsen commented 9 months ago

This change speeds up the OpenRoad Gate Resizer tool by 35% for a circuit we care about. Passing a std::shared_ptr by value (and subsequently destroying the copy) is not free because it requires an atomic update to the associated reference counter.

Bottom-up view before: image

Bottom-up view after: image

Flame graph before: image

Flame graph after: image

jjcherry56 commented 9 months ago

This is not the official OpenSTA repo, and is not even a fork of the official repo. per README.md OpenSTA does not solicit or accept external code contributions. I have already pushed a change that addresses this issue.

rmlarsen commented 9 months ago

@jjcherry56 that's fine. I'd appreciate credit for diagnosing the issue as it is a fairly significant performance bug.

maliberty commented 9 months ago

I have merged this in order to give you credit. I'll take care of any merge conflicts.

rmlarsen commented 9 months ago

@maliberty cool. Thanks! FWIW, I think @jjcherry56's solution is simpler and should probably take precedence. I wasn't sure if that was safe to do.