Skip to content

Add atomic fetch-and-op and compare-exchange functions #4552

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

Merged
merged 5 commits into from
Dec 1, 2017

Conversation

hjelmn
Copy link
Member

@hjelmn hjelmn commented Nov 30, 2017

This PR contains the following updates to atomics in opal:

  • Remove opal_atomic_cmpset_* operations.

  • Add new compare-exchange functions with signature that matches C11. These functions still return a boolean but take a pointer to the compare value. The old value is stored over the compare value.

  • Add atomic fetch-and-op functions. These replace the old op-and-fetch functions in the underlying atomic implementations. The old atomic arithmetic operations have been renamed from opal_atomic_op_* to opal_atomic_op_fetch_*.

This commit adds a new set of compare-and-exchange functions. These
functions have a signature similar to the functions found in C11. The
old cmpset functions are now deprecated and defined in terms of the
new compare-and-exchange functions. All asm backends have been
updated.

Signed-off-by: Nathan Hjelm <[email protected]>
This commit eliminates the old opal_atomic_bool_cmpset functions. They
have been replaced by the opal_atomic_compare_exchange_strong
functions.

Signed-off-by: Nathan Hjelm <[email protected]>
This commit renames the arithmetic atomic operations in opal to
indicate that they return the new value not the old value. This naming
differentiates these routines from new functions that return the old
value.

Signed-off-by: Nathan Hjelm <[email protected]>
This commit adds support for fetch-and-op atomics. This is needed
because and and or are irreversible operations so there needs to be a
way to get the old value atomically. These are also the only semantics
supported by C11 (there is not atomic_op_fetch, just
atomic_fetch_op). The old op-and-fetch atomics have been defined in
terms of fetch-and-op.

Signed-off-by: Nathan Hjelm <[email protected]>
@hjelmn
Copy link
Member Author

hjelmn commented Nov 30, 2017

:bot:retest:ompi

Copy link
Member

@bosilca bosilca left a comment

Choose a reason for hiding this comment

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

This is a gigantic patch. I did my best to review it entirely, but I can hardly guarantee that I did not miss anything critical. Most of the Jenkins validations returned successfully so we are good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants