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

Allow using the SYCL execution space on AMD GPUs #6321

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

G-071
Copy link
Contributor

@G-071 G-071 commented Jul 30, 2023

This pull request adds the changes necessary to run the Kokkos SYCL execution space on AMD GPUs (if Kokkos_ENABLE_UNSUPPORTED_ARCH=ON).

Of course, I realize that this is not the intended execution space for AMD GPUs (hence I made sure it cannot be used without Kokkos_ENABLE_UNSUPPORTED_ARCH).  However, I needed these changes as I adapted the toolchain of our own simulation (which uses Kokkos) for SYCL and dpcpp but lacked access to an Intel GPU as yet - hence, I wanted to test it on an AMD MI100.

The changes required to do this with Kokkos are quite minimal; one simply has to make sure the correct AMD architecture flags are passed to dpcpp (as outlined here). Note that the logic to similarly run the SYCL execution space on NVIDIA devices already existed in cmake/kokkos_arch.cmake, I merely adapted it to also work for AMD GPUs.

I tested it (using our simulation Octo-Tiger) with dpcpp/2023-03 on a MI100 and everything seems to work fine! I figured it might be useful to other people as well, even if just for testing/benchmark purposes, hence this PR!

Intended for testing purposes only and hence requires the
UNSUPPORTED_ARCH flag to be set (prefer the HIP execution
space for these GPUs).
@dalg24-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

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.

Looks reasonable to me. I personally wouldn't go so far for us to set CI up, maybe other than a nightly? In the end we are a bit resource constrained during PR testing.

@@ -573,7 +573,7 @@ FUNCTION(CHECK_CUDA_ARCH ARCH FLAG)
ENDIF()
SET(CUDA_ARCH_ALREADY_SPECIFIED ${ARCH} PARENT_SCOPE)
IF (NOT KOKKOS_ENABLE_CUDA AND NOT KOKKOS_ENABLE_OPENMPTARGET AND NOT KOKKOS_ENABLE_SYCL AND NOT KOKKOS_ENABLE_OPENACC)
MESSAGE(WARNING "Given CUDA arch ${ARCH}, but Kokkos_ENABLE_CUDA, Kokkos_ENABLE_OPENACC, and Kokkos_ENABLE_OPENMPTARGET are OFF. Option will be ignored.")
MESSAGE(WARNING "Given CUDA arch ${ARCH}, but Kokkos_ENABLE_CUDA, Kokkos_ENABLE_SYCL, Kokkos_ENABLE_OPENACC, and Kokkos_ENABLE_OPENMPTARGET are OFF. Option will be ignored.")
Copy link
Member

Choose a reason for hiding this comment

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

I think we left this off here intentionally since its unsupported.

Copy link
Member

Choose a reason for hiding this comment

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

@masterleinad thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

On the other hand we print them above, so I guess could go either way.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to print SYCL in the warning as well.

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me (but we won't maintain support or promise SYCL to work on AMD GPUs).

@masterleinad
Copy link
Contributor

OK to test.

@G-071
Copy link
Contributor Author

G-071 commented Jul 31, 2023

Thanks for the feedback!

One more thing: I noticed that one of the tests failed due to some trailing whitespaces I missed in cmake/kokkos_arch.cmake. I have fixed that in the last commit just now!

@crtrott crtrott merged commit b57fb73 into kokkos:develop Jul 31, 2023
27 of 28 checks passed
@masterleinad masterleinad mentioned this pull request Sep 14, 2023
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