@@ -41,10 +41,10 @@ context_impl::context_impl(const std::vector<sycl::device> Devices,
4141 async_handler AsyncHandler,
4242 const property_list &PropList)
4343 : 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())),
46+ MPropList(PropList), MSupportBufferLocationByDevices(NotChecked) {
4647 verifyProps (PropList);
47- MPlatform = detail::getSyclObjImpl (MDevices[0 ].get_platform ());
4848 std::vector<ur_device_handle_t > DeviceIds;
4949 for (const auto &D : MDevices) {
5050 if (D.has (aspect::ext_oneapi_is_composite)) {
@@ -96,13 +96,13 @@ context_impl::context_impl(ur_context_handle_t UrContext,
9696 make_error_code (errc::invalid),
9797 " No devices in the provided device list and native context." );
9898
99- std::shared_ptr<detail:: platform_impl> Platform =
99+ platform_impl & Platform =
100100 platform_impl::getPlatformFromUrDevice (DeviceIds[0 ], Adapter);
101101 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)));
104104 }
105- MPlatform = Platform;
105+ MPlatform = Platform. shared_from_this () ;
106106 }
107107 // TODO catch an exception and put it to list of asynchronous exceptions
108108 // 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 {
158158 this ->getAdapter ());
159159}
160160template <> platform context_impl::get_info<info::context::platform>() const {
161- return createSyclObjFromImpl<platform>(MPlatform);
161+ return createSyclObjFromImpl<platform>(* MPlatform);
162162}
163163template <>
164164std::vector<sycl::device>
0 commit comments