@@ -19,59 +19,29 @@ namespace sycl {
19
19
inline namespace _V1 {
20
20
namespace detail {
21
21
22
- device_impl::device_impl (ur_native_handle_t InteropDeviceHandle,
23
- const AdapterPtr &Adapter)
24
- : device_impl(InteropDeviceHandle, nullptr , nullptr , Adapter) {}
25
-
26
22
// / Constructs a SYCL device instance using the provided
27
23
// / UR device instance.
28
24
device_impl::device_impl (ur_device_handle_t Device, PlatformImplPtr Platform)
29
- : device_impl(0 , Device, Platform, Platform->getAdapter ()) {}
30
-
31
- // / Constructs a SYCL device instance using the provided
32
- // / UR device instance.
33
- device_impl::device_impl (ur_device_handle_t Device, const AdapterPtr &Adapter)
34
- : device_impl(0 , Device, nullptr , Adapter) {}
35
-
36
- device_impl::device_impl (ur_native_handle_t InteropDeviceHandle,
37
- ur_device_handle_t Device, PlatformImplPtr Platform,
38
- const AdapterPtr &Adapter)
39
- : MDevice(Device), MDeviceHostBaseTime(std::make_pair(0 , 0 )) {
40
- bool InteroperabilityConstructor = false ;
41
- if (Device == nullptr ) {
42
- assert (InteropDeviceHandle);
43
- // Get UR device from the raw device handle.
44
- // NOTE: this is for OpenCL interop only (and should go away).
45
- // With SYCL-2020 BE generalization "make" functions are used instead.
46
- Adapter->call <UrApiKind::urDeviceCreateWithNativeHandle>(
47
- InteropDeviceHandle, Adapter->getUrAdapter (), nullptr , &MDevice);
48
- InteroperabilityConstructor = true ;
49
- }
25
+ : MDevice(Device), MPlatform(Platform),
26
+ MDeviceHostBaseTime (std::make_pair(0 , 0 )) {
27
+ const AdapterPtr &Adapter = Platform->getAdapter ();
50
28
51
29
// TODO catch an exception and put it to list of asynchronous exceptions
52
30
Adapter->call <UrApiKind::urDeviceGetInfo>(
53
31
MDevice, UR_DEVICE_INFO_TYPE, sizeof (ur_device_type_t ), &MType, nullptr );
54
32
55
33
// No need to set MRootDevice when MAlwaysRootDevice is true
56
- if ((Platform == nullptr ) || !Platform->MAlwaysRootDevice ) {
34
+ if (!Platform->MAlwaysRootDevice ) {
57
35
// TODO catch an exception and put it to list of asynchronous exceptions
58
36
Adapter->call <UrApiKind::urDeviceGetInfo>(
59
37
MDevice, UR_DEVICE_INFO_PARENT_DEVICE, sizeof (ur_device_handle_t ),
60
38
&MRootDevice, nullptr );
61
39
}
62
40
63
- if (!InteroperabilityConstructor) {
64
- // TODO catch an exception and put it to list of asynchronous exceptions
65
- // Interoperability Constructor already calls DeviceRetain in
66
- // urDeviceCreateWithNativeHandle.
67
- Adapter->call <UrApiKind::urDeviceRetain>(MDevice);
68
- }
69
-
70
- // set MPlatform
71
- if (!Platform) {
72
- Platform = platform_impl::getPlatformFromUrDevice (MDevice, Adapter);
73
- }
74
- MPlatform = Platform;
41
+ // TODO catch an exception and put it to list of asynchronous exceptions
42
+ // Interoperability Constructor already calls DeviceRetain in
43
+ // urDeviceCreateWithNativeHandle.
44
+ Adapter->call <UrApiKind::urDeviceRetain>(MDevice);
75
45
76
46
Adapter->call <UrApiKind::urDeviceGetInfo>(
77
47
MDevice, UR_DEVICE_INFO_USE_NATIVE_ASSERT, sizeof (ur_bool_t ),
0 commit comments