@@ -31,7 +31,7 @@ context_impl::context_impl(const device &Device, async_handler AsyncHandler,
31
31
const property_list &PropList)
32
32
: MOwnedByRuntime(true ), MAsyncHandler(AsyncHandler), MDevices(1 , Device),
33
33
MContext (nullptr ),
34
- MPlatform(detail::getSyclObjImpl(Device.get_platform())),
34
+ MPlatform(detail::getSyclObjImpl(Device.get_platform()).get() ),
35
35
MPropList(PropList), MSupportBufferLocationByDevices(NotChecked) {
36
36
verifyProps (PropList);
37
37
MKernelProgramCache.setContextPtr (this );
@@ -41,10 +41,10 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
41
41
async_handler AsyncHandler,
42
42
const property_list &PropList)
43
43
: MOwnedByRuntime(true ), MAsyncHandler(AsyncHandler), MDevices(Devices),
44
- MContext(nullptr ), MPlatform(), MPropList(PropList),
45
- MSupportBufferLocationByDevices(NotChecked) {
44
+ MContext(nullptr ),
45
+ MPlatform(detail::getSyclObjImpl(MDevices[0 ].get_platform()).get()),
46
+ MPropList(PropList), MSupportBufferLocationByDevices(NotChecked) {
46
47
verifyProps (PropList);
47
- MPlatform = detail::getSyclObjImpl (MDevices[0 ].get_platform ());
48
48
std::vector<ur_device_handle_t > DeviceIds;
49
49
for (const auto &D : MDevices) {
50
50
if (D.has (aspect::ext_oneapi_is_composite)) {
@@ -77,7 +77,7 @@ context_impl::context_impl(ur_context_handle_t UrContext,
77
77
MDevices(DeviceList), MContext(UrContext), MPlatform(),
78
78
MSupportBufferLocationByDevices(NotChecked) {
79
79
if (!MDevices.empty ()) {
80
- MPlatform = detail::getSyclObjImpl (MDevices[0 ].get_platform ());
80
+ MPlatform = detail::getSyclObjImpl (MDevices[0 ].get_platform ()). get () ;
81
81
} else {
82
82
std::vector<ur_device_handle_t > DeviceIds;
83
83
uint32_t DevicesNum = 0 ;
@@ -96,13 +96,13 @@ context_impl::context_impl(ur_context_handle_t UrContext,
96
96
make_error_code (errc::invalid),
97
97
" No devices in the provided device list and native context." );
98
98
99
- std::shared_ptr<detail:: platform_impl> Platform =
99
+ platform_impl & Platform =
100
100
platform_impl::getPlatformFromUrDevice (DeviceIds[0 ], Adapter);
101
101
for (ur_device_handle_t Dev : DeviceIds) {
102
- MDevices.emplace_back (createSyclObjFromImpl<device>(
103
- Platform-> getOrMakeDeviceImpl (Dev, Platform )));
102
+ MDevices.emplace_back (
103
+ createSyclObjFromImpl<device>(Platform. getOrMakeDeviceImpl (Dev)));
104
104
}
105
- MPlatform = Platform;
105
+ MPlatform = & Platform;
106
106
}
107
107
// TODO catch an exception and put it to list of asynchronous exceptions
108
108
// getAdapter() will be the same as the Adapter passed. This should be taken
@@ -158,7 +158,7 @@ uint32_t context_impl::get_info<info::context::reference_count>() const {
158
158
this ->getAdapter ());
159
159
}
160
160
template <> platform context_impl::get_info<info::context::platform>() const {
161
- return createSyclObjFromImpl<platform>(MPlatform);
161
+ return createSyclObjFromImpl<platform>(* MPlatform);
162
162
}
163
163
template <>
164
164
std::vector<sycl::device>
0 commit comments