Skip to content

[draft][HIP][CUDA] Use new UR entry point to get native mem with device param #12199

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 5 commits into from

Conversation

hdelan
Copy link
Contributor

@hdelan hdelan commented Dec 18, 2023

Accessor interop broke with the multi device context for HIP (oneapi-src/unified-runtime#999). This fixes it.

Relates to oneapi-src/unified-runtime#1199

@hdelan hdelan requested review from a team as code owners December 18, 2023 16:06
@hdelan hdelan marked this pull request as draft December 19, 2023 10:11
Copy link
Contributor

github-actions bot commented Dec 19, 2023

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 413525a469afc7f1593465da2ae45652809b2e19 c0f7b19e816b446757213709d47369c7bd7dcb12 -- sycl/test-e2e/HostInteropTask/interop-task-hip.cpp sycl/include/sycl/detail/pi.h sycl/plugins/cuda/pi_cuda.cpp sycl/plugins/hip/pi_hip.cpp sycl/plugins/level_zero/pi_level_zero.cpp sycl/plugins/native_cpu/pi_native_cpu.cpp sycl/plugins/opencl/pi_opencl.cpp sycl/plugins/unified_runtime/pi2ur.hpp sycl/plugins/unified_runtime/pi_unified_runtime.cpp sycl/source/interop_handle.cpp sycl/unittests/helpers/PiMockPlugin.hpp
View the diff from clang-format here.
diff --git a/sycl/include/sycl/detail/pi.h b/sycl/include/sycl/detail/pi.h
index 36ea89025e..3ba25d4ff9 100644
--- a/sycl/include/sycl/detail/pi.h
+++ b/sycl/include/sycl/detail/pi.h
@@ -1407,9 +1407,8 @@ __SYCL_EXPORT pi_result piextMemGetNativeHandle(pi_mem mem,
 /// \param mem is the PI mem to get the native handle of.
 /// \param dev is the PI device that the native allocation will be resident on.
 /// \param nativeHandle is the native handle of mem.
-__SYCL_EXPORT pi_result
-piextMemGetNativeHandleExp(pi_mem mem, pi_device dev,
-                           pi_native_handle *nativeHandle);
+__SYCL_EXPORT pi_result piextMemGetNativeHandleExp(
+    pi_mem mem, pi_device dev, pi_native_handle *nativeHandle);
 
 /// Creates PI mem object from a native handle.
 /// NOTE: The created PI object takes ownership of the native handle.
diff --git a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp
index a807a46d46..c27dfe4dad 100644
--- a/sycl/plugins/unified_runtime/pi_unified_runtime.cpp
+++ b/sycl/plugins/unified_runtime/pi_unified_runtime.cpp
@@ -240,9 +240,8 @@ piextMemGetNativeHandle(pi_mem Mem, pi_native_handle *NativeHandle) {
   return pi2ur::piextMemGetNativeHandle(Mem, NativeHandle);
 }
 
-__SYCL_EXPORT pi_result
-piextMemGetNativeHandleExp(pi_mem Mem, pi_device Device,
-                           pi_native_handle *NativeHandle) {
+__SYCL_EXPORT pi_result piextMemGetNativeHandleExp(
+    pi_mem Mem, pi_device Device, pi_native_handle *NativeHandle) {
   return pi2ur::piextMemGetNativeHandleExp(Mem, Device, NativeHandle);
 }
 

@hdelan hdelan force-pushed the get-native-mem-with-device branch from 17cce48 to 63efaa8 Compare December 19, 2023 11:00
@hdelan
Copy link
Contributor Author

hdelan commented Dec 19, 2023

@steffenlarsen it seems that either the clang format fails or the "Code formatter" thing fails for sycl/include/sycl/detail/pi.h. They seem to have different configs. This is just a draft PR so not important but just wondering if you know anything about this

@steffenlarsen
Copy link
Contributor

@steffenlarsen it seems that either the clang format fails or the "Code formatter" thing fails for sycl/include/sycl/detail/pi.h. They seem to have different configs. This is just a draft PR so not important but just wondering if you know anything about this

That is curious! @aelovikov-intel - Do you know if the new formatter check comes from upstream?

@aelovikov-intel
Copy link
Contributor

@steffenlarsen it seems that either the clang format fails or the "Code formatter" thing fails for sycl/include/sycl/detail/pi.h. They seem to have different configs. This is just a draft PR so not important but just wondering if you know anything about this

That is curious! @aelovikov-intel - Do you know if the new formatter check comes from upstream?

That was intentional - #12085 / #12184, but not yet complete. I have #12240 in progress and we'll need to disable our old format check job.

@hdelan
Copy link
Contributor Author

hdelan commented Jan 3, 2024

Thanks for clarification @steffenlarsen @aelovikov-intel ! This is just a draft for the moment, but will mark as ready for review when I have thumbs up from UR people. Maybe by then the CI linting will be fixed

Copy link
Contributor

@maarquitos14 maarquitos14 left a comment

Choose a reason for hiding this comment

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

LGTM.

@hdelan hdelan closed this Jan 4, 2024
@hdelan hdelan reopened this Jan 4, 2024
@hdelan hdelan closed this Jan 4, 2024
ldrumm pushed a commit that referenced this pull request Feb 1, 2024
#12297)

We want to change the signature of `piMemGetNativeHandle` for reasons
explained here oneapi-src/unified-runtime#1199

Corresponding UR PR:
oneapi-src/unified-runtime#1226

A previous PR added a new entry point
#12199 but it was decided that it is
better to modify the existing entry point
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.

4 participants