Skip to content

Audit atomics and use weakest ordering possible #6477

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

Closed
blt opened this issue Feb 17, 2021 · 0 comments · Fixed by #6480
Closed

Audit atomics and use weakest ordering possible #6477

blt opened this issue Feb 17, 2021 · 0 comments · Fixed by #6480
Assignees
Labels
domain: performance Anything related to Vector's performance type: task Generic non-code related tasks

Comments

@blt
Copy link
Contributor

blt commented Feb 17, 2021

As discussed in #6428 (comment) we should use compare_exchange_weak where possible. It's worth taking a passes through the code to find opportunities for weaker ordering.

@blt blt added type: task Generic non-code related tasks domain: performance Anything related to Vector's performance labels Feb 17, 2021
@blt blt self-assigned this Feb 17, 2021
@blt blt closed this as completed in #6480 Feb 19, 2021
blt added a commit that referenced this issue Feb 19, 2021
…6480)

* Adjust the strength of `gauge_add` atomics

This commit adjusts the strength of the `gauge_add` atomics used by
`OpenGauge`. Previous implementation called `emitter` potentially `n^2 / 2`
times, where `n` is the number of participants. Current implementation calls
`emitter` only once after the participant CPU manages to adjust `OpenGauge`
value, though no guarantee is made about the ordering of participant calls to
`emitter`. That is, this commit guarantees that thread `A` will sequence its call
to `emitter` after modification of the internal `gauge` but makes no guarantee
about sequence of thread `B`'s parallel call to its `emitter`, relative to `A`.

If the point of this code is to sequence calls to `emitter` between threads we
can close this out and I'll make a different PR to clarify in the
documentation.

Closes #6477

Signed-off-by: Brian L. Troutwine <[email protected]>

* Update documentation, introduce spin_loop hint

After clarification in review of the previous commit it was clear that this code
is intended to implement a spinloop with `emitter` in the critical
section. Update this code's documentation to reflect its nature as a spinloop,
possible future avenues for research if this loop plays hell with OS
schedulers.

Signed-off-by: Brian L. Troutwine <[email protected]>

* Correct spelling of 'gague' to 'gauge'

Signed-off-by: Brian L. Troutwine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: performance Anything related to Vector's performance type: task Generic non-code related tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant