-
Notifications
You must be signed in to change notification settings - Fork 412
[FGParallelRouter] Updated Barrier to C++20 Std Barrier #3052
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
base: master
Are you sure you want to change the base?
[FGParallelRouter] Updated Barrier to C++20 Std Barrier #3052
Conversation
The fine-grained parallel router was originally built before VTR upgraded to C++20, so we had to roll our own barrier. We originally had two barriers: spin barriers (thread spin on a lock while waiting) and a "mutex" barrer (where threads wait on a condition variable and potentially went to sleep). Through experimentation, found that the choice of barrier implementation did not matter; however, the standard barrier provides slight performance improvements for very long routes and has a much cleaner interface. Moved the FG parallel router to the standard barrier. The old implementations are left in as classes in case c++20 is not preferred for some users. Also added a QoR script to make parsing FG parallel router runs easier.
Results on the 8 largest VTR circuits using A* algorithm on 4 threads:
Raw numbers:
The important thing to notice is that the standard barrier implementation appear to do better on the circuits that spend more time routing, which is the case we care about. After seeing these results, I chose to make the STD barrier implementation the default. Raw data: https://docs.google.com/spreadsheets/d/1L5j7zt9wY5EJo7qJHvWhd7r4rnrgiCfiTb9MM0ADeFc/edit?usp=sharing |
@vaughnbetz FYI |
@ueqri This PR includes the changes I proposed a few months ago to move us from spin barriers to "mutex" barriers. Since we upgraded to C++20, I also tested the standard barrier and found that it out-performed both of our implementations on larger routing problems (while also being much cleaner). This PR changes the barrier implementation to use the standard barrier. Please review when you have a moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I suggest also comparing its runtime to the spin barrier on Titan so we can see if there's a difference there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look perfect! Thank you for updating this, Alex!
The fine-grained parallel router was originally built before VTR upgraded to C++20, so we had to roll our own barrier. We originally had two barriers: spin barriers (thread spin on a lock while waiting) and a "mutex" barrer (where threads wait on a condition variable and potentially went to sleep).
Through experimentation, found that the choice of barrier implementation did not matter; however, the standard barrier provides slight performance improvements for very long routes and has a much cleaner interface.
Moved the FG parallel router to the standard barrier. The old implementations are left in as classes in case c++20 is not preferred for some users.
Also added a QoR script to make parsing FG parallel router runs easier.