Skip to content

Commit

Permalink
[UR] call urGetAdapter before creating a device from native handle
Browse files Browse the repository at this point in the history
This solves the same issues as intel#12432, but for urDeviceCreateWithNativeHandle.

Includes required oneapi-src/unified-runtime#1252
  • Loading branch information
pbalcer authored and nrspruit committed Feb 6, 2024
1 parent a7f3a63 commit 3bfe083
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
17 changes: 8 additions & 9 deletions sycl/plugins/unified_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ endif()
if(SYCL_PI_UR_USE_FETCH_CONTENT)
include(FetchContent)

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
# commit c0b1f13d94966090a1bb982b3bd747b30b9ef9d3
# Merge: 475ce8b4 cf806c37
# Author: aarongreig <aaron.greig@codeplay.com>
# Date: Mon Feb 5 13:41:50 2024 +0000
# Merge pull request #1240 from cppchedy/chedy/fix-bi-copy-image
#
# [Bindless][exp] 1D Image copy fix
set(UNIFIED_RUNTIME_TAG c0b1f13d94966090a1bb982b3bd747b30b9ef9d3)
set(UNIFIED_RUNTIME_REPO "https://github.com/pbalcer/unified-runtime.git")
# commit d216eb44d5c9fe3433eecdd09b10e3e79ac25bd7
# Merge: 40517d2b fc1f3066
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
# Date: Wed Jan 31 10:38:07 2024 +0000
# Merge pull request #1226 from hdelan/get-native-mem-on-device2
# [UR] Add extra param to urMemGetNativeHandle
set(UNIFIED_RUNTIME_TAG c56b44e7efd084617df349dbf49ce14b00aa8c11)

if(SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO)
set(UNIFIED_RUNTIME_REPO "${SYCL_PI_UR_OVERRIDE_FETCH_CONTENT_REPO}")
Expand Down
6 changes: 6 additions & 0 deletions sycl/plugins/unified_runtime/pi2ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,12 @@ piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle,
PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);

ur_adapter_handle_t adapter = nullptr;
if (auto res = PiGetAdapter(adapter); res != PI_SUCCESS) {
return res;
}
(void)adapter;

ur_native_handle_t UrNativeDevice =
reinterpret_cast<ur_native_handle_t>(NativeHandle);
ur_platform_handle_t UrPlatform =
Expand Down

0 comments on commit 3bfe083

Please sign in to comment.