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

OpenMPTarget: UniqueToken::Global implementation. #3823

Merged
merged 6 commits into from
Mar 5, 2021

Conversation

rgayatri23
Copy link
Contributor

The PR contains the following updates:

  1. Implementation for UniqueToken::Global scope
  2. Uncomment the UniqeToken unit tests
  3. Comment the UniqueToken::Instance and AcquireUniqueToken tests. These features are not yet implemented.
  4. Add a new m_uniquetoken_ptr to OpenMPTargetExec class.

@dalg24
Copy link
Member

dalg24 commented Mar 4, 2021

fatal error: 'OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp' file not found
You forgot to commit that header

Copy link
Member

@crtrott crtrott left a comment

Choose a reason for hiding this comment

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

I am not approving since I co-wrote this. Generally I am good with this implementation: note the instance test should work, its just the team level thing which doesn't. The failing test is the SYCL build which failes while compiling the LLVM??

@@ -166,8 +166,11 @@ TEST(TEST_CATEGORY, unique_token_global) {
}

TEST(TEST_CATEGORY, unique_token_instance) {
// FIXME_OPENMPTARGET - Not yet implemented.
#if !defined(KOKKOS_ENABLE_OPENMPTARGET)
Copy link
Member

Choose a reason for hiding this comment

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

I thought this works? Its just the acquire_team_unique_token which fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes right, enabled it back.

@rgayatri23
Copy link
Contributor Author

I am not approving since I co-wrote this. Generally I am good with this implementation: note the instance test should work, its just the team level thing which doesn't. The failing test is the SYCL build which failes while compiling the LLVM??

I have encountered this earlier. Restarting the test resolved the issue.

core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp Outdated Show resolved Hide resolved
core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp Outdated Show resolved Hide resolved
core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp Outdated Show resolved Hide resolved
core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp Outdated Show resolved Hide resolved
core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp Outdated Show resolved Hide resolved
UniqueToken& operator=(UniqueToken&&) = default;

/// \brief upper bound for acquired values, i.e. 0 <= value < size()
KOKKOS_INLINE_FUNCTION
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
KOKKOS_INLINE_FUNCTION
KOKKOS_FUNCTION

same comment below

core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp Outdated Show resolved Hide resolved
Comment on lines +63 to +64
uint32_t volatile* m_buffer;
uint32_t m_count;
Copy link
Member

Choose a reason for hiding this comment

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

@crtrott would you remind me why we need these? why can't we directly use m_buffer_view.data() and m_buffer_view.size()? Does it have to do with the volatile-qualifier?

Copy link
Member

Choose a reason for hiding this comment

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

the global unique token was implemented that way from the beginning, and yes it is because of the volatile. I think the OpenMPTarget specialization doesn't necessarily need that, and we could just use a view here. Same for CUDA and the HIP. Maybe we should do this as a separate PR and change them uniformely.

Copy link
Member

Choose a reason for hiding this comment

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

(the OpenMP / Pthread ones need the volatile)

@crtrott crtrott merged commit 682db76 into kokkos:develop Mar 5, 2021
masterleinad pushed a commit to masterleinad/kokkos that referenced this pull request Mar 11, 2021
* OpenMPTarget: UniqueToken::Global implementation.

* OpenMPTarget: Adding the UniqueToken.hpp file.

* OpenMPTarget: Enable UniqueTokenScope::Instance unit test.

* OpenMPTarget: Protecting memcpy in Kokkos_OpenMPTarget_Instance.cpp with `OMPT_SAFE_CALL` macro.

* OpenMPTarget: Replace array with std::vector.

* OpenMPTarget: Prefix `Kokkos` to UniqueToken buffer view label.

Co-authored-by: rgayatri <rgayatri@lbl.gov>
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

3 participants