From bbf2abefc2ee56472ef366468d1da3fbed1966af Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Fri, 9 Aug 2024 10:45:48 +0100 Subject: [PATCH] [SYCL][UR] Pull in update that changes urDeviceCreateWithNativeHandle. The api now takes a ur_adapter_handle_t instead of a ur_platform_handle_t, which is easier for sycl RT to correctly provide and enables a fix for a few instances where we were illegally passing nullptr. --- sycl/cmake/modules/FetchUnifiedRuntime.cmake | 12 ++++++------ sycl/source/backend.cpp | 4 ++-- sycl/source/backend/level_zero.cpp | 2 +- sycl/source/detail/device_impl.cpp | 4 ++-- sycl/source/device.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index 6b6bfa4d8e65b..d6d226dc7df07 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -117,13 +117,13 @@ if(SYCL_UR_USE_FETCH_CONTENT) endfunction() set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") - # commit d8f1c98e48e98ea2f6a227af82366734fcde977e - # Merge: 6e8efa3d 9e824480 + # commit 0342c95cbe1dae72e874821698b3726dbe3db284 + # Merge: d7e0fad5 a4c6e912 # Author: Omar Ahmed - # Date: Wed Aug 14 11:46:59 2024 +0100 - # Merge pull request #1946 from callumfare/callum/update_ur_trace_env_var - # Update expected values of SYCL_UR_TRACE environment variable - set(UNIFIED_RUNTIME_TAG d8f1c98e48e98ea2f6a227af82366734fcde977e) + # Date: Thu Aug 15 17:50:02 2024 +0100 + # Merge pull request #1953 from aarongreig/aaron/changeDeviceCreateWithNativeParam + # Change urDeviceCreateWithNativeHandle to take an adapter handle. + set(UNIFIED_RUNTIME_TAG 0342c95cbe1dae72e874821698b3726dbe3db284) set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") # Due to the use of dependentloadflag and no installer for UMF and hwloc we need diff --git a/sycl/source/backend.cpp b/sycl/source/backend.cpp index 1fd90609276f4..2ce8c4c348c88 100644 --- a/sycl/source/backend.cpp +++ b/sycl/source/backend.cpp @@ -84,8 +84,8 @@ __SYCL_EXPORT device make_device(ur_native_handle_t NativeHandle, const auto &Plugin = getPlugin(Backend); ur_device_handle_t UrDevice = nullptr; - Plugin->call(urDeviceCreateWithNativeHandle, NativeHandle, nullptr, nullptr, - &UrDevice); + Plugin->call(urDeviceCreateWithNativeHandle, NativeHandle, + Plugin->getUrAdapter(), nullptr, &UrDevice); // Construct the SYCL device from UR device. return detail::createSyclObjFromImpl( std::make_shared(UrDevice, Plugin)); diff --git a/sycl/source/backend/level_zero.cpp b/sycl/source/backend/level_zero.cpp index 26f5b3eba0fd6..26218fed618e4 100644 --- a/sycl/source/backend/level_zero.cpp +++ b/sycl/source/backend/level_zero.cpp @@ -24,7 +24,7 @@ __SYCL_EXPORT device make_device(const platform &Platform, // Create UR device first. ur_device_handle_t UrDevice; Plugin->call(urDeviceCreateWithNativeHandle, NativeHandle, - PlatformImpl->getHandleRef(), nullptr, &UrDevice); + Plugin->getUrAdapter(), nullptr, &UrDevice); return detail::createSyclObjFromImpl( PlatformImpl->getOrMakeDeviceImpl(UrDevice, PlatformImpl)); diff --git a/sycl/source/detail/device_impl.cpp b/sycl/source/detail/device_impl.cpp index af846c559cfea..37a65e0e2a261 100644 --- a/sycl/source/detail/device_impl.cpp +++ b/sycl/source/detail/device_impl.cpp @@ -42,8 +42,8 @@ device_impl::device_impl(ur_native_handle_t InteropDeviceHandle, // Get UR device from the raw device handle. // NOTE: this is for OpenCL interop only (and should go away). // With SYCL-2020 BE generalization "make" functions are used instead. - Plugin->call(urDeviceCreateWithNativeHandle, InteropDeviceHandle, nullptr, - nullptr, &MDevice); + Plugin->call(urDeviceCreateWithNativeHandle, InteropDeviceHandle, + Plugin->getUrAdapter(), nullptr, &MDevice); InteroperabilityConstructor = true; } diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index 67b7b5096cc5e..ceac4e170d295 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -39,7 +39,7 @@ device::device(cl_device_id DeviceId) { ur_device_handle_t Device; Plugin->call(urDeviceCreateWithNativeHandle, detail::ur::cast(DeviceId), - Plugin->getUrPlatforms()[0], nullptr, &Device); + Plugin->getUrAdapter(), nullptr, &Device); auto Platform = detail::platform_impl::getPlatformFromUrDevice(Device, Plugin); impl = Platform->getOrMakeDeviceImpl(Device, Platform);