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

Audit code for "false sharing" anti-patterns #730

Open
mcalancea opened this issue Dec 10, 2024 · 1 comment
Open

Audit code for "false sharing" anti-patterns #730

mcalancea opened this issue Dec 10, 2024 · 1 comment

Comments

@mcalancea
Copy link
Collaborator

mcalancea commented Dec 10, 2024

False sharing came up during conversation on #624. There is no confirmed instance of it happening yet (just one strong hunch 😄), but examining the code-base from this perspective may be advisable.

@hero78119
Copy link
Collaborator

hero78119 commented Dec 12, 2024

I just add 2 incremental commits on top of master branch, aiming to narrow down the issue

avoid in-place change

with commit 50f1213

  • same way of parallel traverse
  • avoid in-place vector change

And here before/after this change on fibonacci 2^20

fibonacci_max_steps_1048576/prove_fibonacci/fibonacci_max_steps_1048576
                        time:   [4.7952 s 4.8269 s 4.8525 s]
                        change: [-2.7392% -0.9628% +0.7617%] (p = 0.33 > 0.05)
                        No change in performance detected.

benchmark result shows identical, which imply false sharing is not the root cause for performance degrade

change parallel traverse

on top of prev commit, add new commit 269c9fa

  • move traverse parallism to higher level

And here before/after this change on fibonacci 2^20

fibonacci_max_steps_1048576/prove_fibonacci/fibonacci_max_steps_1048576
                        time:   [4.1463 s 4.1676 s 4.1861 s]
                        change: [-15.930% -14.492% -13.011%] (p = 0.00 < 0.05)
                        Performance has improved.

Both experiment indicate false sharing probably not being the root cause, whereas the way of traverse is.

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

No branches or pull requests

2 participants