Skip to content

opal/asm: add opal_atomic_compare_exchange_strong functions #4475

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
wants to merge 3 commits into from

Conversation

hjelmn
Copy link
Member

@hjelmn hjelmn commented Nov 8, 2017

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]

@hjelmn hjelmn requested a review from bosilca November 8, 2017 17:26
@hjelmn
Copy link
Member Author

hjelmn commented Nov 8, 2017

Tested on x86_64. PowerPC has been lightly tested but will be tested by CI.

@ibm-ompi
Copy link

ibm-ompi commented Nov 8, 2017

The IBM CI (GNU Compiler) build failed! Please review the log, linked below.

Gist: https://gist.github.com/14cad17efe7a777fb653261e36da9ee3

@bosilca
Copy link
Member

bosilca commented Nov 8, 2017

Why do you keep the deprecated opal_atomic_bool_cmpset_xx functions ?

@hjelmn
Copy link
Member Author

hjelmn commented Nov 8, 2017

@bosilca Continuity. I though we should deprecate (and warn-- I need to add the attribute) for 4.0 and remove for 5.0. Its internal so I don't know if that is necessary.

@bosilca
Copy link
Member

bosilca commented Nov 8, 2017

Indeed they are internal and in most cases inlined. So even for binary distributed modules there will be no portability issues.

+1 to just remove them.

@hjelmn
Copy link
Member Author

hjelmn commented Nov 8, 2017

Ok, I will do that now and update the PR.

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]>
@hjelmn
Copy link
Member Author

hjelmn commented Nov 29, 2017

@bosilca Removed the old cmpset functions. Should be good to go after CI finishes.

@hjelmn hjelmn force-pushed the asm_cleanup branch 3 times, most recently from 1bd9734 to 712186e Compare November 29, 2017 20:56
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@open-mpi open-mpi deleted a comment from ibm-ompi Nov 29, 2017
@ibm-ompi
Copy link

The IBM CI (GNU Compiler) build failed! Please review the log, linked below.

Gist: https://gist.github.com/0902da0b2ba74947e60c2dd2f61e1bd3

@ibm-ompi
Copy link

The IBM CI (XL Compiler) build failed! Please review the log, linked below.

Gist: https://gist.github.com/62cab238c29b3e0028568ffb493da39a

@ibm-ompi
Copy link

The IBM CI (PGI Compiler) build failed! Please review the log, linked below.

Gist: https://gist.github.com/5034a7ff503d6f68ea034ef44a36f8c7

@ibm-ompi
Copy link

The IBM CI (GNU Compiler) build failed! Please review the log, linked below.

Gist: https://gist.github.com/e28dfa582269fcdee8845d858400a995

@ibm-ompi
Copy link

The IBM CI (XL Compiler) build failed! Please review the log, linked below.

Gist: https://gist.github.com/55785a274afb5d9c8de1028fc89e7e40

@hjelmn
Copy link
Member Author

hjelmn commented Nov 29, 2017

@bosilca Ok, think I got all the issues worked out. This PR adds the new compare-exchange functions and removes the old cmpset ones.

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]>
{ \
type oldval, newval; \
do { \
oldval = *addr; \
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be outside the do loop ? (the oldval will be updated by the compare_exchange anyway).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes. I made that change in other places but missed this one. Will be irrelevant in the next PR though. I will be replacing the underlying op-and-fetch arithmetic atomics with fetch-and-op. This is already fixed in that branch. I will post that PR once this one is merged unless you would like me to include the fetch-and-op change in this PR.

@hjelmn
Copy link
Member Author

hjelmn commented Nov 30, 2017

@bosilca I am going to open a PR that has both the compare-exchange changes and the atomic arithmetic changes. We can either merge the one and the other one will only handle the arithmetic or close this one and use the other PR.

@hjelmn
Copy link
Member Author

hjelmn commented Nov 30, 2017

See #4552

@hjelmn
Copy link
Member Author

hjelmn commented Nov 30, 2017

I also added some tests to atomic_math.c to check each form (fetch-and-op and op-and-fetch) of the atomic operations.

@hjelmn
Copy link
Member Author

hjelmn commented Dec 3, 2017

On master already. Closing.

@hjelmn hjelmn closed this Dec 3, 2017
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.

4 participants