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

Try removing volatile from AtomicDataElement #5455

Merged

Conversation

masterleinad
Copy link
Contributor

@masterleinad masterleinad commented Sep 13, 2022

In the last hackathon I was mentoring, my team wanted to use MemorytTraits:::Atomic with a custom type. This currently requires defining all kinds of volatile qualified member functions which is not very user-friendly.

It appears that none of the volatile overloads in AtomicDataElement are used anymore, though, and there doesn't seem to be a point in combing volatile with atomic.
Also, Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars is not used at all.

@PhilMiller PhilMiller self-requested a review September 13, 2022 04:58
Comment on lines +225 to +226
operator value_type() const {
return Kokkos::Impl::atomic_load(ptr, Kokkos::Impl::memory_order_relaxed);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and operator= might be the only significant changes.

@crtrott
Copy link
Member

crtrott commented Sep 26, 2022

Is that UniqueToken failure in OpenMPTarget a thing which occasionally goes wrong because of a pre-existing bug, or is there something real there changing due to this PR?

@masterleinad
Copy link
Contributor Author

Is that UniqueToken failure in OpenMPTarget a thing which occasionally goes wrong because of a pre-existing bug, or is there something real there changing due to this PR?

We have seen that failing before. That test doesn't even use Kokkos::MemoryTraits<Kokkos::Atomic> AFAICT.

@crtrott
Copy link
Member

crtrott commented Sep 26, 2022

I think this is good.

@masterleinad masterleinad marked this pull request as ready for review September 26, 2022 18:37
Copy link
Contributor

@PhilMiller PhilMiller left a comment

Choose a reason for hiding this comment

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

I'm happy with the code change.

It would be useful to get some statistics on the failing test, to see how often it failed randomly before this change, and whether that's increased with it

@dalg24
Copy link
Member

dalg24 commented Sep 26, 2022

Ignoring the OpenMPTarget failure

@dalg24 dalg24 merged commit 05cef20 into kokkos:develop Sep 26, 2022
@masterleinad masterleinad mentioned this pull request Sep 27, 2022
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

Successfully merging this pull request may close these issues.

None yet

4 participants