@@ -19,6 +19,24 @@ namespace sycl {
19
19
inline namespace _V1 {
20
20
namespace detail {
21
21
22
+ // / Constructs a SYCL device instance using the provided
23
+ // / UR device instance.
24
+ device_impl::device_impl (ur_device_handle_t Device, platform_impl &Platform,
25
+ device_impl::private_tag, bool IsSubDevice)
26
+ : MDevice(Device), MPlatform(Platform),
27
+ // No need to set MRootDevice when MAlwaysRootDevice is true
28
+ MRootDevice (Platform.MAlwaysRootDevice
29
+ ? nullptr
30
+ : get_info_impl<UR_DEVICE_INFO_PARENT_DEVICE>()),
31
+ // TODO catch an exception and put it to list of asynchronous exceptions:
32
+ MCache{*this } {
33
+ if (!IsSubDevice) {
34
+ // Interoperability Constructor already calls DeviceRetain in
35
+ // urDeviceCreateWithNativeHandle.
36
+ getAdapter ().call <UrApiKind::urDeviceRetain>(MDevice);
37
+ }
38
+ }
39
+
22
40
// / Constructs a SYCL device instance using the provided
23
41
// / UR device instance.
24
42
device_impl::device_impl (ur_device_handle_t Device, platform_impl &Platform,
@@ -30,9 +48,7 @@ device_impl::device_impl(ur_device_handle_t Device, platform_impl &Platform,
30
48
: get_info_impl<UR_DEVICE_INFO_PARENT_DEVICE>()),
31
49
// TODO catch an exception and put it to list of asynchronous exceptions:
32
50
MCache{*this } {
33
- // Interoperability Constructor already calls DeviceRetain in
34
- // urDeviceCreateWithNativeHandle.
35
- getAdapter ().call <UrApiKind::urDeviceRetain>(MDevice);
51
+ device_impl (Device, Platform, private_tag{}, false );
36
52
}
37
53
38
54
device_impl::~device_impl () {
@@ -164,7 +180,7 @@ std::vector<device> device_impl::create_sub_devices(
164
180
std::for_each (SubDevices.begin (), SubDevices.end (),
165
181
[&res, this ](const ur_device_handle_t &a_ur_device) {
166
182
device sycl_device = detail::createSyclObjFromImpl<device>(
167
- MPlatform.getOrMakeDeviceImpl (a_ur_device));
183
+ MPlatform.getOrMakeSubDeviceImpl (a_ur_device));
168
184
res.push_back (sycl_device);
169
185
});
170
186
return res;
0 commit comments